megvii-research / MOTRv2

[CVPR2023] MOTRv2: Bootstrapping End-to-End Multi-Object Tracking by Pretrained Object Detectors
Other
383 stars 47 forks source link

Questions on generate det_db_motrv2.json #74

Open yaoshanliang opened 3 months ago

yaoshanliang commented 3 months ago

I am training on custom dataset using https://github.com/zyayoung/ByteTrackInference to generate the det_db_motrv2.json file.

However, there are empty keys when there is no results for a frame, showing

File "/datasets/dance.py", line 188, in _pre_single_frame
    for line in self.det_db[txt_key]:
KeyError: 'DanceTrack/train/53/img1/00000032.txt

I checked the source code in ByteTrackInference/yolox/evaluators/mot_evaluator.py

# run tracking
            for i, output_results in enumerate(outputs):
                img_path = self.dataloader.dataset.img_list[ids[i].item()]
                if output_results is None:
                    with open(img_path[:-4] + '.txt', 'w') as f:
                        pass
                    continue

               ..........

               # save results
                save_format = '{x1:.1f},{y1:.1f},{w:.1f},{h:.1f},{s:.2f},{c:d}'
                for tlwh, s, c in zip(bboxes, scores, classes):
                    x1, y1, w, h = tlwh
                    line = save_format.format(x1=x1, y1=y1, w=w, h=h, s=s, c=c)
                    det_db[img_path[:-4] + '.txt'].append(line)

There are empty txt files generated in the img folder, then and the json file does not contain the key. Thus, the should be no key for the empty results, and will cause the error when training.

Could you please specify how to solve the problem?

backyardknights commented 1 week ago

Sorry to bother you, I encountered the same issue as you when implementing the custom dataset. I would like to know if you now know how to modify the output format in ByteTrackInference/yolox/evaluators/mot_evaluator.py?