# SAR Target Incremental Recognition Based on Hybrid Loss Function and Class-Bias Correction
## 3 Methodology
### Hybrid Loss Function for Knowledge Distillation and Class Separation
#### 3.2.2 Loss Function for Class Separation  
As mentioned above, the second problem of incremental learning is that the old and new target classes are easily confused when similar target classes increase. With the arrival of new target classes in the training phase, on the one hand, the total number of target classes that the model needs to recognize continues to increase; on the other hand, the visually similar target classes in each training phase will also increase. The boundary between target classes is very sensitive. The increase of visually similar target classes will reduce the recognition accuracy. Moreover, the similarity between different target classes and the difference between the same target classes will indirectly lead to the confusion of the new and old classes in the model, and hence it will produce a series of adverse effects.  
Regarding this problem, an class separation loss \(L_{SP}\) is designed in this paper to better separate the old and new target samples.  
Generally, calculating \(L_{SP}\) requires a three-part triplet: benchmark, positive samples, and negative samples [28]. In incremental learning, considering that the number of trainable samples in the old classes is small, it is wise to make full use of these preserved samples to reduce the confusion in the model learning process effectively. In this paper, each sample of old classes is used as a benchmark. The class vector corresponding to the benchmark belonging to the old class (each column of the weight vector in the last layer of the model can be considered as the class vector of each class) is used as the positive samples. The negative samples are the class vector corresponding to the new class that produces a higher response to the benchmark. Benchmark and positive samples belong to the same classes, while negative samples come from different classes. The purpose of using this loss is to maximize the distance between the old and new classes. The distance between samples from the same classes will be as small as possible than the distance between samples from different classes, thus solving the confusion problem between the old and new tasks. The designed loss function \(L_{SP}\) is described as  
\[L_{SP}(x)=\frac{1}{k}\sum_{i=1}^{n}max[(r+D(f(x_{a}^{i}),x_{p}^{i})-D(f(x_{a} ^{i}),x_{n}^{i})),0] \tag{7}\]  
where \(r\) is a hyperparameter, \(k\) is the number of preserved samples in the old classes included in each incremental phase, and \(f(x)\) denotes the feature vector about sample \(x\) obtained after the current model. \(x_{p}\), \(x_{n}\) are the class vectors corresponding to positive and negative samples. \(D(*,*)\) denotes the cosine distance between the two vectors \(f_{1}\), \(f_{2}\),  
\[D(f_{1},f_{2})=\frac{f_{1}\cdot f_{2}}{||f_{1}||\times||f_{2}||} \tag{8}\]  
As \(r\) is added to the loss function, the value of the loss function is equal to 0 only when the distance between the benchmark and the negative samples exceeds the distance \(r\) between the benchmark and the positive samples. Therefore, during the incremental learning process by gradient updating and network training, the distance between different classes will eventually increase to \(r\). Another point to note is the benchmark \(x\), whose corresponding positive and negative samples are not directly from the training sets, but the corresponding class vectors. This allows the class separation loss \(L_{SP}\) to be added directly to the incremental learning process without changing the sampling of the data sets.