Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support DanceTrack dataset for MOT #543

Merged
merged 10 commits into from
May 12, 2022

Conversation

noahcao
Copy link
Contributor

@noahcao noahcao commented May 3, 2022

  1. add dataset support for DanceTrack.
  2. add data conversion tool from DanceTrack label to COCO format.
  3. add an example config file by QDtrack on DanceTrack.
  4. the implementation is verified by going through the training and evaluation pipelines.
  5. edit corresponding documents, English and Chinese.

@OceanPang OceanPang requested a review from GT9505 May 3, 2022 15:29
@@ -0,0 +1,130 @@
_base_ = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#
# This file is adapted from the data label conversion file for MOT
# But as Dancetrack does not provide public detections and provides
# official train/val/test splitting, we make necessary adaptation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Dancetrack dataset share a similar structure of annotations with MOT challenge dataset?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. They have the same label format.

return outputs


def parse_dets(dets):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this function since it is not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted in the new commit.



@DATASETS.register_module()
class DanceTrackDataset(CocoVideoDataset):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please inherit from MOTChanllengeDataset, if they share a similar structure of annotations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made this change.

Comment on lines 1 to 4
_base_ = [
'../../_base_/models/faster_rcnn_r50_fpn.py',
'../../_base_/datasets/dancetrack.py', '../../_base_/default_runtime.py'
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.



@DATASETS.register_module()
class DanceTrackDataset(MOTChallengeDataset):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the duplicated codes since we have already inherited from MOTChallengeDataset.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in the new commit.

@codecov
Copy link

codecov bot commented May 5, 2022

Codecov Report

Merging #543 (d17cc17) into master (88f92dd) will increase coverage by 0.15%.
The diff coverage is 76.92%.

❗ Current head d17cc17 differs from pull request most recent head 04e9b38. Consider uploading reports for the commit 04e9b38 to get more accurate results

@@            Coverage Diff             @@
##           master     #543      +/-   ##
==========================================
+ Coverage   73.08%   73.24%   +0.15%     
==========================================
  Files         129      130       +1     
  Lines        8019     8074      +55     
  Branches     1562     1564       +2     
==========================================
+ Hits         5861     5914      +53     
- Misses       1664     1668       +4     
+ Partials      494      492       -2     
Flag Coverage Δ
unittests 73.18% <76.92%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmtrack/datasets/mot_challenge_dataset.py 73.93% <66.66%> (+0.22%) ⬆️
mmtrack/datasets/dancetrack_dataset.py 83.33% <83.33%> (ø)
mmtrack/datasets/__init__.py 100.00% <100.00%> (ø)
mmtrack/datasets/pipelines/transforms.py 87.61% <0.00%> (-1.15%) ⬇️
mmtrack/models/track_heads/siamese_rpn_head.py 93.15% <0.00%> (+0.10%) ⬆️
mmtrack/models/reid/linear_reid_head.py 89.85% <0.00%> (+0.14%) ⬆️
...track/models/trackers/quasi_dense_embed_tracker.py 75.71% <0.00%> (+0.17%) ⬆️
mmtrack/datasets/youtube_vis_dataset.py 77.23% <0.00%> (+0.18%) ⬆️
mmtrack/models/track_heads/roi_track_head.py 87.93% <0.00%> (+0.21%) ⬆️
mmtrack/models/track_heads/roi_embed_head.py 85.34% <0.00%> (+0.25%) ⬆️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 88f92dd...04e9b38. Read the comment docs.

@noahcao noahcao requested a review from GT9505 May 6, 2022 01:52
@noahcao noahcao mentioned this pull request May 6, 2022
Comment on lines 52 to 54
BENCHMARK='DanceTrack',
# Option Values: 'train', 'val', 'test'
SPLIT_TO_EVAL='val',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only differences are BENCHMARK and SPLIT_TO_EVAL.
We can override the get_benchmark() in MOTChanllengeDataset to return both DanceTrack and val in order to reuse most codes as far as possiable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure your intention, because in this function from mot_challenge_dataset.py, there is also an operation by

if 'half-train' in self.ann_file:
    dataset_config[
        'GT_LOC_FORMAT'] = '{gt_folder}/{seq}/gt/gt_half-train.txt'
elif 'half-val' in self.ann_file:
    dataset_config[
        'GT_LOC_FORMAT'] = '{gt_folder}/{seq}/gt/gt_half-val.txt'

I have made BENCHMARK returned by an override get_benchmark() in DanceTrackDataset in the new commit.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I create a commit to show the intention.
The if and elif will be skipped, since dancetrack only have train and val split

return parser.parse_args()


def parse_gts(gts, is_mot15):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove is_mot15 for dancetrack dataset

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 1 to 4
_base_ = [
'../../_base_/models/faster_rcnn_r50_fpn.py',
'../../_base_/datasets/dancetrack.py', '../../_base_/default_runtime.py'
]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@noahcao noahcao requested a review from GT9505 May 9, 2022 05:28
Comment on lines 3 to 22
type='QDTrack',
detector=dict(
backbone=dict(
norm_cfg=dict(requires_grad=False),
style='caffe',
init_cfg=dict(
type='Pretrained', checkpoint='torchvision://resnet50')),
rpn_head=dict(bbox_coder=dict(clip_border=False)),
roi_head=dict(
bbox_head=dict(
loss_bbox=dict(type='L1Loss', loss_weight=1.0),
bbox_coder=dict(clip_border=False),
num_classes=1)),
init_cfg=dict(
type='Pretrained',
checkpoint= # noqa: E251
'https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco-person/faster_rcnn_r50_fpn_1x_coco-person_20201216_175929-d022e227.pth' # noqa: E501
)),
track_head=dict(
type='QuasiDenseTrackHead',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After using base config of ./qdtrack_faster-rcnn_r50_fpn_4e_crowdhuman_mot17-private-half.py, some duplicated keys can be removedd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that it was a fault to set ./qdtrack_faster-rcnn_r50_fpn_4e_crowdhuman_mot17-private-half.py as a base because it is based on '../../_base_/datasets/mot_challenge.py' while the dancetrack qdtrack config shoule be based on '../../_base_/datasets/dancetrack.py'. I think the right way should be creating a new config based on:

_base_ = [
    '../../_base_/models/faster_rcnn_r50_fpn.py',
    '../../_base_/datasets/dancetrack.py', '../../_base_/default_runtime.py'
]

Given the rule that different base config files should have no key conflict, the dancetrack qdtrack config file should inherit no config file using '../../_base_/datasets/mot_challenge.py'. To be precise, if it inherits '../../_base_/datasets/dancetrack.py' and ./qdtrack_faster-rcnn_r50_fpn_4e_mot17-private-half.py' at the same time, it raises error

KeyError: "Duplicate key is not allowed among bases. Duplicate keys: {'data_root', 'train_pipeline', 'img_norm_cfg', 'test_pipeline', 'data', 'dataset_type'}"

Comment on lines 52 to 54
BENCHMARK='DanceTrack',
# Option Values: 'train', 'val', 'test'
SPLIT_TO_EVAL='val',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I create a commit to show the intention.
The if and elif will be skipped, since dancetrack only have train and val split

Copy link
Contributor Author

@noahcao noahcao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the code. MOT17 config file is verified with given checkpoint to achieve the same HOTA scores.

I refactored the config files to disentangle the config for dataset and the config of model.

@GT9505 GT9505 merged commit 4e11840 into open-mmlab:master May 12, 2022
@noahcao noahcao mentioned this pull request May 12, 2022
GT9505 added a commit that referenced this pull request Jul 19, 2022
* fix format

* support dancetrack dataset

* delete unused function; inherit dancetrack dataset class from MOTChallenge

* remove duplicated content in DancetrackDataset

* remove legacy code

* refactor DanceTrackDataset class

* fix error in dancetrack qdtrack config file

* refactor qdtrack config files.

* Update dancetrack_dataset.py

Co-authored-by: Tao Gong <gt950513@mail.ustc.edu.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants