## 2 Materials and Methods
### Feature Extraction by the Backbone Network
ResNet [33] is a convolutional neural network with a residual structure proposed by [PERSON] and his colleagues from Microsoft Research and based on VGG19. The initial purpose of designing this network was to address the issues of gradient explosion and degradation caused by the continuous increase in the number of intermediate layers (convolutional layers, pooling layers, and subsampling layers) in traditional convolutional neural networks. The residual structure is inspired by shortcut connections in highway networks, introducing a \"skip connection\" to form a learning structure, as illustrated in Figure 4. The core idea is to stack new layers onto a shallow CNN, creating a deep CNN. For a newly added layer, assuming the input is x and the image features extracted based on \(x\) in the current layer are denoted as \(F(x)\), theoretically, the output of the features by this layer would be as follows:  
\[H(x)=F(x)+x \tag{1}\]  
Here, \(H(x)\) represents the output features and the residual corresponds to the difference between the input and output, i.e., \(F(x)\). Now consider an extreme case wherein the new layer has not learned any features. the residual should be zero in this scenario. Consequently, the layer would directly output the original features \(x\) through the skip connection, making the new layer essentially perform an \"identity mapping\" relative to the old layer. However, in practical situations, the residual is generally small but not directly zero. This feature makes training the residual easier by this method compared to training by traditional methods. For ResNet with different numbers of layers, the generally adopted residual modules consist of the two types of residual structures illustrated in Figure 4. The left-side residual module is utilized for shallow ResNet architectures such as ResNet18, ResNet34, and ResNet50. In contrast, the right-side residual module is employed for deeper ResNet architectures like ResNet101 and ResNet152, which take into consideration the dimensionality-reduction requirement. Given the remarkable performance of ResNet, this paper employs ResNet152 as the backbone sub-network for feature extraction, constructing a Siamese Network architecture. The network structure can be broadly categorized into the image input layer, pooling layer, convolutional layers, and feature output layer, as depicted in Figure 5.  
Figure 4: Residual learning structure. The dashed-line portion represents the intermediate convolutional layers, where the parameters denote the number of channels, width, and height for each output feature map. The input section consists of a convolutional layer with a kernel size of \(7\times 7\) and a stride of 2, followed by a pooling layer with a kernel size of \(3\times 3\) and a stride of 2, primarily for dimensionality reduction of the input image. The middle section comprises layers 1 to 4, where convolutional layers of the same color form a layer. Layer 1 consists of 3 residual modules; layer 2 has 4 residual modules; layer 3 contains 36 residual modules; and layer 4 includes 3 residual modules. Each residual module is composed of two convolutional layers with a size of \(1\times 1\) and a stride of 1 and one convolutional layer with a size of \(3\times 3\) and a stride of 1. The residual modules are interconnected through skip connections. Ultimately, given an input image of size \(224\times 224\) with 3 channels, layer 1 produces feature maps of size \(56\times 56\). The output size decreases by half in each subsequent layer, resulting in a final feature-map size of \(7\times 7\times 2048\). As max-pooling layers significantly reduce the precision of image features, making it unsuitable for similarity detection in dynamic scenes with rich features, direct use of such large feature-map dimensions is computationally inefficient. Additionally, it contains many abstract invariant details, leading to interference from redundant information in dynamic environments during similarity detection.