## 4 Methodology
### Contrastive-Center Loss  
Neural networks employ a loss function to measure the discrepancy between the model's output and the ground truth. The model's weights are then adjusted based on this disparity to update the network. However, defining an appropriate loss function is a challenging problem when tackling FSRE tasks where the goal is to generate separable representations for new classes. This paper introduces a novel loss function, namely, the contrastive-center loss function, designed to enhance the discriminability of samples from  
Figure 5: Schematic diagram of the prototype enhancement process. The initial prototypes of N categories are input into a multi-head self-attention mechanism to obtain enhanced prototypes. These enhanced prototypes are then combined with the initial prototypes to form the final prototypes. different relationship categories by encouraging both aggregation and dispersion in the feature space. It aims to tightly cluster samples of the same relationship category in the feature space while dispersing samples from different relationship categories, thereby improving the model's distinctiveness and classification performance. This enhancement makes a significant contribution to achieving better relationship classification results with the model. The center loss function was initially introduced by [PERSON] et al. [52] in 2016 to address face recognition tasks. Unlike the traditional cross-entropy loss function, the center loss function calculates the distance of each sample from its respective class center. It penalizes the distance between the current sample's feature vector and its assigned class center vector during each forward pass, aiming to minimize the distance within the same category. Equation (7) represents the distance in the center loss function:  
\[\mathcal{L}_{center}=\frac{1}{2}\sum_{i}^{n}\lVert s_{i}-c_{k^{i}}\rVert_{2}^ {2} \tag{7}\]  
where \(\mathcal{L}_{c}\) represents the center loss. \(S_{i}\) denotes the \(i\)-th training sample. \(k^{i}\) represents the label of \(S_{i}\). \(c_{k^{i}}\in R^{d}\) signifies the feature center of the \(k^{i}\) class's deep feature in each mini-batch, where d denotes the feature dimension. In the training of deep neural networks, using a single loss function might not fully optimize the model. Therefore, [PERSON] et al. [52] combined softmax with center loss to train the network when addressing facial recognition problems. The formula is as described in Equation (8):  
\[\mathcal{L}=\mathcal{L}_{softmax}+\lambda\mathcal{L}_{center} \tag{8}\]  
where \(\mathcal{L}\) represents the final loss function of the network, \(\mathcal{L}_{s}\) stands for softmax loss, and \(\lambda\) is used to adjust the weighting between the two. However, the center loss is primarily focused on adjusting the distances between samples of the same class to bring them closer together, without considering the distances between different classes. In this paper, using a prototype network to address FSRE, SACT aims for not only the reduction in intra-class distances but also to enhance inter-class distances, making the feature distributions between classes more discriminative. Merely shifting feature vectors toward class centroids proves inadequate for this task. Therefore, SACT combines the advantages of contrastive loss and center loss to propose a new loss function, the contrastive-center loss function, as shown in Figure 6. Specifically, the training samples are compared with their corresponding class centers and non-corresponding class centers, penalizing the contrast between them. This encourages intra-class compactness while promoting inter-class separability, as shown in Equation (9):  
\[\mathcal{L}_{ct-center}=\frac{1}{2}\sum_{i=1}^{m}\frac{\left\lVert s_{i}-c_{y _{i}}\right\rVert_{2}^{2}}{\left(\sum_{j=1,j\
eq y_{i}}^{k}\left\lVert s_{i}-c_ {y_{i}}\right\rVert_{2}^{2}\right)+\delta} \tag{9}\]  
where \(\mathcal{L}_{ct-center}\) represents the contrastive-center loss function, and m denotes the amounts of samples in a mini-batch.