Dynamic multi-scale loss optimization for object detection

Yihao Luo, Xiang Cao, Juntao Zhang, Peng Cheng, Tianjiang Wang, Qi FengMultimedia Tools and Applications 2021

Introduction: The Challenge of Scale Imbalance

Modern object detectors rely on Feature Pyramid Networks (FPN) to handle objects across a wide range of sizes. However, standard training protocols typically treat losses from all pyramid levels—from $P_3$ to $P_7$—with equal weight. This paper identifies a critical "objective imbalance": losses across different scales are neither equally important nor independent.

Standard FPN architecture with multiple prediction levels (C2-C5) and corresponding pyramid levels (P2-P5).

The authors observe three key issues that hinder optimal training:

  1. Loss Magnitude: Larger-scale feature maps often contribute disproportionately to the total loss.
  2. Fluctuation: Regression losses exhibit significantly higher variance compared to classification losses.
  3. Instability: Localization accuracy, measured by IoU, is highly unstable across different scales.
Multi-scale regression loss (left) and IoU curves (right) demonstrating the significant imbalance and instability across different feature levels during training.

When these imbalanced signals are naively summed, gradients from dominant scales can overshadow others, leading to suboptimal convergence and preventing the model from reaching its full potential.

Proposed Methodology

To address these imbalances, the authors introduce two dynamic weighting strategies that operate exclusively during the training phase, requiring no architectural changes to the final detector.

Adaptive Variance Weighting (AVW)

AVW moves away from manual weight tuning by leveraging the statistical variance of losses at each scale. The method calculates a "variance reduction rate" over specific iteration intervals. A high reduction rate suggests that a particular scale is in an active learning phase and should be prioritized. AVW identifies the top two most "important" scales based on this metric and amplifies their weights by a factor of $\lambda$.

Reinforcement Learning Optimization (RLO)

Recognizing that the optimal weighting strategy may shift during training, the authors propose RLO. This approach treats the detector as a multi-agent system where a policy selects the best weighting scheme for the current training state.

  • Actions: The agent can prioritize scales based on variance reduction, minimum loss, maximum loss, or default to equal weighting.
  • Reward Mechanism: A positive reward is granted if the total loss decreases between training states.
  • Policy Learning: The system uses a probabilistic selection process that adjusts based on historical rewards, effectively "discovering" an optimal training schedule automatically.

Importantly, these methods add no extra parameters to the final model and do not impact inference speed or memory usage.

Experimental Results

The proposed methods were evaluated on MS COCO (2017) and Pascal VOC (2007) across various detector architectures, including RetinaNet, Faster R-CNN, and FCOS:

  • RetinaNet: Improved by +0.8 AP on COCO with a ResNet-50 backbone.
  • FCOS: Performance gains of +0.4 AP (ResNet-50) and +0.3 AP (ResNet-101).
  • Scale-Specific Gains: Significant improvements were noted in $AP_L$ (large objects), indicating better utilization of low-resolution feature maps through dynamic weighting.

The computational overhead during training is negligible (e.g., an increase of only 0.14s per 50 iterations), while inference remains a "free lunch" with zero added latency for the end-user.

Conclusion and Future Directions

Dynamic multi-scale loss optimization provides a robust way to improve object detection performance without architectural changes. By using variance as a proxy for learning importance, the model can focus its training efforts where they are most needed. While high fluctuations in certain loss functions (like IoU-loss) remain a challenge, the variance-based approach consistently outperforms static baselines. Future research could extend these reinforcement learning strategies to address other training imbalances, such as class distribution in long-tailed datasets.

Summary updated

BibTeX
@article{luo2021dynamic,
  author = {Yihao Luo and Xiang Cao and Juntao Zhang and Peng Cheng and Tianjiang Wang and Qi Feng},
  title = {{Dynamic multi-scale loss optimization for object detection}},
  journal = {Multimedia Tools and Applications},
  year = {2021},
  doi = {10.1007/s11042-022-13164-9},
}
Figure