-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Improvement] Set RandAugment as Imgaug default transforms. (#585)
* first commit for image randaugment * fix test * update changelog * use percentage params for TranslateX &S TranslateY * update tsm-r50 sthv1 config and result * delete blank line * fix config * add tsm-r50 flip + randaugment sthv1 * remove useless annotations * Update README.md * fix Co-authored-by: Jintao Lin <528557675@qq.com>
- Loading branch information
1 parent
70d0c7b
commit 8a79e52
Showing
7 changed files
with
242 additions
and
28 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
98 changes: 98 additions & 0 deletions
98
configs/recognition/tsm/tsm_r50_flip_randaugment_1x1x8_50e_sthv1_rgb.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,98 @@ | ||
_base_ = [ | ||
'../../_base_/models/tsm_r50.py', '../../_base_/schedules/sgd_tsm_50e.py', | ||
'../../_base_/default_runtime.py' | ||
] | ||
|
||
# model settings | ||
model = dict(cls_head=dict(num_classes=174)) | ||
|
||
# dataset settings | ||
dataset_type = 'RawframeDataset' | ||
data_root = 'data/sthv1/rawframes' | ||
data_root_val = 'data/sthv1/rawframes' | ||
ann_file_train = 'data/sthv1/sthv1_train_list_rawframes.txt' | ||
ann_file_val = 'data/sthv1/sthv1_val_list_rawframes.txt' | ||
ann_file_test = 'data/sthv1/sthv1_val_list_rawframes.txt' | ||
|
||
sthv1_flip_label_map = {2: 4, 4: 2, 30: 41, 41: 30, 52: 66, 66: 52} | ||
img_norm_cfg = dict( | ||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_bgr=False) | ||
|
||
train_pipeline = [ | ||
dict(type='SampleFrames', clip_len=1, frame_interval=1, num_clips=8), | ||
dict(type='RawFrameDecode'), | ||
dict(type='Resize', scale=(-1, 256)), | ||
dict( | ||
type='MultiScaleCrop', | ||
input_size=224, | ||
scales=(1, 0.875, 0.75, 0.66), | ||
random_crop=False, | ||
max_wh_scale_gap=1, | ||
num_fixed_crops=13), | ||
dict(type='Resize', scale=(224, 224), keep_ratio=False), | ||
dict(type='Flip', flip_ratio=0.5, flip_label_map=sthv1_flip_label_map), | ||
dict(type='Imgaug', transforms='default'), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='FormatShape', input_format='NCHW'), | ||
dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]), | ||
dict(type='ToTensor', keys=['imgs', 'label']) | ||
] | ||
val_pipeline = [ | ||
dict( | ||
type='SampleFrames', | ||
clip_len=1, | ||
frame_interval=1, | ||
num_clips=8, | ||
test_mode=True), | ||
dict(type='RawFrameDecode'), | ||
dict(type='Resize', scale=(-1, 256)), | ||
dict(type='CenterCrop', crop_size=224), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='FormatShape', input_format='NCHW'), | ||
dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]), | ||
dict(type='ToTensor', keys=['imgs']) | ||
] | ||
test_pipeline = [ | ||
dict( | ||
type='SampleFrames', | ||
clip_len=1, | ||
frame_interval=1, | ||
num_clips=8, | ||
test_mode=True), | ||
dict(type='RawFrameDecode'), | ||
dict(type='Resize', scale=(-1, 256)), | ||
dict(type='CenterCrop', crop_size=224), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='FormatShape', input_format='NCHW'), | ||
dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]), | ||
dict(type='ToTensor', keys=['imgs']) | ||
] | ||
data = dict( | ||
videos_per_gpu=8, | ||
workers_per_gpu=4, | ||
train=dict( | ||
type=dataset_type, | ||
ann_file=ann_file_train, | ||
data_prefix=data_root, | ||
filename_tmpl='{:05}.jpg', | ||
pipeline=train_pipeline), | ||
val=dict( | ||
type=dataset_type, | ||
ann_file=ann_file_val, | ||
data_prefix=data_root_val, | ||
filename_tmpl='{:05}.jpg', | ||
pipeline=val_pipeline), | ||
test=dict( | ||
type=dataset_type, | ||
ann_file=ann_file_test, | ||
data_prefix=data_root_val, | ||
filename_tmpl='{:05}.jpg', | ||
pipeline=test_pipeline)) | ||
evaluation = dict( | ||
interval=2, metrics=['top_k_accuracy', 'mean_class_accuracy']) | ||
|
||
# optimizer | ||
optimizer = dict(weight_decay=0.0005) | ||
|
||
# runtime settings | ||
work_dir = './work_dirs/tsm_r50_flip_randaugment_1x1x8_50e_sthv1_rgb/' |
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 |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
] | ||
|
||
# model settings | ||
# model settings# model settings | ||
model = dict( | ||
type='Recognizer2D', | ||
backbone=dict( | ||
|
94 changes: 94 additions & 0 deletions
94
configs/recognition/tsm/tsm_r50_randaugment_1x1x8_50e_sthv1_rgb.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,94 @@ | ||
_base_ = [ | ||
'../../_base_/models/tsm_r50.py', '../../_base_/schedules/sgd_tsm_50e.py', | ||
'../../_base_/default_runtime.py' | ||
] | ||
|
||
# model settings | ||
model = dict(cls_head=dict(num_classes=174)) | ||
|
||
# dataset settings | ||
dataset_type = 'RawframeDataset' | ||
data_root = 'data/sthv1/rawframes' | ||
data_root_val = 'data/sthv1/rawframes' | ||
ann_file_train = 'data/sthv1/sthv1_train_list_rawframes.txt' | ||
ann_file_val = 'data/sthv1/sthv1_val_list_rawframes.txt' | ||
ann_file_test = 'data/sthv1/sthv1_val_list_rawframes.txt' | ||
img_norm_cfg = dict( | ||
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_bgr=False) | ||
train_pipeline = [ | ||
dict(type='SampleFrames', clip_len=1, frame_interval=1, num_clips=8), | ||
dict(type='RawFrameDecode'), | ||
dict(type='Resize', scale=(-1, 256)), | ||
dict( | ||
type='MultiScaleCrop', | ||
input_size=224, | ||
scales=(1, 0.875, 0.75, 0.66), | ||
random_crop=False, | ||
max_wh_scale_gap=1, | ||
num_fixed_crops=13), | ||
dict(type='Resize', scale=(224, 224), keep_ratio=False), | ||
dict(type='Imgaug', transforms='default'), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='FormatShape', input_format='NCHW'), | ||
dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]), | ||
dict(type='ToTensor', keys=['imgs', 'label']) | ||
] | ||
val_pipeline = [ | ||
dict( | ||
type='SampleFrames', | ||
clip_len=1, | ||
frame_interval=1, | ||
num_clips=8, | ||
test_mode=True), | ||
dict(type='RawFrameDecode'), | ||
dict(type='Resize', scale=(-1, 256)), | ||
dict(type='CenterCrop', crop_size=224), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='FormatShape', input_format='NCHW'), | ||
dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]), | ||
dict(type='ToTensor', keys=['imgs']) | ||
] | ||
test_pipeline = [ | ||
dict( | ||
type='SampleFrames', | ||
clip_len=1, | ||
frame_interval=1, | ||
num_clips=8, | ||
test_mode=True), | ||
dict(type='RawFrameDecode'), | ||
dict(type='Resize', scale=(-1, 256)), | ||
dict(type='CenterCrop', crop_size=224), | ||
dict(type='Normalize', **img_norm_cfg), | ||
dict(type='FormatShape', input_format='NCHW'), | ||
dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]), | ||
dict(type='ToTensor', keys=['imgs']) | ||
] | ||
data = dict( | ||
videos_per_gpu=8, | ||
workers_per_gpu=4, | ||
train=dict( | ||
type=dataset_type, | ||
ann_file=ann_file_train, | ||
data_prefix=data_root, | ||
filename_tmpl='{:05}.jpg', | ||
pipeline=train_pipeline), | ||
val=dict( | ||
type=dataset_type, | ||
ann_file=ann_file_val, | ||
data_prefix=data_root_val, | ||
filename_tmpl='{:05}.jpg', | ||
pipeline=val_pipeline), | ||
test=dict( | ||
type=dataset_type, | ||
ann_file=ann_file_test, | ||
data_prefix=data_root_val, | ||
filename_tmpl='{:05}.jpg', | ||
pipeline=test_pipeline)) | ||
evaluation = dict( | ||
interval=2, metrics=['top_k_accuracy', 'mean_class_accuracy']) | ||
|
||
# optimizer | ||
optimizer = dict(weight_decay=0.0005) | ||
|
||
# runtime settings | ||
work_dir = './work_dirs/tsm_r50_randaugment_1x1x8_50e_sthv1_rgb/' |
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
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