# FSN: Feature Shift Network for Load-Domain (LD) Domain Generalization
## 3 Feature Shift Networks
### Relational Classifiers  
Recent studies have indicated that contrastive-based classification methods slightly outperform traditional fully connected classification methods [25; 26; 27]. This paper introduces a novel relational classifier to further enhance domain generalization networks by  
Figure 3: An example of the label and domain feature space. Stars and circles in the same domain represent different classes of fault.  
leveraging the relational structure among data points. Specifically, we employ a neural network as a distance metric to facilitate the learning of more generalized features, thereby enhancing generalization performance.  
Relational classifiers are a subset of contrast-based classification methods, extensively utilized in self-supervised learning. In the domain of unsupervised learning for computer vision, contrast-based methods consistently outperform alternative approaches. Furthermore, recent research has shown that contrast-based methods also confer significant advantages in supervised learning. Notably, contrast learning exhibits lower sensitivity to hyperparameters compared to cross-entropy-based classification approaches, allowing for improved performance with less intensive fine-tuning. Figure 4 provides a graphic illustration of a contrast-based classification method. The contrastive approach involves passing an image through a feature extractor to obtain its feature map, which is then used for the test image. Next, a distance metric measures the distance between the test image's feature map and those of other images. The test image is assigned to the class whose feature map is most similar to its own.  
**Design Idea.** The contrast-based classification method classifies images by utilizing the distances between feature maps and selecting the minimum distance as the classification criterion. Previous approaches typically utilized fixed-distance metrics, such as Euclidean or cosine similarity distances for distance calculations. However, the efficacy of traditional feature map distance metrics cannot be considered entirely reliable. Since feature map distances do not always conform to traditional distance measures, we propose a new relational module that integrates an effective few-shot learning metric into the domain generalization framework. This approach ensures more accurate distance measurements. Figure 5 illustrates the distance and loss calculations performed by the relational module.  
The relationship network replaces traditional measures with neural networks to compute the distance between feature maps. Similar to conventional methods, it takes two feature maps and outputs a relationship score, which reflects if the feature maps come from images of the same classification. A score of 1 implies the images belong to the same class, whereas a score of 0 suggests they are from different classes. The network is trained by minimizing the loss function, which measures the difference between the predicted relationship score and the actual score (1 or 0). The gradient of this loss is then back-propagated through the network, updating both the relationship network and the feature extraction layers.  
Figure 4: Relational classifier.  
To implement the relationship network, the two feature maps are concatenated and fed into the neural network to produce a relationship score. To classify a new feature map, the relationship score must be computed between this feature map and the feature maps representing each class. This approach allows the network to determine the closest match. We refer to this type of network, which integrates relationship modules and employs comparison-based classification, as a relationship classifier.