# model settings model = dict( type='SOLOv2', backbone=dict( type='MobileNetV2', #num_stages=4, #out_indices=(0, 1, 2, 3), # C2, C3, C4, C5 out_indices=(1,2,4,7), frozen_stages=1, #style='pytorch' init_cfg=dict(type='Pretrained', #checkpoint='torchvision://mobilenet_v2' checkpoint='mobilenet_v2-b0353104.pth' ), ), neck=dict( type='FPN', in_channels=[24,32,64,320], #[24,32,96,1280] out_channels=8, start_level=0, num_outs=5), mask_head=dict( type='SOLOV2Head', num_classes=1,#80 in_channels=8, feat_channels=32,# can not modify stacked_convs=4, strides=[8, 8, 16, 32, 32], scale_ranges=((1, 56), (28, 112), (56, 224), (112, 448), (224, 896)), pos_scale=0.2, num_grids=[40, 36, 24, 16, 12], cls_down_index=0, mask_feature_head=dict( feat_channels=8, start_level=0, end_level=3, out_channels=8, mask_stride=4, norm_cfg=dict(type='GN', num_groups=8, requires_grad=True)),#32,16 loss_mask=dict(type='DiceLoss', use_sigmoid=True, loss_weight=3.0), loss_cls=dict( type='FocalLoss', use_sigmoid=True, gamma=2.0, alpha=0.25, loss_weight=1.0)), test_cfg=dict( nms_pre=500, score_thr=0.1, mask_thr=0.5, filter_thr=0.05, kernel='gaussian', sigma=2.0, max_per_img=100)) data = dict( samples_per_gpu=6, workers_per_gpu=6, train=dict( type='CocoDataset', ann_file='/dataset/coco/annotations/instances_train2017.json', img_prefix='/dataset/coco/train2017/images', pipeline=[ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True, with_mask=True), dict( type='Resize', img_scale=[(768, 512), (768, 480), (768, 448), (768, 416), (768, 384), (768, 352)], multiscale_mode='value', keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict( type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']) ]), val=dict( type='CocoDataset', ann_file='/dataset/coco/annotations/instances_val2017.json', img_prefix='/dataset/coco/val2017/images', pipeline=[ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(768, 448), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ]) ]), test=dict( type='CocoDataset', ann_file = '/data/person_data/model_test_portrait_1.json', img_prefix='/', pipeline=[ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(768, 448), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Normalize', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ]) ])) evaluation = dict(metric=['bbox', 'segm']) optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) lr_config = dict( policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.3333333333333333, step=[20, 25, 31] #[27, 33] ) runner = dict(type='EpochBasedRunner', max_epochs=36) checkpoint_config = dict(interval=1) log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')]) custom_hooks = [dict(type='NumClassCheckHook')] dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] opencv_num_threads = 0 mp_start_method = 'fork' auto_scale_lr = dict(enable=False, base_batch_size=16) find_unused_parameters = True temp = 0.5 alpha_fgd = 0.001 beta_fgd = 0.0005 gamma_fgd = 0.0005 lambda_fgd = 5e-06 distiller = dict( type='DetectionDistiller', teacher_pretrained='work_dirs/solov2_r101_3x_c8/epoch_36.pth', init_student=True, distill_cfg=[ dict( student_module='neck.fpn_convs.3.conv', teacher_module='neck.fpn_convs.3.conv', output_hook=True, methods=[ dict( type='FeatureLoss', name='loss_fgd_fpn_3', student_channels=8,# 256 teacher_channels=8,# 256 temp=0.5, alpha_fgd=0.001, beta_fgd=0.0005, gamma_fgd=0.0005, lambda_fgd=5e-06) ]), dict( student_module='neck.fpn_convs.2.conv', teacher_module='neck.fpn_convs.2.conv', output_hook=True, methods=[ dict( type='FeatureLoss', name='loss_fgd_fpn_2', student_channels=8, teacher_channels=8, temp=0.5, alpha_fgd=0.001, beta_fgd=0.0005, gamma_fgd=0.0005, lambda_fgd=5e-06) ]), dict( student_module='neck.fpn_convs.1.conv', teacher_module='neck.fpn_convs.1.conv', output_hook=True, methods=[ dict( type='FeatureLoss', name='loss_fgd_fpn_1', student_channels=8, teacher_channels=8, temp=0.5, alpha_fgd=0.001, beta_fgd=0.0005, gamma_fgd=0.0005, lambda_fgd=5e-06) ]), dict( student_module='neck.fpn_convs.0.conv', teacher_module='neck.fpn_convs.0.conv', output_hook=True, methods=[ dict( type='FeatureLoss', name='loss_fgd_fpn_0', student_channels=8, teacher_channels=8, temp=0.5, alpha_fgd=0.001, beta_fgd=0.0005, gamma_fgd=0.0005, lambda_fgd=5e-06) ]) ]) student_cfg = 'configs/solov2/solov2_mobileNetV2_3x_c8.py' teacher_cfg = 'configs/solov2/solov2_r101_3x_c8.py' work_dir = './work_dirs/fgd_solov2_r101_c8_3x_ms_distill_solov2_mobileNetV2_c8_3x' auto_resume = False gpu_ids = [0]