Sample Hardness Based Gradient Loss for Long-Tailed Cervical Cell Detection

Minmin Liu, Xuechen Li, Xiangbo Gao, Junliang Chen, Linlin Shen, Huisi Wu

Introduction

Cervical cancer screening involves analyzing Whole Slide Images (WSIs) containing thousands of cells. In clinical practice, cancerous cells are rare compared to normal or inflammatory cells, leading to an extreme class imbalance known as a long-tailed distribution. Standard object detectors struggle with this distribution because abundant "head" categories overwhelm the loss function, causing the model to neglect rare but critical "tail" categories.

Long-tailed distribution of cervical cell categories in the CCA-LT dataset.

Furthermore, the foreground-background imbalance in detection provides a massive number of "easy negative" background samples that can drown out signals from actual cells. While common solutions use class-level re-weighting, they often ignore sample hardness—the fact that some normal cells are difficult to distinguish from cancer, while some cancer cells are relatively easy to identify.

Grad-Libra Loss

To address these challenges, the authors propose Grad-Libra Loss, a novel loss function that moves away from static class-level weights toward dynamic, sample-level gradient calibration. This approach uses the gradient norm ($g$) of the cross-entropy loss as a proxy for sample hardness: a high gradient indicates the model is struggling with a specific sample (it's "hard"), while a low gradient indicates an "easy" sample.

The Grad-Libra Loss mechanism compared to standard Binary Cross-Entropy, alongside the modulating function F(g).

Dynamic Calibration

The loss applies a monotonically increasing function to the gradient: $F(g) = g - \alpha \cdot \sin(g)$. This function acts as a weight ($G$) for the original loss. By splitting the loss into positive and negative components ($L_{GL}^+$ and $L_{GL}^-$) with independent modulating factors ($\alpha^+$ and $\alpha^-$), the detector can tune its emphasis on hard positive samples (rare cells) versus easy negative samples (background). This "plug-and-play" loss is designed for the classification branch of standard anchor-free detectors like FCOS and ATSS.

Datasets and Implementation

The researchers established the CCA-LT (Cervical Cancer Analysis - Long Tailed) dataset from Thinprep Cytology Test (TCT) specimens. The dataset contains 10 categories ranging from frequent (inflammation, normal) to rare (SCC, trichomonad, ASC-H). WSIs were processed into 512×512 patches for training. Unlike methods that require pre-computed data statistics, Grad-Libra is adaptive and responds to the model's current state during training.

Key Results

Grad-Libra Loss consistently outperformed state-of-the-art long-tailed learning methods (like Seesaw Loss and Focal Loss):

  • Overall Performance: Achieved 53.1% mAP, a 7.8% absolute gain over the Cross-Entropy baseline.
  • Rare Class Boost: Performance on rare categories increased by 8.4% AP.
  • Architecture Generalization: Provided consistent boosts across FCOS (+6.0% mAP), ATSS (+8.8% mAP), and YOLOF (+3.5% mAP).
  • Recall: Significantly improved mean recall for rare categories, such as a 31% increase for FCOS.

Conclusion

Grad-Libra Loss demonstrates that focusing on sample hardness rather than just class frequency leads to more balanced classifiers. By focusing on the gradient, the model puts its "effort" where it is most confused, regardless of which class the sample belongs to. This results in more uniform weight norms across all categories and significantly improves the detection of rare, critical cancer cells in cervical screening.

Summary updated

BibTeX
@inproceedings{liu2022sample,
  author = {Minmin Liu and Xuechen Li and Xiangbo Gao and Junliang Chen and Linlin Shen and Huisi Wu},
  title = {{Sample Hardness Based Gradient Loss for Long-Tailed Cervical Cell Detection}},
  booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention},
  year = {2022},
  doi = {10.1007/978-3-031-16434-7\_11},
}
Figure