Balanced Activation for Long-tailed Visual Recognition

Jiawei Ren, Cunjun Yu, Zhongang Cai, Haiyu ZhaoarXiv 2020

Abstract

Standard deep learning models often struggle with long-tailed data distributions, where a few "head" classes dominate the training set while many "tail" classes are under-represented. This imbalance leads to a significant bias in standard activation functions like Softmax and Sigmoid. This paper introduces Balanced Activation (comprising Balanced Softmax and Balanced Sigmoid), a mathematically grounded approach that corrects for this inherent bias by explicitly modeling the distribution shift between imbalanced training sets and balanced test sets. By applying Bayesian inference and Margin Theory, the proposed method achieves significant performance gains on benchmarks like LVIS and CIFAR-LT without adding computational overhead or extra parameters.

1. Introduction

In real-world visual recognition tasks, data is rarely distributed uniformly. Instead, it typically follows a long-tailed distribution where common categories (e.g., "person," "car") appear frequently, while rare categories (e.g., "unicycle," "gargoyle") appear sparingly. Standard classifiers trained on such data tend to minimize empirical risk, which naturally biases the model toward head classes.

Traditional mitigation strategies often involve re-sampling (oversampling tail classes or undersampling head classes) or re-weighting the loss function. However, these methods can lead to optimization instability or the under-representation of head class features. This paper argues that the bias is not merely in the data, but is fundamentally baked into the activation functions themselves, which assume that the training and testing label distributions are identical.

2. Methodology

2.1 Balanced Softmax

The authors demonstrate through Bayesian inference that the standard Softmax function is intrinsically biased when the training prior differs from the test prior. To rectify this, they derive Balanced Softmax. In this formulation, the exponential term for each class $j$ is scaled by its training frequency $n_j$:

$$\hat{y}_j = \frac{n_j e^{z_j}}{\sum_{k} n_k e^{z_k}}$$

This adjustment "unbiases" the model's predictions during the training phase, ensuring that the model does not over-penalize tail classes simply because they appear less frequently.

2.2 Balanced Sigmoid

In object detection tasks, classifiers must often handle an "uncountable" number of background samples, making Sigmoid-based classifiers a common choice. The authors extend the logic of Balanced Softmax to create Balanced Sigmoid, which similarly adjusts for the discrepancy between training and testing priors in a binary or multi-label classification context.

2.3 Theoretical Grounding: Margin Theory

Beyond probabilistic intuition, the authors utilize Margin Theory to provide a formal justification. They show that the Balanced Softmax loss is mathematically equivalent to minimizing the generalization error bound. By forcing the model to maintain a larger margin for tail classes, the method compensates for the lack of training samples, leading to better generalization on rare categories.

3. Experimental Evaluation

The proposed methods were evaluated on three major long-tailed benchmarks:

  • CIFAR-10-LT & CIFAR-100-LT: Versions of the CIFAR datasets modified with varying imbalance factors (up to 200).
  • LVIS-1.0: A large-scale dataset for Large Vocabulary Instance Segmentation featuring over 1,000 naturally long-tailed categories.

3.1 Key Results

  • LVIS-1.0 Performance: Using a standard Mask R-CNN baseline, Balanced Sigmoid achieved 26.4% mAP, a significant improvement over the 23.2% mAP achieved by the standard Repeat Factor Sampling (RFS) baseline. It also outperformed other popular strategies like Classifier Re-training (cRT) and Learnable Weight Scaling (LWS) by approximately 2% mAP.
  • CIFAR-100-LT Stability: On the most challenging version of CIFAR-100-LT (imbalance factor of 200), Balanced Softmax reached 45.9% accuracy, compared to 41.0% for standard Softmax.
  • Efficiency: A primary advantage of Balanced Activation is that it is a drop-in replacement for standard loss functions. It introduces zero additional parameters and zero extra FLOPs during inference.

4. Discussion and Conclusion

Balanced Activation provides a simple yet effective fix for the long-tail problem by addressing the mathematical bias in standard activation functions. While the method significantly improves performance and stability, the authors note that optimization remains a challenge; overwhelming gradients from head classes can still dominate the learning process.

Future work may involve combining Balanced Activation with advanced optimization strategies, such as learnable importance sampling, to further stabilize training for extremely rare classes. Nonetheless, Balanced Activation stands as a highly efficient, theoretically sound baseline for long-tailed visual recognition.

Summary updated

BibTeX
@misc{ren2020balanced,
  author = {Jiawei Ren and Cunjun Yu and Zhongang Cai and Haiyu Zhao},
  title = {{Balanced Activation for Long-tailed Visual Recognition}},
  year = {2020},
  eprint = {2008.11037},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2008.11037},
}
Figure