Abstract
In training deep object detectors, the problem of foreground-background imbalance has been addressed by several heuristic methods, such as online hard example mining (OHEM), Focal Loss, and gradient harmonizing mechanism (GHM). These methods either re-sample the training examples (i.e. hard sampling), or re-weight them discriminatively (i.e. soft sampling). In this paper, we challenge the necessity of such hard/soft sampling heuristics in training deep object detectors. First, without hard/soft sampling, we reveal that the scale and the stability of the classification loss greatly influence the final accuracy. Thus, we propose a guided loss scaling technique to control the classification loss during training, without using any hyper-parameter. We also propose to optimally initialize the model to ensure the stability of the classification loss. Moreover, we propose an adaptive thresholding technique to refine predictions during inference. These three ingredients constitute our Sampling-Free mechanism, which is fully data diagnostic and avoids the laborious hyper-parameter search for hard/soft sampling. We verify the effectiveness of our Sampling-Free mechanism in training one-stage, two-stage, multi-stage, and anchor-free object detectors, where our method always achieves higher accuracy on COCO and PASCAL VOC datasets. We also use the Sampling-Free mechanism for instance segmentation to demonstrate its generalization ability.
Introduction
Object detection faces a fundamental challenge: the extreme imbalance between foreground objects and background clutter. In a typical image, a detector might evaluate hundreds of thousands of candidate locations, only a handful of which contain actual objects. Historically, the community has relied on sampling heuristics to prevent the background "noise" from overwhelming the training signal. These heuristics generally fall into two categories: Hard Sampling (e.g., OHEM), which selects a subset of examples, and Soft Sampling (e.g., Focal Loss), which re-weights examples based on difficulty.
While effective, these methods introduce manual hyper-parameters (like $\alpha$ and $\gamma$ in Focal Loss) that require extensive tuning. Furthermore, they often create a "distribution mismatch" between training and inference. This paper challenges the necessity of these heuristics, proposing a "Sampling-Free" approach that relies on data-driven stabilization rather than manual re-weighting.
The Sampling-Free Mechanism
The proposed Sampling-Free mechanism replaces manual heuristics with three core components designed to stabilize training and align inference with the data distribution:
- Adaptive Initialization: Standard cross-entropy loss can become unstable at the start of training due to class imbalance. By calculating the actual foreground-to-background ratio in the training set and using it to set the initial bias of the classification layer, the model starts in a stable state without "exploding" loss.
- Guided Loss Scaling: Instead of manually weighting classification versus regression loss, the authors use the ratio between current regression loss (calculated only for foreground) and classification loss to dynamically scale the latter. This ensures both tasks remain balanced throughout training without a fixed "reduction factor."
- Adaptive Thresholding: During inference, a fixed confidence threshold (e.g., 0.05) is typically used. However, class imbalance shifts the model's confidence scores. The authors introduce a threshold that adapts based on the foreground-to-background ratio of each specific class, preserving more true positives.
Experimental Results
The Sampling-Free mechanism was evaluated on the COCO benchmark across a wide range of architectures, including one-stage (YOLOv3, RetinaNet), two-stage (Faster R-CNN), multi-stage (Cascade R-CNN), and anchor-free (FoveaBox) detectors.
As shown in the table above, the Sampling-Free approach consistently outperforms traditional heuristics. Notable improvements include:
- YOLOv3: Increased from 33.0 to 33.9 AP.
- Faster R-CNN: Improved from 37.2 to 38.0 AP.
- Mask R-CNN: Improved from 38.0 to 38.7 AP, demonstrating benefits for instance segmentation.
- Cascade R-CNN: Reached 41.2 AP, and up to 44.3 AP with a ResNext-101 backbone.
One of the most significant findings is that RetinaNet, which was specifically designed to use Focal Loss, achieves nearly identical performance using standard Cross-Entropy when combined with the Sampling-Free stabilization techniques.
Qualitative Analysis
Beyond quantitative metrics, the Sampling-Free mechanism produces high-quality detections and segmentations across diverse scenes.
The model demonstrates robustness in complex environments, accurately identifying and segmenting objects despite the lack of manual sampling heuristics during training.
Conclusion
This research demonstrates that complex sampling heuristics are not a prerequisite for training high-performance object detectors. By focusing on loss stability and data-driven initialization/thresholding, the Sampling-Free mechanism achieves superior results while simplifying the training pipeline and removing the need for laborious hyper-parameter searches. This "sampling-free" philosophy offers a promising direction for other imbalanced learning tasks in computer vision.
Summary updated