dyhBUPT / StrongSORT

[TMM 2023] StrongSORT: Make DeepSORT Great Again
GNU General Public License v3.0
708 stars 75 forks source link

How can I run StrongSORT? #109

Closed muzeyen closed 2 months ago

muzeyen commented 2 months ago

Hello,

Firstly, I'd like to mention that I'm new to this field. I have detection outputs available in YOLO format (class_id, x_center, y_center, width, height, score).

Sample output:

0 0.594773 0.461965 0.015011 0.054480 0.700088
1 0.793613 0.333716 0.036314 0.059458 0.699628
0 0.555700 0.476097 0.018082 0.057162 0.691458

The model is trained for 2 classes, which are car and person (0: person, 1: car). I am keeping these outputs saved in a text format for each frame.

Example:

frame1.txt:

1 0.389167 0.492589 0.017673 0.055427 0.902361
1 0.386367 0.556187 0.017999 0.050398 0.887952
0 0.619419 0.451399 0.005005 0.020172 0.783564
0 0.619611 0.362791 0.004976 0.020598 0.780921
0 0.641307 0.438536 0.005326 0.021110 0.761468
0 0.671163 0.406890 0.003832 0.017728 0.722523

frame2.txt:

1 0.390083 0.492836 0.018349 0.056039 0.903922
1 0.387359 0.556595 0.017886 0.051039 0.879527
0 0.620228 0.452183 0.004804 0.019686 0.781162
0 0.620895 0.363769 0.005006 0.021039 0.777495
0 0.642103 0.439860 0.005204 0.019594 0.748338
0 0.672116 0.407967 0.003948 0.018063 0.743279

To run StrongSORT using these outputs, if I understand correctly, I should first obtain a file in the MOT format. However, this format doesn't have a specific field for class_id in the format you mentioned, "frame_id, -1, x, y, w, h, score, -1, -1, -1". How should I produce an output in case of multiple classes and multiple detections? Should the -1 after frame_id represent the class_id? Which Python scripts should I use in what order to prepare my detection outputs for use in StrongSORT? Should I have which files when I want to run StrongSORT?

I apologize for the simplicity of my question. I would be grateful if you could explain the steps in this regard. Thank you in advance.

Regards.

dyhBUPT commented 2 months ago

Hi, thanks for your interest in our work.

The simplest way to realize the multi-class tracking is to tracking each class seperately. That is, you just need to prepare the MOT format files for each class, and no major code changes are required. Optionally, you can store the class id to replace the -1 after the score, and modify the codes to reject association between different classes.

For further questions about preparing detection files, maybe this file can help you: https://github.com/dyhBUPT/StrongSORT/blob/master/others/AuxiliaryTutorial.md

muzeyen commented 2 months ago

Thank you for your response. In the first suggestion, you mentioned producing output in a separate mot format for each class. What should these outputs be like? For example, I have a sequence and should I produce two separate txts for this sequence (sequence01), sequence01_person_mot.txt and sequence01_car_mot.txt?

dyhBUPT commented 2 months ago

Yes, you can try it.