DOI: 10.3390/jimaging12070293 ISSN: 2313-433X

Weighted Sampling with Frequency-Aware Spatial Attention for Imbalanced Image Classification

Shiqi Zhang, Peng Li

Class imbalance remains a critical challenge in image classification, where underrepresented classes often receive insufficient training attention and exhibit poor recognition performance. In this study, we propose a hybrid framework that combines weighted sampling with frequency-aware spatial attention (WSFSA) to address class imbalance at both the data and feature levels. The weighted sampler improves the training exposure of minority classes, while the frequency-aware spatial attention module incorporates class-frequency information into spatial attention to enhance discriminative feature responses for underrepresented classes. We evaluate the proposed method on four MedMNIST benchmarks, DermaMNIST, BloodMNIST, OrganCMNIST, and DermaMNIST-224, using a ResNet-18 backbone. Results show that WSFSA provides the clearest benefit on the severely imbalanced DermaMNIST and DermaMNIST-224 datasets, performing comparably to the strongest baseline methods while showing particular benefits under severe class imbalance. On OrganCMNIST, WSFSA provides moderate gains, while on BloodMNIST, where the imbalance effect is weaker, all methods perform similarly. Per-class analysis further shows that WSFSA improves sensitivity for several minority or difficult classes while maintaining high specificity across most classes. These findings suggest that combining sampling-level and feature-level rebalancing is a practical strategy for improving class-balanced recognition, particularly under severe class imbalance.

More from our Archive