yolov4-deepsort
yolov4-deepsort copied to clipboard
How to save the detection and tracking result in a file?
Hi.
I can see the tracking results on screen by using the --info argument. How can I save them in a text file (the IDs and coordinates of detected boxes)?
hey did u know how to solve above? struggling for this?
I do in that way
1º - I create a variable to get the output of that command
2º - export that in a txt file using the function
Go to inside object_tracker.py and try to get values from that part ->
# draw bbox on screen
color = colors[int(track.track_id) % len(colors)]
color = [i * 255 for i in color]
cv2.rectangle(frame, (int(bbox[0]), int(bbox[1])), (int(bbox[2]), int(bbox[3])), color, 2)
cv2.rectangle(frame, (int(bbox[0]), int(bbox[1]-30)), (int(bbox[0])+(len(class_name)+len(str(track.track_id)))*17, int(bbox[1])), color, -1)
cv2.putText(frame, class_name + "-" + str(track.track_id),(int(bbox[0]), int(bbox[1]-10)),0, 0.75, (255,255,255),2)
You could store these values as well. See below please.
print("frame_num:",frame_num, "person id:" + str(track.track_id), "bbox:" ,bbox )
Output: frame_num: 48 person id:1 bbox: [433.99727797 243.87391317 993.38272104 629.23692898] frame_num: 48 person id:2 bbox: [190.61178465 202.11683543 513.15014026 626.55630477] ......