## 4 Method
### Loss Function  
**Cross-Entropy Loss.** In this study, we employ the cross-entropy loss to quantify the discrepancy between predicted labels and ground truth labels. In practical applications, models often exhibit overconfidence when predicting that a sample belongs to a particular class for one-hot encoded labels. This overconfidence can lead to excessive sensitivity to noise in the training data, thereby impairing the model's generalization ability. Label smoothing can mitigate this issue by reducing the probability of the true labels from 1 to a value less than 1 and distributing the remaining probability evenly among other classes. This reduces the risk of overfitting and enhances the model's generalization capability. Suppose the actual label distribution for an image is denoted as \(y_{ij}\), and after label smoothing, the modified label distribution becomes the following:  
\[\widetilde{y}_{ij}=\left\{\begin{matrix}1-\epsilon+\frac{\epsilon}{K}&if\ i=y \\ \frac{\epsilon}{K}&if\ i\
eq y\end{matrix}\right. \tag{13}\]  
where \(K\) is the total number of pedestrians ID and \(\epsilon\) is a hyperparameter that controls label smoothing.  
Calculate the cross-entropy loss using the smoothed label distribution as follows:  
\[L_{ce}=-\sum_{i=1}^{N}\sum_{j=1}^{K}\widetilde{y}_{ij}^{\ \ }log(p_{ij}) \tag{14}\]  
where, \(N\) is the number of samples, \(\widetilde{y}_{ij}\) is the smoothed true label distribution, and \(p_{ij}\) is the probability that the \(i\)-th sample belongs to the \(j\)-th category.  
**Triplet Loss.** In our approach, we employ the hard triplet loss to assess the similarity between features. The formulation is as follows:  
\[L_{triplet}=\frac{1}{N}\sum_{i=1}^{N}\left[\left\|f(a_{i})-f(p_{i})\right\|_{2 }^{2}-\left\|f(a_{i})-f(n_{i})\right\|_{2}^{2}+m\right]_{+} \tag{15}\]  
where, \(a_{i}\), \(p_{i}\), \(n_{i}\) represent the \(i\)-th anchor sample, its corresponding positive sample, and negative samples, respectively. \(f(a_{i}),f(p_{i})\), \(f(n_{i})\) represent the feature vectors of the anchor, positive, and negative samples, respectively. \(\left\|f(a_{i})-f(p_{i})\right\|_{2}^{2}\) and \(\left\|f(a_{i})-f(n_{i})\right\|_{2}^{2}\) represent the distances between positive samples and the distances between negative samples, respectively. \(m\) is a non-negative hyperparameter that represents the minimum distance by which the distance between positive samples is expected to be smaller than the distance between negative samples, \(\left[\cdot\right]_{+}\) signifies the hinge function, which retains the original value when the value inside the parentheses is greater than 0; otherwise, it is set to 0. The optimization objective of the triplet loss is to minimize the difference between the two distances, i.e., \(\left\|f(a_{i})-f(p_{i})\right\|_{2}^{2}-\left\|f(a_{i})-f(n_{i})\right\|_{2}^ {2}\). In this way, the triplet loss encourages the positive samples to move closer to each other in the feature space while pushing the negative samples farther away, thus enhancing the discriminative power of the model [33].  
We combine the aforementioned losses to optimize the network parameters, and the final loss can be expressed as follows:  
\[L_{total}=\alpha\cdot L_{LS}+\beta\cdot L_{triplet} \tag{16}\]where \(\alpha\) and \(\beta\) are hyperparameters that control the loss balance.