# Person Re-Identification across Data Distributions Based on General Purpose DNN Object Detector
## 3 Theory Overview
### YOLO Model  
In this paper, we use the YOLOv3 model [10], which is the last version of the original YOLO detection system [8]. There was also implemented YOLOv2 [41], an improved algorithm based on a smaller CNN, with fewer convolutional layers. However, although this network, called Darknet-19, has few layers, the running time and computational costs are comparable to those of the Darknet-53 neural network. Furthermore, the accuracy of the detection increases when using the third YOLO model.  
The YOLO model is a general object detection system, which is more efficient and faster than the other existing methods. As the name suggests, a single network predicts both the location of objects and the probabilities directly from the original image, which makes it more suitable for applications for which real-time running represents a priority.  
It treats object recognition as a unified regression problem instead of R-CNN, which are learned in order to perform classification. Additionally, YOLO sees the entire image during the training phase, which leads to better background recognition.  
The YOLO model has several advantages when compared to other existing methods. Firstly, it is a faster system, since it treats the detection as a regression problem. Second, this model uses the entire input image when it performs final detection.  
Unlike other techniques that use regions of interest, YOLO uses the full image in both the training and testing stages. The network uses the features of the entire image in order to predict each bounding box. Furthermore, all of the bounding boxes corresponding to all classes are predicted at the same time.  
In Figure 3, the entire YOLO model is presented. The system divides the input image into \(S\times S\) cells. The cell that is responsible for detecting an object is the cell located in the center of that object. Further, each cell predicts B bounding boxes and confidence scores for each bounding box. These scores reflect the system's certainty that a bounding box contains an object and how accurate the prediction is.  
For each predicted bounding box, the system generates five values:  
* (x, y), which represent the coordinates of the center of the bounding box;
* (w, h), which represent the dimensions: the weight, and respectively, the height of the bounding box; and,
* the prediction's confidence, representing the Intersection Over Union (IOU) ratio between the predicted and the real bounding box.  
Each cell also predicts C conditional probabilities, \(Pr(Class_{i}|Object)\), which depend on an object's existence in that cell. The number of probabilities is the same as the number of classes. Only one set of  
Figure 3: The You Only Look Once (YOLO) [8] model.  
such probabilities will be predicted, regardless of the number of existing framing rectangles. In the testing phase, it will obtain:  
\[Pr(Class_{i}|Object)\cdot Pr(Object)\cdot IOU_{pred}^{real}=Pr(Class_{i})\cdot IOU_{ pred}^{real} \tag{5}\]  
Equation (5) defines the confidence that represents the product between the probability of an object's existence and the IOU size (calculated for the predicted and the real rectangle). If there is no object, then the confidence value is 0. This represents both the probability that a particular class of objects exists in the predicted framing rectangle and the accuracy with which it frames an object.  
In the end, an image will contain \(S\times S\times B\) bounding boxes. Each bounding box corresponds to four predictions of the location, one confidence score, and \(C\) conditional probabilities, where \(C\) represents the number of classes. This leads to an amount of  
\[N=S\cdot S\cdot(5\cdot B+C) \tag{6}\]  
predicted values for a single image.