# Person Re-Identification across Data Distributions Based on General Purpose DNN Object Detector
## 5 Experimental Results
### Testing Algorithm  
In order to test the performance of the proposed method and be able to monitor the evolution of this system, it was necessary to design a test environment. At the end of each training stage, it is necessary to test the networks and the weights that were obtained to identify the best variants. The testing stage involves passing each image from the test database through the CNN, thus obtaining the feature vectors. The ultimate goal is to compare each feature vector with all of the other vectors that belong to the previous images, and finally associate people based on the similarity between the vectors. For running such a system, storing a remarkably large number of feature vectors is necessary. The number of vectors is equivalent to the number of occurrences of all persons in the test database. There are millions of such occurrences in a real scenario, which leads to much-needed storage space. \begin{table}
\begin{tabular}{l l} \hline \hline
**Type of Triplets** & **Algorithm** \\ \hline Hard negative & **Initialization**: \\  & Set network parameters: \\  & \(net\_batch=64,net\_outputs=128,margin=0.2,triplets=HARD\) \\  & For \(i=1,2,\cdots,\) number of batches: \\  & For \(j=1,2,\cdots,\) number of negative samples: \\  & Compute \(D(A_{i},N_{j})\) based on (28) and (26) \\  & Find for \(A_{i}\) the most similar negative sample \(N_{j}\) using (22) \\  & Compute \(D(A_{i},P)\) based on (28) and (26) \\  & Compute the triplet loss \(L_{i}=L(A_{i},P_{i},N_{j})\) using (20) \\  & Compute the cost function based on (25) \\ \hline Semi-hard negatives & **Initialization**: \\  & Set network parameters: \\  & \(net\_batch=64,net\_outputs=128,margin=0.2,triplets=SEMIHARD\) \\  & For \(i=1,2,\cdots,\) number of batches: \\  & Compute \(D(A_{i},P)\) based on (28) and (26) \\  & For \(j=1,2,\cdots,\) number of negative samples \\  & Compute \(D(A_{i},N_{j})\) based on (28) and (26) \\  & Choose all the triplets that correspond to (24) \\  & Compute the number of semi-hard negative triplets for \(A_{i}\) \\  & For \(k=1,2,\cdots,number\_semi-hardriplets\) \\  & Compute the triplet loss \(L_{k}=L(A_{i},P,N_{k})\) according to (20) \\  & Compute the partial cost function \(C_{i}\) based on (25) \\  & Compute the cost function by summing all the partial functions. \\ \hline Moderate Positives & **Initialization**: \\  & Set network parameters: \\  & \(net\_batch=64,net\_outputs=128,margin=0.2,net\_samples=100,triplets=MODERATE\) \\  & For \(i=1,2,\cdots,\) number of batches: \\  & For \(j=1,2,\cdots,\) number of negative samples: \\  & Compute \(D(A_{i},N_{j})\) based on (28) and (26) \\  & Find for \(A_{i}\) the most similar negative sample \(N_{j}\) using (22) \\  & For \(k=1,2,\cdots,\) number of positive samples: \\  & Compute \(D(A_{i},P_{k})\) based on (28) and (26) \\  & Find for \(A_{i}\) the most different positive sample \(P_{k}\) using (23) \\  & Check if the first part of the condition from (24) is fulfilled for \(D(A_{i},P_{k})\) and \(D(A_{i},N_{j})\) \\  & If the condition is met, compute the triplet loss \(L_{i}=L(A_{i},P_{k},N_{j})\) using (20) \\  & Compute the cost function based on (25) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Types of triplets implemented in our proposed method. It was necessary to store the features vectors in a database for operating the system on a wide range of real-life scenarios. The feature vectors are generated once a neural network receives an image at the input. These are then stored in the database. Finally, the vector with the most significant similarity is sought in order to achieve the association. In order to test the re-identification method, storing five parameters in the database for each occurrence was required:  
* **ID. ** This column is generated automatically and also incrementally. It represents a sequence of unique and consecutive numbers, being present in any database. * **LABEL. ** This value is, in fact, an Universally Unique Identifiers (UUID). It is a 128 bits identifier, which consists of a total of 32 hexadecimal digits.