## 3 Preliminary
### Generic Approach and Issues  
In the last few years, few-shot learning technology, for example, the Siamese neural network (SNN), which uses only a few training samples to get better predictions has emerged. An SNN contains two identical subnetworks (usually convolutional neural networks)--hence the name 'Siamese'. The two CNNs have the same configuration, with the same weights, \(\mathbf{W}\in\mathbf{R}^{d}\), where \(\mathbf{W}\) depicts the model's parameters, while \(\mathbf{R}^{d}\) depicts the distance embedding to calculate two samples inputted from each subnetwork, respectively, and the value of the distance indicates whether they are closed to each other, as the value increases or decreases in the Euclidean space. The updating of the hyperparameters is mirrored across both CNNs, and is used to find the similarity of the inputs, by comparing its feature vectors. Each parallel CNN is designed to produce an embedding (i.e., a reduced dimensional representation) of the input. These embeddings can then be used to optimize a loss function during the training phase and to generate a similarity score during the testing phase. The architecture of Spiking Neural Networks (SNNs) contrasts significantly with traditional neural networks, which rely on extensive datasets to learn the prediction of multiple classes. The latter's requirement for total retraining and updating with each addition or removal of a class presents a challenge. SNNs instead learn through a similarity function, testing whether two images are identical. This innovative architecture empowers them to classify new data classes without the need for additional network training. Furthermore, SNNs demonstrate greater robustness against class imbalance, as a small number of images per class is enough to enable future recognition. The corresponding notations are listed as Table 1.  
Figure 3: Function Splitting. Figure 4 illustrates the working of a generic SNN, its goal being to determine if two image samples belong to the same class or not: this is achieved through the use of two parallel CNNs (CNN1 and CNN2 in Figure 4) trained on the two image samples (Image 1 and Image 2 in Figure 4). Each image is fed through one branch of the SNN, which generates a d-dimensional feature embedding (\(h_{1}\) and \(h_{2}\) in Figure 4) for the image: it is these feature embeddings that are used to optimize a loss function, rather than the images themselves. A supervised cross-entropy function is used in the SNN for the binary classification, to determine whether two images are similar or dissimilar, by computing \([h_{2}-h_{1}]\) and processing it by a sigmoid function. Mathematically, the similarity between a pair of images \((x_{1},x_{2})\) within Euclidean distance (ED) is computed in an SNN using the following equation:  
\[\mathbf{d_{w}}(\mathbf{x_{1}},\mathbf{x_{2}})=\|F_{w}(\mathbf{x_{1}})-F_{w}( \mathbf{x_{2}})\|_{2}, \tag{1}\]  
where the \(F_{w}\) indicates the feature representation for the inputted feature matrix. Generally, the model \(g_{w}\): \(\mathbf{R}^{n}\) to \(\mathbf{R}^{d}\) is parameterized by the weights \(\mathbf{w}\), and its loss function is calculated using the following equation:  
\[L_{b}=-\frac{1}{N}\sum_{i=1}^{N}[\mathbf{y_{d}^{i}}f_{p}(\mathbf{d_{w}^{i}})+( 1-\mathbf{y_{d}^{i}})f_{q}(\mathbf{d_{w}^{i}})], \tag{2}\]  
where \(\mathbf{y_{d}}=\{\mathbf{y_{d}^{1}},\mathbf{y_{d}^{2}},\dots,\mathbf{y_{d}^{i} }\}\in\{0,1\}\) denotes the ground truth label of image pairs \((\mathbf{x_{i}},\mathbf{x_{i}})\), and \(d_{w}\) represents the Euclidean distance (ED) between two images at the \(i\)-th pair. Note that the most similar images are supposed to be the closest in the feature embedding