nwojke / deep_sort

Simple Online Realtime Tracking with a Deep Association Metric
GNU General Public License v3.0
5.3k stars 1.48k forks source link

Implement DeepSort in existing script (frame-by-frame) #252

Closed Christoph9402 closed 3 years ago

Christoph9402 commented 3 years ago

Hello, I want to implement DeepSort in my project. At the moment, my code has the following structure:

#import libaries

#load yolov5 model

#load video
cap = cv2.VideoCapture(file)
while(True):
    #extract every frame from video
    ret, frame = cap.read()

    #get detections from yolov5
    yolo_results = model_yolo(image, size=1024)

    #DeepSort should be called here

    ###############
       #other operations
    ###############

So basicly, I want to track persons in a video. I am iterating through each frame and use a yolov5 to get the detection. I am able to draw boudning boxes around the persons. Since i want to gain information about the trajectory, I need an object tracker, which is able to give an ID to every person, even if they are occluded for 1 or 2 frames. Because I later want to test my code also on webcam streams and since i have a few other operations for each frame (like undistort), I dont want to load a video as a whole, but frame-by-frame. I don't want to call DeepSort from the console, but for every frame in the video from within my script. How do I have to modify the files? Is there an easier way to apply tracking for my case? Any help is appreciated :)

Yung-Chih-Lo commented 1 year ago

Hello, I have the same question. Could you please let me know how to do in this case? Thanks a lot!