Learning a Unified Sample Weighting Network for Object Detection

Qi Cai, Yingwei Pan, Yu Wang, Jingen Liu, Ting Yao, Tao Mei

Introduction

In the field of object detection, the challenge of training on imbalanced or noisy datasets has traditionally been met with hand-crafted heuristics. Strategies like Online Hard Example Mining (OHEM) and Focal Loss focus on "hard" examples—those with high classification loss. However, these methods are often static and task-independent, failing to account for the nuances of bounding box regression or the possibility that a "hard" sample is simply a low-quality outlier. Researchers from JD AI Research and USTC have proposed a Unified Sample Weighting Network (SWN) to address these limitations through a data-driven, learnable approach.

The Unified Sample Weighting Network (SWN)

The SWN is a lightweight Multi-Layer Perceptron (MLP) integrated into the training pipeline of standard detectors like Faster R-CNN or RetinaNet. Unlike fixed mathematical functions, the SWN learns to predict the importance of each training sample for both classification and localization tasks.

Probabilistic Framework

The core of the SWN is a probabilistic reformulation of the detection objective. By modeling sample importance through "uncertainty," the network can down-weight samples that might otherwise degrade performance. During training, the SWN takes four key features as input for every sample: classification loss, regression loss, Intersection over Union (IoU) with ground truth, and the predicted probability score.

Joint Task Weighting

A significant innovation of the SWN is its ability to decouple weights for different tasks. It predicts two distinct weights for every sample: one for the classification branch and another for the regression branch. This allows the model to handle "task misalignment," where a sample might be easy to classify but difficult to localize accurately. Crucially, the SWN is only active during training; it is discarded during inference, ensuring no additional computational overhead for the final detector.

Figure 5: An example of an 'easy' sample (low loss) being assigned a high weight, demonstrating that high-confidence samples are critical for fine-tuning.

Key Insights: Hardness vs. Importance

The research highlights that a sample's "hardness" (loss) does not always correlate with its "importance" for learning.

Figure 6: Qualitative examples showing (a) high-loss samples being down-weighted, (b) low-loss samples being up-weighted, and (c) the misalignment between classification scores and localization IoU.

As shown in Figure 6, some high-loss samples (a) are actually poor-quality regions that should be ignored to prevent model confusion. Conversely, "easy" samples with high IoU (b) are essential for achieving high-precision localization. Furthermore, the misalignment between classification scores and IoU (c) justifies the need for independent weighting across tasks.

Experimental Results

The SWN was rigorously tested on the MS COCO and Pascal VOC benchmarks, showing consistent improvements across various architectures:

  • Faster R-CNN: Achieved a 1.8% AP gain on MS COCO with a ResNet-50 backbone.
  • RetinaNet: Improved AP by 1.8% on MS COCO using a ResNeXt-101 backbone.
  • Mask R-CNN: Saw gains between 1.1% and 1.5% AP.

Qualitatively, SWN-boosted models excel at detecting clear, "easy" objects that standard models occasionally miss due to an over-focus on hard examples during training.

Conclusion

By replacing manual heuristics with a learnable, data-driven weighting network, the SWN provides a more robust and effective way to train object detectors. It successfully bridges the gap between classification and localization tasks without sacrificing inference speed, marking a significant step toward more automated and efficient model training.

Summary updated

BibTeX
@inproceedings{cai2020learning,
  author = {Qi Cai and Yingwei Pan and Yu Wang and Jingen Liu and Ting Yao and Tao Mei},
  title = {{Learning a Unified Sample Weighting Network for Object Detection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  doi = {10.1109/cvpr42600.2020.01418},
}
Figure