Loss Function Discovery for Object Detection via Convergence-Simulation Driven Search

Peidong Liu, Gengwei Zhang, Bochao Wang, Hang Xu, Xiaodan Liang, Yong Jiang, Zhenguo Li

TL;DR

The authors present CSE-Autoloss, an evolutionary search framework that automatically discovers novel loss functions for object detection. By incorporating mathematical "convergence-simulation" checks to prune 99% of invalid candidates, they achieved a 20x search speedup and found new loss functions that outperform standard hand-crafted baselines like Cross-Entropy and Focal Loss across various architectures.

What Problem Does This Paper Address?

In object detection, the loss function is the "steering wheel" of the model, guiding it to balance class labels and box coordinates. Traditionally, these functions (like Cross-Entropy, Focal Loss, or IoU loss) are hand-crafted by experts. However, manual design is tedious and may not perfectly align with the final evaluation metric (mAP).

While "AutoML" has successfully searched for neural architectures (NAS), searching for loss functions is significantly harder due to the sparse action space. Most random combinations of mathematical operators (like sin(log(x)) + exp(y)) result in functions that are mathematically "broken"—they might diverge to infinity, have non-sensical gradients, or simply fail to converge. Evaluating every candidate by training a full detector is computationally impossible, taking weeks or months of GPU time.

Methods

The researchers proposed CSE-Autoloss, which treats a loss function as a computational graph (a Directed Acyclic Graph) built from 21 primitive operators (e.g., log, exp, sigmoid, dot product), constants, and variables (predictions, labels, and IoU scores).

CSE-Autoloss Pipeline

To solve the efficiency problem, they introduced two Convergence-Simulation modules that act as filters:

  1. Convergence Property Verification: This uses basic calculus to check if a candidate loss is "rational." It ensures the loss is monotonic (it should go down as the model gets more accurate) and that the gradient magnitude converges to zero as the prediction approaches the target.
  2. Model Optimization Simulation: Instead of a full training run, they perform a "proxy task." They train the model on a tiny subset of data (just one image per category) for a very short time. If the loss can't even optimize this tiny set, it’s discarded.

Only the "surviving" candidates are evaluated on a larger proxy dataset to determine their fitness for the next generation of the evolutionary search.

Datasets

  • MS COCO: The primary dataset used for the search and main evaluation.
  • PASCAL VOC 2007: Used to test the "transferability" of the discovered losses to different data distributions.
  • Berkeley Deep Drive (BDD): An autonomous driving dataset used for further generalization testing.

Key Insights and Ideas

  • Pruning is Power: By applying mathematical constraints before training, the authors filtered out over 99% of the search space. This reduced the search time from an estimated 30+ days to just 1.5 days.
  • IoU as a Classification Feature: One of the most insightful findings was that the best-performing classification losses often incorporated the IoU (Intersection over Union) as an input. This helps the model "know" how well the box is localized while it's deciding what the object is, creating a tighter coupling between the two tasks.
  • Complexity vs. Intuition: The discovered losses (like CSE-Autoloss-Acls) are more complex than standard Cross-Entropy but remain computationally efficient. They often resemble "weighted" versions of existing losses that humans might not intuitively design but which the data prefers.

Key Results

  • Performance Gains: On the COCO dataset, the discovered losses improved mAP by 1.1% for two-stage detectors (Faster R-CNN) and 0.8% for one-stage detectors (FCOS) compared to standard baselines.
  • Generalization: A loss function discovered using a ResNet-50 backbone worked equally well when moved to larger backbones (ResNet-101) or different architectures (Cascade R-CNN, Mask R-CNN) without needing a re-search.
  • Efficiency: The search process is 20x faster than a vanilla evolutionary algorithm, making automated loss discovery practical for researchers with limited compute.
Performance Gains on COCO

Limitations and Future Work

  • Human-Defined Primitives: While the search is automated, the "building blocks" (the 21 operators) are still chosen by humans. There might be even better primitives yet to be included.
  • Proxy Task Sensitivity: The "one image per category" simulation is a clever shortcut, but it might occasionally discard complex losses that only show their value on large-scale, noisy data.
  • Interpretability: Some of the discovered regression formulas are mathematically "messy" (long fractions with many terms), making it difficult for researchers to explain exactly why they work better than simpler ones.
  • Future Direction: The authors suggest applying this framework to other complex tasks like instance segmentation or keypoint detection, where loss design is equally challenging.

Summary updated

BibTeX
@inproceedings{liu2021loss,
  author = {Peidong Liu and Gengwei Zhang and Bochao Wang and Hang Xu and Xiaodan Liang and Yong Jiang and Zhenguo Li},
  title = {{Loss Function Discovery for Object Detection via Convergence-Simulation Driven Search}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=5jzlpHvvRk},
}
Figure