|
| 1 | +_base_ = [ |
| 2 | + '../_base_/models/retinanet_r50_fpn.py', |
| 3 | + '../_base_/datasets/coco_detection.py', '../_base_/default_runtime.py' |
| 4 | +] |
| 5 | + |
| 6 | +cudnn_benchmark = True |
| 7 | +norm_cfg = dict(type='BN', requires_grad=True) |
| 8 | +checkpoint = 'https://download.openmmlab.com/mmclassification/v0/efficientnet/efficientnet-b3_3rdparty_8xb32-aa_in1k_20220119-5b4887a0.pth' # noqa |
| 9 | +model = dict( |
| 10 | + backbone=dict( |
| 11 | + _delete_=True, |
| 12 | + type='EfficientNet', |
| 13 | + arch='b3', |
| 14 | + drop_path_rate=0.2, |
| 15 | + out_indices=(3, 4, 5), |
| 16 | + frozen_stages=0, |
| 17 | + norm_cfg=dict( |
| 18 | + type='SyncBN', requires_grad=True, eps=1e-3, momentum=0.01), |
| 19 | + norm_eval=False, |
| 20 | + init_cfg=dict( |
| 21 | + type='Pretrained', prefix='backbone', checkpoint=checkpoint)), |
| 22 | + neck=dict( |
| 23 | + in_channels=[48, 136, 384], |
| 24 | + start_level=0, |
| 25 | + out_channels=256, |
| 26 | + relu_before_extra_convs=True, |
| 27 | + no_norm_on_lateral=True, |
| 28 | + norm_cfg=norm_cfg), |
| 29 | + bbox_head=dict(type='RetinaSepBNHead', num_ins=5, norm_cfg=norm_cfg), |
| 30 | + # training and testing settings |
| 31 | + train_cfg=dict(assigner=dict(neg_iou_thr=0.5))) |
| 32 | + |
| 33 | +# dataset settings |
| 34 | +img_norm_cfg = dict( |
| 35 | + mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) |
| 36 | +img_size = (896, 896) |
| 37 | +train_pipeline = [ |
| 38 | + dict(type='LoadImageFromFile'), |
| 39 | + dict(type='LoadAnnotations', with_bbox=True), |
| 40 | + dict( |
| 41 | + type='Resize', |
| 42 | + img_scale=img_size, |
| 43 | + ratio_range=(0.8, 1.2), |
| 44 | + keep_ratio=True), |
| 45 | + dict(type='RandomCrop', crop_size=img_size), |
| 46 | + dict(type='RandomFlip', flip_ratio=0.5), |
| 47 | + dict(type='Normalize', **img_norm_cfg), |
| 48 | + dict(type='Pad', size=img_size), |
| 49 | + dict(type='DefaultFormatBundle'), |
| 50 | + dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']), |
| 51 | +] |
| 52 | +test_pipeline = [ |
| 53 | + dict(type='LoadImageFromFile'), |
| 54 | + dict( |
| 55 | + type='MultiScaleFlipAug', |
| 56 | + img_scale=img_size, |
| 57 | + flip=False, |
| 58 | + transforms=[ |
| 59 | + dict(type='Resize', keep_ratio=True), |
| 60 | + dict(type='RandomFlip'), |
| 61 | + dict(type='Normalize', **img_norm_cfg), |
| 62 | + dict(type='Pad', size=img_size), |
| 63 | + dict(type='ImageToTensor', keys=['img']), |
| 64 | + dict(type='Collect', keys=['img']), |
| 65 | + ]) |
| 66 | +] |
| 67 | +data = dict( |
| 68 | + samples_per_gpu=4, |
| 69 | + workers_per_gpu=4, |
| 70 | + train=dict(pipeline=train_pipeline), |
| 71 | + val=dict(pipeline=test_pipeline), |
| 72 | + test=dict(pipeline=test_pipeline)) |
| 73 | +# optimizer |
| 74 | +optimizer_config = dict(grad_clip=None) |
| 75 | +optimizer = dict( |
| 76 | + type='SGD', |
| 77 | + lr=0.04, |
| 78 | + momentum=0.9, |
| 79 | + weight_decay=0.0001, |
| 80 | + paramwise_cfg=dict(norm_decay_mult=0, bypass_duplicate=True)) |
| 81 | +# learning policy |
| 82 | +lr_config = dict( |
| 83 | + policy='step', |
| 84 | + warmup='linear', |
| 85 | + warmup_iters=1000, |
| 86 | + warmup_ratio=0.1, |
| 87 | + step=[8, 11]) |
| 88 | +# runtime settings |
| 89 | +runner = dict(type='EpochBasedRunner', max_epochs=12) |
| 90 | + |
| 91 | +# NOTE: This variable is for automatically scaling LR, |
| 92 | +# USER SHOULD NOT CHANGE THIS VALUE. |
| 93 | +default_batch_size = 32 # (8 GPUs) x (4 samples per GPU) |
0 commit comments