# Person Re-Identification Based on Attention Mechanism and Context Information Fusion
## 3 Experiment  
### Datasets and Evaluation Metrics  
Our experiments are performed on two popular person ReID datasets: Market1501 [29] and DukeMTMC-reID [30]. The partition of the dataset is shown in Table 1. The brief introductions to the datasets are shown below:  
Market1501 is a pedestrian dataset collected at Tsinghua University. Five HD cameras and one ordinary camera captured 1501 pedestrians, and 32,668 detected pedestrian bounding boxes. The picture size is 128 \(\times\) 56. Among them, there are 751 types of pedestrians in the training set, which contains 12,936 images, that is, an average of 17 pictures per pedestrian; the testing set has 750 types of pedestrians, including 19,732 pictures, that is, an average of 26 pictures per person. In this experiment, we randomly select an image from each type of pedestrian images in the training set, that is, 751 images of 751 types of  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Dataset** & **\# Image** & **\# ID** & **\# Train** & **\# Validation** & **\# Test** \\ \hline Market1501 & 32,688 & 1501 & 751 & 751 & 750 \\ DukeMTMC-reID & 36,411 & 1404 & 702 & 702 & 702 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Details of the datasets used in our experiments.  
pedestrians as a validation set. The remaining 12,185 images in the training set are used as training our model, and the images in the testing set are used to test our model.  
DukeMTMC-reID is a pedestrian dataset collected at Duke University in the United States. The pictures are taken by 8 non-overlapping cameras, and the pedestrian frame is manually marked. The training set includes 16,522 pictures, and the testing set includes 17,661 pictures. The training set and the test set include 702 types of pedestrians respectively. In this experiment, we randomly select an image from each type of pedestrian images in the training set, that is, 702 images of 702 types of pedestrians as a validation set. The remaining 15,820 images in the training set are used as training our model, and the testing set images are used to the test model.  
The metrics used in this paper to evaluate our model are mAP (Mean Average Precision) and Rank-n.  
\(mAP\) is the average value of average accuracy (\(AP\)), that is, the average value of each category of \(AP\). To calculate \(mAP\), the \(AP\) is calculated firstly, and \(AP\) is the area under the PR (Precision Recall) curve. The calculation formulas of precision and recall are as follows, where positive samples with correct predictions is represented as \(TP\), positive samples with incorrect predictions are represented as \(FP\), and \(FN\) is negative samples with incorrect predictions.  
\[precision=\frac{TP}{TP+FP}, \tag{10}\]  
\[recall=\frac{TP}{TP+FN}, \tag{11}\]  
\(AP\) is the ratio of the sum of all accuracy rates of the category to the number of images in the category, and the calculation formula is as follows (\(c_{i}\) is the number of categories \(i\)):  
\[AP=\frac{\sum precision}{C_{i}}, \tag{12}\]  
\(AP\) measures the effect of a single category, and \(mAP\) is used to evaluate all categories, as demonstrated in Formula (13), where \(N\) is the number of all categories:  
\[mAP=\frac{\sum_{i=1}^{N}AP_{i}}{N}, \tag{13}\]  
Another evaluation index Rank-n represents the probability that the first n query results are correct. For example, Rank-5 represents the probability that the first five images in the query result are correct.