# Long-Tail Instance Segmentation Based on Memory Bank and Confidence Calibration
## 3 Proposed Method
### Post-Processing Calibration  
The post-processing confidence calibration method is applied to a pre-trained classifier sub-network. We consider Faster R-CNN [26] and Mask R-CNN [27] as examples. These networks are applied to a softmax classifier with \(C+1\) object proposals, where \(C\) is the number of foreground classes and 1 denotes the background class. To prevent the scores from being biased toward regular classes [28], the logit of each class can be rescaled according to the number of classes using the number of training images. The key to the method is to maintain the logit of the background class as unchanged. Because the meanings of the background class and an object class are different, the value of the logit of the background class does not affect the ranking of the object classes.  
In the task of instance segmentation, a standard classification loss function is the cross-entropy loss function, expressed as follows:  
\[\mathrm{L}_{CE}(x,y)=-\sum_{c=1}^{C+1}y|c|\times\log(p(c|x)) \tag{1}\]  
\[s_{c}=p(c|x)=\frac{\exp(\phi(x))}{\sum_{c=1}^{C}\exp(\phi_{c}(x))+\exp(\phi_{c +1}(x))} \tag{2}\]  
where \(\phi_{c}\) is the logit of class \(c\), usually implemented with \(\omega_{c}^{T}f_{\theta}(x)\), \(\omega_{c}\) is a linear classifier for class \(c\), \(f_{\theta}\) is the feature network, and \(C+1\) represents the background classes. Moreover, \(N_{c}\) denotes the number of class \(c\), and hence the primary purpose of this paper is to address the imbalance in the later stages of model \(N_{c}\). Equation (1) tends to give a higher score to frequent categories.  
To implement a simple post-processing calibration method, the approach proposed in this paper is to equiproportionally deflate each class \(c\) according to its logit size [29]. After adjusting the logit, the confidence scores are recalculated and normalized for all classes, including the background class, and the label assignment for each object is determined. After isometric scaling, Equation (2) can be decomposed into Equation (3).  
\[s_{c}=p(c|x)=\frac{\sum_{c=1}^{C}\exp(\phi_{c^{\prime}}(x))}{\sum_{c^{\prime}= 1}^{C}\exp(\phi_{c^{\prime}}(x))+\exp(\phi_{C+1}(x))}\times\frac{\exp(\phi_{c}( x))}{\sum_{c^{\prime}=1}^{C}\exp(\phi_{c^{\prime}}(x))} \tag{3}\]  
In contrast to [20], instead of tuning each class individually by a specific factor, the method proposed in this paper sets the factor as a function of the class size following [29],  
Figure 3: Specific resampling strategy in memory banks.  
leaving only a hyperparameter for tuning. To set the hyperparameter, the positive factor \(a_{c}\) (Equation (5)) scales the exponent of \(\phi_{c}\) to obtain the following:  
\[s_{c}=p(c|x)=\frac{\exp(\phi(x))/a_{c}}{\sum_{c^{\prime}=1}^{\mathbb{C}}\exp( \phi_{c^{\prime}}(x))/a_{c^{\prime}}+\exp(\phi_{\mathbb{C}+1}(x))} \tag{4}\]  
According to Equation (4), if \(a_{c}\) increases monotonically with respect to \(N_{c}\), the score of the head class will be effectively suppressed. In addition, when the parameter \(\lambda\) in the following equation is 0, the confidence score obtained from Equation (2) is used.  
\[a_{c}=N_{c}^{\lambda},\lambda\geq 0 \tag{5}\]