## 3 Proposed Vehicle Detection and Tracking Scheme
### Deep SORT Algorithm for Vehicle Tracking
The Kalman filter algorithm (Algorithm 1) provides an effective framework for vehicle detection and tracking by combining prediction and measurement updates to accurately estimate the state of vehicles over time. Here, M denotes the state vector representing the target, which includes the target position (\(m_{x},m_{y}\)), aspect ratio \(a\), and height \(h\). \(m_{x},m_{y},a,h\) denote the initial values of the target position, aspect ratio, and height obtained from YOLO's detected matrix, respectively. M \([m^{\prime}_{x},m^{\prime}_{y},a^{\prime},h^{\prime}]\) is initially set to \([0,0,0,0]\). \(x\) denotes the track mean value at time t \(-\) 1; F denotes the state transmission matrix; T denotes the noise matrix; d denotes the current frame and previous frame difference in F; L denotes the covariance matrix; Mean represents the target position of the bounding box coordinates (\(m_{x},m_{y}\)); and the covariance represents the uncertainty of the target position. ```
Input: A bounding box on YOLO's detected matrix along with aspect ratio and height of the bounding box Output: Current frame prediction based on previous position of the target
1. initialization:
2. M \(\leftarrow\) (\(m_{x},m_{y}\), \(a,h\), \(m^{\prime}_{x},m^{\prime}_{y},a^{\prime},h^{\prime}\) )
3. \(m_{x},m_{y}\leftarrow\) target position of the bounding box
4. \(a\leftarrow\) aspect ratio
5. \(h\leftarrow\) height of the bounding box
6. \(M\left[m^{\prime}_{x},m^{\prime}_{y},a^{\prime},h^{\prime}\right]\leftarrow[0,0,0,0]\)
7. \(x\leftarrow\) track mean value at time t \(-\) 1
8. \(F\leftarrow\) state transmission matrix
9. \(T\leftarrow\) noise matrix
10. \(d\leftarrow\) current frame and previous frame difference in F
11. \(L\leftarrow\) covariance matrix
12. Mean \(\leftarrow\) target position of the bounding box coordinates (\(m_{x},m_{y}\))
13. Covariance \(\leftarrow\) uncertainty of the target position
14. begin:
15. Compute initial mean and variance through Kalman filter before building a new track. 16. Predict the target position of the track at time t \(-\) 1 and compute \(x^{\prime}\) = F(x)
17. \(m^{\prime}_{x}=m_{x}+dm^{\prime}_{x}\)
18. \(m^{\prime}_{y}=m_{y}+dm^{\prime}_{y}\), where new position=original position + displacement, displacement = time \(\times\) speed. 19. Calculate updated covariance matrix at time t \(L^{\prime}=FLF^{\prime}+T\)
20. Compute gate_function_matrix A = [\(m_{x},m_{y}\)]
21. Compute gate_function_matrix B = [\(c_{m},m_{y}\)]
22. Kalman filter update using Equations (1)-(5). 23. end
```  
**Algorithm 1**Kalman filter algorithm for vehicle detection-tracking. The assignment problem, which involves matching the predicted trajectories with detected vehicles, is often addressed using the Hungarian algorithm (Algorithm 2), which is also referred to as the Munkres algorithm. This includes the task of matching unmatched detections to existing tracked objects. The objective is to identify possible associations between the unmatched detections and the existing tracked objects based on a cost or similarity metric. The Hungarian algorithm ensures that each detection is assigned to the most suitable existing tracked object based on the cost or similarity metric. By iteratively updating the assignment matrix, the algorithm finds the optimal assignments that minimize the total cost or dissimilarity.