tracklab icon indicating copy to clipboard operation
tracklab copied to clipboard

Utility to allow export of tracking results into standard MOT format

Open Ellenisawake opened this issue 5 months ago • 5 comments

Hi there, thanks for building this tracking library which is very helpful for kickstarting a new tracking project. I wonder if you plan to include a utility in the repo to allow export ingof tracking results into standard MOT format, rather than the tracker_state pickle only? I did not see that anywhere in the repo now and think that will help a lot for horizontal benchmarking of many other trackers not included in this repo. Thanks!

Image

Ellenisawake avatar Aug 07 '25 14:08 Ellenisawake

Hi @Ellenisawake , if you enable evaluation with standard MOT metrics, you should have the tracking results exported as .txt somewhere in the output directory. Can you have a look and let me know if this works for you? However I agree that having an external .py script explicitly for that could be helpful (taking a trackerstate as input). This should be fairly easy/fast to vibe code, feel free to open a PR if you have time to do it :)

VlSomers avatar Aug 07 '25 21:08 VlSomers

Hi @Ellenisawake , if you enable evaluation with standard MOT metrics, you should have the tracking results exported as .txt somewhere in the output directory. Can you have a look and let me know if this works for you? However I agree that having an external .py script explicitly for that could be helpful (taking a trackerstate as input). This should be fairly easy/fast to vibe code, feel free to open a PR if you have time to do it :)

Thanks @VlSomers for your quick reply! I did find a txt file in the output directory, which somehow was missed earlier😅. A further question about the format of the saved results. They all seem to start from the second frame, without a record of IDs for the first frame. Is this intentional?

Ellenisawake avatar Aug 08 '25 14:08 Ellenisawake

@Ellenisawake, do you mean the indexing of the frame starts at 1 and not 0? To be verified, but if I remember correctly, this is how MOTChallenge file are formatted, i.e. indexing starting at 1 (although we use indexing starting at 0 internally in Tracklab). Let me know if this seems right for you

VlSomers avatar Aug 18 '25 20:08 VlSomers

@Ellenisawake, do you mean the indexing of the frame starts at 1 and not 0? To be verified, but if I remember correctly, this is how MOTChallenge file are formatted, i.e. indexing starting at 1 (although we use indexing starting at 0 internally in Tracklab). Let me know if this seems right for you

Hi @VlSomers , thank you for your clarification! To give a little context, I am trying to apply tracklab onto a custom dataset, where I have ground truth prepared following the exact MOT format (frame and ID indexing starting at 1). What I observe when running the code is that, the conversion between TrackerState data structure and MOT format is not functioning properly. For example, as in the screenshot of a saved TrackerState below, image_id does not correspond to actual frame numbers in the sequence (it is accumulating across sequences). And track_id only starts from the second frame in the sequence. Same in the converted exported MOT style txt results, frame always starts at 2. I wonder if I did something wrong? Thank you again for your answers!

Image

Ellenisawake avatar Aug 20 '25 09:08 Ellenisawake

This is probably this line causing the issue. When you created you custom dataset, did you make the image_ids and frame count start at 0? Did you subclass MOT class? Can you make sure if (1) your detections are off by one frame (i.e. they should be linked to one frame before) or if (2) detections are linked to the correct frame, but you just don't have detections returned for the first frame? If this is case (1), then this is a bug, if this is case (2), then it might come from the (online) tracker that is configured to only return tracklets that are at least one detection old. Could you share you tracker config? This is often parameterized with the "min_hits", that is often set to 1. We would need to dig into the implementation of these trackers to understand exactly the behavior of min_hits=1, but maybe min_hits should be set to 0 to allow detections being returned on the first frame. Let me know if you manage to find a fix with all this information :)

VlSomers avatar Aug 21 '25 19:08 VlSomers