GeekAlexis / FastMOT

High-performance multiple object tracking based on YOLO, Deep SORT, and KLT 🚀
MIT License
1.12k stars 256 forks source link

Bug for multi-class tracking #245

Closed wingvortex closed 2 years ago

wingvortex commented 2 years ago

Current Behavior

In my case, I have 2 classes to track. The feature_extractor_cfgs in the json is set as you mentioned: "feature_extractor_cfgs": [ { "model": "OSNet025", "batch_size": 16 }, { "model": "OSNet025", "batch_size": 16 } ] The codes run OK without any warning. However, sometimes the length of embeddings is longer than that of detections. This problem can be reproduced by printing the variable shape: print(self.frame_count, len(cls_bboxes), detections.shape, embeddings.shape) Snipaste_2022-01-20_15-28-43

The reason is as following: there are 2 extractors but the number of cls_bboxes can be 0, 1, 2: cls_bboxes= np.split(detections.tlbr, find_split_indices(detections.label)) So, these two for loops will not extract the feature for the corresponding bbox: for extractor, bboxes in zip(self.extractors, cls_bboxes): ... for extractor in self.extractors:

Your Environment

Ubuntu 18.04 Not used docker image

GeekAlexis commented 2 years ago

ok but why are the embeddings longer?

wingvortex commented 2 years ago

When the length of cls_bboxes is 1 (detect only 1 class), but the length of extractors is always 2, the feature extractor would append more embeddings than detections. I did not go into depth about why the extractor length varies when this happens.

GeekAlexis commented 2 years ago

I have pushed some fixes on the branch multi-class-fix. I currently don't have an environment to test this. Can you run again on that branch and let me know if any issue persists?

wingvortex commented 2 years ago

Hi Alexis, after merging your new pushes, it seems this bug is fixed: image

Just to remind you that due to your modifications, numba should also be imported in mot.py, and the 'find_split_indices' in detector.py need to fix as well if you remove this function. Thanks for your excellent work!

GeekAlexis commented 2 years ago

Thanks, they should be fixed.