# A Two-Stage Semi-Supervised High Maneuvering Target Trajectory Data Classification Algorithm
## 2 Problem Analysis
It was first proposed in the field of signature verification in reference [12]. It is widely used in face verification, text recognition, and other fields [13]. Its basic structure is shown in Figure 2. A pair of samples are input into two neural networks with the same structure and shared weights, and the paired label data are used for training. The loss function is called the contrastive loss and is calculated as follows [12]:  
\[\mathrm{L}(W,Y,X_{1},X_{2})=(1-Y)\frac{1}{2}(D_{W})^{2}+(Y)\frac{1}{2}[\max(0, m-D_{W})]\ ^{2} \tag{3}\]  
In the formula, \(W\) is the network weight, and \(Y\) is the pairwise label. If the pair of samples \(X_{1}\) and \(X_{2}\) belongs to the same class, \(Y=0\) otherwise \(Y=1\). \(D_{W}\) is the Euclidean distance between \(X_{1}\) and \(X_{2}\) features. When \(Y=0\), the model minimizes \(D_{W}\). When \(Y=1\), if \(D_{W}\) is greater than \(m\), do not optimize; if \(D_{W}\) is less than \(m\), increase the distance between the two to \(m\). Therefore, in the feature domain, the distance between similar positive sample pairs is narrowed, and the distance between negative sample pairs is widened, which can effectively measure the network of similarity between samples. Figure 2: Siamese network structure. Siamese neural networks can effectively utilize labeled data. The input in the Siamese neural network is a pair of samples, so the training samples can be expanded by the combination of samples. Assuming that there are \(n\) trajectory samples, \(C_{n}^{2}\) sets of training samples can be formed, which greatly increases the number of trainings and uses a small amount of label data to achieve better training results. The basic Siamese network model can be trained with labeled data but cannot fully utilize the information of a large number of unlabeled samples in the dataset. Therefore, this study referred to the idea of pre-training and model transfer, used unlabeled data to train the commonly used autoencoder clustering model, and combined the model with a Siamese network. This processing could reduce the difficulty of model training and the degree of dependence on labeled data while laying a solid foundation for further processing of missing categories. For the problem of missing categories, the key was to deal with unlabeled categories, which was essentially a clustering problem. This required the algorithm to have the ability to cluster unlabeled categories while having the ability to classify labeled categories. This was also one of the reasons why this study chose the structure of the Siamese neural network because the Siamese network can not only use the conventional distance calculation and threshold design method for trajectory classification but also can obtain the distance matrix of the samples through the similarity measure for trajectory clustering. Thus, the classification algorithm was transformed into clustering to ensure the basic processing ability of the algorithm for unmarked categories. This study further combined the Siamese network and the clustering network to design a two-stage model training algorithm to improve the clustering ability of the basic Siamese network model. The first stage trained the commonly used autoencoder clustering model to ensure the model's processing ability for unlabeled categories. The second stage used the trained clustering model to form a Siamese neural network and used the label data for fine-tuning to further improve the classification performance of the model. However, under the condition of missing categories, relying too much on the guidance of the labeled dataset can lead to overfitting, making the model only able to classify the labeled categories. Therefore, in the second stage, this study used joint training to simultaneously train the supervised and the unsupervised parts of the model. This ensured that the model training process used label data to guide feature extraction without excessive dependence on label data.