|
| 1 | +_base_ = [ |
| 2 | + '../../_base_/models/tanet_r50.py', '../../_base_/default_runtime.py' |
| 3 | +] |
| 4 | + |
| 5 | +# dataset settings |
| 6 | +dataset_type = 'RawframeDataset' |
| 7 | +data_root = 'data/kinetics400/rawframes_train' |
| 8 | +data_root_val = 'data/kinetics400/rawframes_val' |
| 9 | +ann_file_train = 'data/kinetics400/kinetics400_train_list_rawframes.txt' |
| 10 | +ann_file_val = 'data/kinetics400/kinetics400_val_list_rawframes.txt' |
| 11 | +ann_file_test = 'data/kinetics400/kinetics400_val_list_rawframes.txt' |
| 12 | + |
| 13 | +img_norm_cfg = dict( |
| 14 | + mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_bgr=False) |
| 15 | + |
| 16 | +train_pipeline = [ |
| 17 | + dict(type='DenseSampleFrames', clip_len=1, frame_interval=1, num_clips=8), |
| 18 | + dict(type='RawFrameDecode'), |
| 19 | + dict(type='Resize', scale=(-1, 256)), |
| 20 | + dict( |
| 21 | + type='MultiScaleCrop', |
| 22 | + input_size=224, |
| 23 | + scales=(1, 0.875, 0.75, 0.66), |
| 24 | + random_crop=False, |
| 25 | + max_wh_scale_gap=1, |
| 26 | + num_fixed_crops=13), |
| 27 | + dict(type='Resize', scale=(224, 224), keep_ratio=False), |
| 28 | + dict(type='Flip', flip_ratio=0.5), |
| 29 | + dict(type='Normalize', **img_norm_cfg), |
| 30 | + dict(type='FormatShape', input_format='NCHW'), |
| 31 | + dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]), |
| 32 | + dict(type='ToTensor', keys=['imgs', 'label']) |
| 33 | +] |
| 34 | +val_pipeline = [ |
| 35 | + dict( |
| 36 | + type='DenseSampleFrames', |
| 37 | + clip_len=1, |
| 38 | + frame_interval=1, |
| 39 | + num_clips=8, |
| 40 | + test_mode=True), |
| 41 | + dict(type='RawFrameDecode'), |
| 42 | + dict(type='Resize', scale=(-1, 256)), |
| 43 | + dict(type='CenterCrop', crop_size=224), |
| 44 | + dict(type='Normalize', **img_norm_cfg), |
| 45 | + dict(type='FormatShape', input_format='NCHW'), |
| 46 | + dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]), |
| 47 | + dict(type='ToTensor', keys=['imgs']) |
| 48 | +] |
| 49 | +test_pipeline = [ |
| 50 | + dict( |
| 51 | + type='DenseSampleFrames', |
| 52 | + clip_len=1, |
| 53 | + frame_interval=1, |
| 54 | + num_clips=8, |
| 55 | + test_mode=True), |
| 56 | + dict(type='RawFrameDecode'), |
| 57 | + dict(type='Resize', scale=(-1, 256)), |
| 58 | + dict(type='ThreeCrop', crop_size=256), |
| 59 | + dict(type='Normalize', **img_norm_cfg), |
| 60 | + dict(type='FormatShape', input_format='NCHW'), |
| 61 | + dict(type='Collect', keys=['imgs', 'label'], meta_keys=[]), |
| 62 | + dict(type='ToTensor', keys=['imgs']) |
| 63 | +] |
| 64 | +data = dict( |
| 65 | + videos_per_gpu=8, |
| 66 | + workers_per_gpu=4, |
| 67 | + test_dataloader=dict(videos_per_gpu=2), |
| 68 | + train=dict( |
| 69 | + type=dataset_type, |
| 70 | + ann_file=ann_file_train, |
| 71 | + data_prefix=data_root, |
| 72 | + pipeline=train_pipeline), |
| 73 | + val=dict( |
| 74 | + type=dataset_type, |
| 75 | + ann_file=ann_file_val, |
| 76 | + data_prefix=data_root_val, |
| 77 | + pipeline=val_pipeline), |
| 78 | + test=dict( |
| 79 | + type=dataset_type, |
| 80 | + ann_file=ann_file_test, |
| 81 | + data_prefix=data_root_val, |
| 82 | + pipeline=test_pipeline)) |
| 83 | +evaluation = dict( |
| 84 | + interval=2, metrics=['top_k_accuracy', 'mean_class_accuracy']) |
| 85 | + |
| 86 | +# optimizer |
| 87 | +optimizer = dict( |
| 88 | + type='SGD', |
| 89 | + constructor='TSMOptimizerConstructor', |
| 90 | + paramwise_cfg=dict(fc_lr5=True), |
| 91 | + lr=0.01, # this lr is used for 8 gpus |
| 92 | + momentum=0.9, |
| 93 | + weight_decay=0.0001) |
| 94 | +optimizer_config = dict(grad_clip=dict(max_norm=20, norm_type=2)) |
| 95 | +# learning policy |
| 96 | +lr_config = dict(policy='step', step=[50, 75, 90]) |
| 97 | +total_epochs = 100 |
| 98 | + |
| 99 | +# runtime settings |
| 100 | +work_dir = './work_dirs/tanet_r50_dense_1x1x8_100e_kinetics400_rgb/' |
0 commit comments