5. deep sort target tracking

Deep sort code path

As in the previous section, we can see the file path of our Deep sort from the figure below.

iShot_2024-06-15_18.20.08

The following project directory code class diagram

deep_sort

We start the demo program. The target tracking startup file is the yolov8_track.py program. We enter the command in the terminal:

Then the interface pops up as shown below.

iShot_2024-06-17_17.56.16

The demo program started above uses yolov8 as the target detection model, and then uses deep sort for target tracking. We can see that each target label will have an ID for the target. If the target is always within the detection range, the ID will remain unchanged.

Code Analysis

Code running flow chart:

Yes
No
Yes
Yes
No
No
start
Load YOLOv8 model
Open video file
Is the video file open?
Read a frame of the video
Program ends
Judge whether the frame is read successfully?
Run YOLOv8 tracking
Visualize the results on the frame
Show the annotated frame.
Judge whether the 'q' key is pressed?
Break out of the loop
Release the video capture object
Close the display window

Code: