# BWLM: A Balanced Weight Learning Mechanism for Long-Tailed Image Recognition
## 2 Related Work  
**Data Re-Balancing. ** Most previous research on long-tailed imbalanced data have focused on re-balancing during the training. The re-sampling strategy includes over-sampling the rare image classes [15; 37; 38] and under-sampling the common image classes [15; 39; 40]. The purpose is to restore imbalanced training data to a regular and balanced distribution state. Usually, over-sampling has a significant effect on large datasets, but for small datasets, rare classes often exhibit over-fitting. Because the majority of the data in the common classes are discarded in cases of under-sampling, the deep model's capacity for generalization declines. When the IF is too large, the under-sampling strategy is unreasonable. The core idea of reweighting [29; 35; 41; 42] is to assign different weights to the losses of the classes. However, such a strategy often leads to unstable training when the IF is too large. When the assigned weight is too large, the gradient will also be abnormally large, leading to a deviation in the accuracy of the class. **Loss Function Engineering. ** For class-level reweighting methods, it is difficult to find suitable and effective weights by directly setting weights based on the number of classes. Thus, some methods do not clearly define the common and rare classes, shifting attention to the effective sample size, the sample difficulty, etc. By assessing each class's degree of learning, [PERSON] et al. [43] determined loss weights and suggested a method called Class Wise Differentially Balanced Loss (CDB loss). [PERSON] et al. [44] considered all classes as rare classes and proposed the loss function, which adaptively balances the negative gradient between different classes to improve the classifier's ability to distinguish rare classes. Seesaw loss [45] dynamically adjusts the penalty for classes with fewer samples based on the ratio of the number of samples in rare classes to that in common classes as a mitigation factor. [PERSON] et al. [46] utilized the degree of imbalance between positive and negative samples of different classes to rebalance the contribution of their losses, and extended the idea of equalization loss to the object detector [47]. [PERSON] et al. [31] proposed the concept of effective sample size, believing that there is information overlap between data, especially in common classes with large amounts of data. This reduces the marginal benefits extracted by the model from the data. Hence, they proposed class-balanced loss (CB), which adds the effective sample size as a weight to the loss function.Tan et al. [48] found that, because the positive samples of each class are negative samples for other classes, the gradient from the negative samples for rare classes is greater than that of positive samples. Therefore, the negative gradient of common classes suppresses the learning of rare classes. Therefore, they proposed equalization loss to ignore the gradient of rare classes  
Figure 1: Overview of our two-stage training framework. In the first stage, we use common class samples to learn the stage 1 model, which uses a common cost function of cross-entropy loss \(L_{CE}\). denotes training is in progress, while denotes that the transfer weights are frozen and cannot be trained. In the second stage, after obtaining the weights \(\Theta^{*}\) of stage 1, we combine class balanced loss \(L_{CB}\) with a balanced softmax loss \(L_{BS}\) to obtain BWLM, which is embedded in stage 2.  
in the softmax function to solve the problem of long-tailed rare classes. In [PERSON] et al. [32], based on the Bayesian theorem, the label distribution bias leads to Softmax regression, which results in a classifier that leans more towards common classes. Therefore, they considered the changes in label distribution and proposed a balanced softmax loss. **Stage-wise Training. ** Dividing the training task into multiple stages to train the deep networks [8; 49; 50] is also a common strategy.