# Improved DeepSORT Algorithm Based on Multi-Feature Fusion
## 3 Generalized Intersection over Union (GIOU)  
In general, the IOU distance can well reflect the distance relationship between the projection box (hereinafter referred to as the prediction box) and the detection box in the detection space. The IOU value is always greater than 0, and its value will not change with the scaling of the prediction frame and detection frame. However, when there is no overlap between the detection box and the prediction box, the IOU is constant at 0, so the IOU distance cannot be used to judge the match between the detection box and the prediction box, as shown in Figure 3.  
From Figure 3, when the red detection frame does not coincide with the green track prediction frame, the IOU values of Figure 3a,b are 0, so it is impossible to judge the difference in matching degree between them, which very easily causes false matching. It can also appear that the IOU value between the trajectory prediction box and the detection box is the same, but there are different overlap positions. As shown in Figure 4,  
Figure 3: No coincident position relationship between detection frame and prediction frame. (**a**) The detection frame is close to the prediction frame. (**b**) The detection frame is far from the prediction frame. Figure 2: Structural diagram of residual module. it is also impossible to judge the matching degree between the detection frame and the prediction frame from the IOU distance. Figure 4a,b have the same IOU value, but the overlapping positions of detection frame and prediction frame in the two groups of figures are different. To overcome this problem, position information is added to the distance measurement to judge how the detection frame and prediction frame intersect. Through the GIOU distance, the minimum bounding box of the detection frame and prediction frame is introduced to solve the spatial position relationship between the two frames. The calculation process is shown in Equation (7). \[\text{GIOU}=\text{IOU}-\frac{C-A\cup B}{C} \tag{7}\]  
where \(C\) is the minimum frame area used to surround the detection frame and prediction frame, \(A\) is the area of the target trajectory prediction frame, and \(B\) is the area of the pedestrian detection frame. The spatial representation of GIOU is shown in Figure 5.  
From Figure 5, we know that \(C-A\cup B\) is the red area in the graph. When the location relationship between the detection box and the prediction is different, the area of the red area changes accordingly. By using the ratio of the red area to the minimum bounding box, the location information between the detection box and the prediction box is indirectly added to the distance matrix. Simple rearrangement of Equation (7) obtains:  
\[\text{GIOU}=\text{IOU}-1+\frac{A\cup B}{C} \tag{8}\]  
It can be seen from Equation (8) that when IOU is 0, that is, there is no intersection between the detection frame and the prediction frame, the value is fixed. The larger \(C\), that is, the farther the distance between the detection frame and the prediction frame, the smaller the GIOU and the larger the corresponding GIOU distance, indicating that the matching degree between the two is not high, and vice versa. Figure 4: Coincident position relationship between detection frame and prediction frame. (**a**) Horizontal overlap. (**b**) Cross overlap. Figure 5: Spatial representation of GIOU. When the IOU is 0, the IOU distance measurement cannot easily judge the matching relationship between the detection frame and the prediction frame. In this case, when using the GIOU distance for measurement, matching between the detection frame and the prediction frame is shown in Figure 6.  
As can be seen from Figure 6, in figures a and b, when using the GIOU measurement, the purple minimum bounding box is introduced to surround the detection and prediction. It solved the problem of the IOU distance measurement being unable to judge the matching degree between the detection frame and the prediction frame when there is no coincidence between them.