-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Support DanceTrack dataset for MOT (#543)
* 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>
- Loading branch information
Showing
10 changed files
with
450 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# dataset settings | ||
dataset_type = 'DanceTrackDataset' | ||
img_norm_cfg = dict( | ||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) | ||
train_pipeline = [ | ||
dict(type='LoadMultiImagesFromFile', to_float32=True), | ||
dict(type='SeqLoadAnnotations', with_bbox=True, with_track=True), | ||
dict( | ||
type='SeqResize', | ||
img_scale=(1088, 1088), | ||
share_params=True, | ||
ratio_range=(0.8, 1.2), | ||
keep_ratio=True, | ||
bbox_clip_border=False), | ||
dict(type='SeqPhotoMetricDistortion', share_params=True), | ||
dict( | ||
type='SeqRandomCrop', | ||
share_params=False, | ||
crop_size=(1088, 1088), | ||
bbox_clip_border=False), | ||
dict(type='SeqRandomFlip', share_params=True, flip_ratio=0.5), | ||
dict(type='SeqNormalize', **img_norm_cfg), | ||
dict(type='SeqPad', size_divisor=32), | ||
dict(type='MatchInstances', skip_nomatch=True), | ||
dict( | ||
type='VideoCollect', | ||
keys=[ | ||
'img', 'gt_bboxes', 'gt_labels', 'gt_match_indices', | ||
'gt_instance_ids' | ||
]), | ||
dict(type='SeqDefaultFormatBundle', ref_prefix='ref') | ||
] | ||
test_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict( | ||
type='MultiScaleFlipAug', | ||
img_scale=(1088, 1088), | ||
flip=False, | ||
transforms=[ | ||
dict(type='Resize', keep_ratio=True), | ||
dict(type='RandomFlip'), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='Pad', size_divisor=32), | ||
dict(type='ImageToTensor', keys=['img']), | ||
dict(type='VideoCollect', keys=['img']) | ||
]) | ||
] | ||
data_root = 'data/dancetrack/' | ||
data = dict( | ||
samples_per_gpu=2, | ||
workers_per_gpu=2, | ||
train=dict( | ||
type=dataset_type, | ||
visibility_thr=-1, | ||
ann_file=data_root + 'annotations/train_cocoformat.json', | ||
img_prefix=data_root + 'train', | ||
ref_img_sampler=dict( | ||
num_ref_imgs=1, | ||
frame_range=10, | ||
filter_key_img=True, | ||
method='uniform'), | ||
pipeline=train_pipeline), | ||
val=dict( | ||
type=dataset_type, | ||
ann_file=data_root + 'annotations/val_cocoformat.json', | ||
img_prefix=data_root + 'val', | ||
ref_img_sampler=None, | ||
pipeline=test_pipeline), | ||
test=dict( | ||
type=dataset_type, | ||
ann_file=data_root + 'annotations/val_cocoformat.json', | ||
img_prefix=data_root + 'val', | ||
ref_img_sampler=None, | ||
pipeline=test_pipeline)) |
81 changes: 81 additions & 0 deletions
81
configs/mot/qdtrack/qdtrack_faster-rcnn_r50_fpn_4e_base.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
_base_ = [ | ||
'../../_base_/models/faster_rcnn_r50_fpn.py', | ||
'../../_base_/default_runtime.py' | ||
] | ||
model = dict( | ||
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', | ||
roi_extractor=dict( | ||
type='SingleRoIExtractor', | ||
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0), | ||
out_channels=256, | ||
featmap_strides=[4, 8, 16, 32]), | ||
embed_head=dict( | ||
type='QuasiDenseEmbedHead', | ||
num_convs=4, | ||
num_fcs=1, | ||
embed_channels=256, | ||
norm_cfg=dict(type='GN', num_groups=32), | ||
loss_track=dict(type='MultiPosCrossEntropyLoss', loss_weight=0.25), | ||
loss_track_aux=dict( | ||
type='L2Loss', | ||
neg_pos_ub=3, | ||
pos_margin=0, | ||
neg_margin=0.1, | ||
hard_mining=True, | ||
loss_weight=1.0)), | ||
loss_bbox=dict(type='L1Loss', loss_weight=1.0), | ||
train_cfg=dict( | ||
assigner=dict( | ||
type='MaxIoUAssigner', | ||
pos_iou_thr=0.7, | ||
neg_iou_thr=0.5, | ||
min_pos_iou=0.5, | ||
match_low_quality=False, | ||
ignore_iof_thr=-1), | ||
sampler=dict( | ||
type='CombinedSampler', | ||
num=256, | ||
pos_fraction=0.5, | ||
neg_pos_ub=3, | ||
add_gt_as_proposals=True, | ||
pos_sampler=dict(type='InstanceBalancedPosSampler'), | ||
neg_sampler=dict(type='RandomSampler')))), | ||
tracker=dict( | ||
type='QuasiDenseEmbedTracker', | ||
init_score_thr=0.9, | ||
obj_score_thr=0.5, | ||
match_score_thr=0.5, | ||
memo_tracklet_frames=30, | ||
memo_backdrop_frames=1, | ||
memo_momentum=0.8, | ||
nms_conf_thr=0.5, | ||
nms_backdrop_iou_thr=0.3, | ||
nms_class_iou_thr=0.7, | ||
with_cats=True, | ||
match_metric='bisoftmax')) | ||
# optimizer && learning policy | ||
optimizer_config = dict( | ||
_delete_=True, grad_clip=dict(max_norm=35, norm_type=2)) | ||
lr_config = dict(policy='step', step=[3]) | ||
# runtime settings | ||
total_epochs = 4 | ||
evaluation = dict(metric=['bbox', 'track'], interval=1) |
53 changes: 53 additions & 0 deletions
53
configs/mot/qdtrack/qdtrack_faster-rcnn_r50_fpn_4e_dancetrack.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
_base_ = [ | ||
'./qdtrack_faster-rcnn_r50_fpn_4e_base.py', | ||
'../../_base_/datasets/dancetrack.py', | ||
] | ||
img_norm_cfg = dict( | ||
mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False) | ||
train_pipeline = [ | ||
dict(type='LoadMultiImagesFromFile', to_float32=True), | ||
dict(type='SeqLoadAnnotations', with_bbox=True, with_track=True), | ||
dict( | ||
type='SeqResize', | ||
img_scale=(1088, 1088), | ||
share_params=True, | ||
ratio_range=(0.8, 1.2), | ||
keep_ratio=True, | ||
bbox_clip_border=False), | ||
dict(type='SeqPhotoMetricDistortion', share_params=True), | ||
dict( | ||
type='SeqRandomCrop', | ||
share_params=False, | ||
crop_size=(1088, 1088), | ||
bbox_clip_border=False), | ||
dict(type='SeqRandomFlip', share_params=True, flip_ratio=0.5), | ||
dict(type='SeqNormalize', **img_norm_cfg), | ||
dict(type='SeqPad', size_divisor=32), | ||
dict(type='MatchInstances', skip_nomatch=True), | ||
dict( | ||
type='VideoCollect', | ||
keys=[ | ||
'img', 'gt_bboxes', 'gt_labels', 'gt_match_indices', | ||
'gt_instance_ids' | ||
]), | ||
dict(type='SeqDefaultFormatBundle', ref_prefix='ref') | ||
] | ||
test_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict( | ||
type='MultiScaleFlipAug', | ||
img_scale=(1088, 1088), | ||
flip=False, | ||
transforms=[ | ||
dict(type='Resize', keep_ratio=True), | ||
dict(type='RandomFlip'), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='Pad', size_divisor=32), | ||
dict(type='ImageToTensor', keys=['img']), | ||
dict(type='VideoCollect', keys=['img']) | ||
]) | ||
] | ||
data = dict( | ||
train=dict(pipeline=train_pipeline), | ||
val=dict(pipeline=test_pipeline), | ||
test=dict(pipeline=test_pipeline)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.