## 2 Materials and Methods
### Feature Extraction by the Backbone Network  
The Siamese Network [31] is a sample learning method based on similarity measurement that has achieved significant success in various fields such as scene recognition and audio processing. This network has a simple structure, making it easy to train, and consists of two identical backbone networks as sub-networks. The network takes two image sequences as input and outputs a pair of similar images based on a similarity-detection method applied to features extracted by the backbone network. The network architecture is illustrated in Figure 2.  
Here, \(X_{1}\) and \(X_{2}\) are the input parameters of the network, \(G_{w}(X)\) represents two identical convolutional neural networks, i.e., sub-networks, where \(W\) denotes the shared network weights across the two sub-networks and \(E_{w}\) is the similarity score of the outputs from the two networks. This network is a feedforward network. In image similarity detection, each input consists of two different images and a label. The label is encoded in binary form, where a label of 0 indicates that the two images are dissimilar, and a label of 1 indicates that the two images are similar. The input images undergo feature extraction by convolutional neural networks, and the extracted features are flattened to output feature vectors. The distance between these two feature vectors is then calculated and fed into the loss function. The shared network weights are optimized through the loss function. Throughout this process, the features of the two images are mapped to a new subspace where positive samples are close to each other and negative samples are far apart, completing the optimal matching. Figure 1: Overall framework of the approach proposed in this paper. For image-classification tasks, the number of neurons in the output layer of a neural network is typically equal to the number of categories. However, in the research presented in this paper, only similarity detection is required, and classification is not considered. The fully connected layer can be directly input into the loss function for similarity calculation. Generally, Euclidean distance or cosine distance is used, and there is no restriction on the dimensions of the output from the fully connected layer. Therefore, there are many choices for the backbone network of the Siamese neural network in this project, including classical models like VGG16, AlexNet, GoogleLeNet, ResNet, Inception-v4, etc. [PERSON], [PERSON] et al. [32] conducted Top1 accuracy tests on some commonly used CNN network models using practical applications, and the test results are shown in Figure 3.  
From the graph, it can be observed that, compared to various CNN model architectures, ResNet-34, ResNet-101, and ResNet-152 outperform some earlier networks. This improvement occurred because the early CNN models improved performance by simply increasing the width and depth of the network, with the VGG in Figure 3 designed based on the AlexNet using this approach. However, merely increasing the number of layers in the network does not necessarily lead to better performance for CNNs. Once the number of layers in the network reaches a certain quantity, the network's performance tends to saturate. Further increasing the number of layers at this point can lead to issues like gradient explosion and degradation, thereby reducing the model's performance. This phenomenon is not caused by overfitting, but rather is due to the increase in computational cost and parameter requirements as the number of network layers grows, making the model challenging to train. By contrast, deeper networks can capture more information from images, resulting in relatively richer features. Especially in complex dynamic environments, the  
Figure 3: Top1 accuracy comparison of CNNs. Figure 2: Siamese Network Architecture. network should differentiate between different scenes as much as possible and recognize the same scene when it contains moving objects and occlusions.