_base_ = [
'../../_base_/datasets/voc0712.py',
'../../_base_/default_runtime.py'
]
# model settings
find_unused_parameters=True
temp=1.0
alpha_cwd = 10.0
distiller = dict(
type='DetectionDistiller',
teacher_pretrained = 'https://download.openmmlab.com/mmdetection/v2.0/pascal_voc/retinanet_r50_fpn_1x_voc0712/retinanet_r50_fpn_1x_voc0712_20200617-47cbdd0e.pth',
init_student = False,
distill_cfg = [dict(student_module = 'neck.fpn_convs.3.conv',
teacher_module = 'neck.fpn_convs.3.conv',
output_hook = True,
methods=[dict(type='ChannelWiseDivergence',
name='loss_cwd_fpn_3',
student_channels = 256,
teacher_channels = 256,
temp = temp,
alpha=alpha_cwd,
)
]
),
dict(student_module = 'neck.fpn_convs.2.conv',
teacher_module = 'neck.fpn_convs.2.conv',
output_hook = True,
methods=[dict(type='ChannelWiseDivergence',
name='loss_cwd_fpn_2',
student_channels = 256,
teacher_channels = 256,
temp = temp,
alpha=alpha_cwd,
)
]
),
dict(student_module = 'neck.fpn_convs.1.conv',
teacher_module = 'neck.fpn_convs.1.conv',
output_hook = True,
methods=[dict(type='ChannelWiseDivergence',
name='loss_cwd_fpn_1',
student_channels = 256,
teacher_channels = 256,
temp = temp,
alpha=alpha_cwd,
)
]
),
dict(student_module = 'neck.fpn_convs.0.conv',
teacher_module = 'neck.fpn_convs.0.conv',
output_hook = True,
methods=[dict(type='ChannelWiseDivergence',
name='loss_cwd_fpn_0',
student_channels = 256,
teacher_channels = 256,
temp = temp,
alpha=alpha_cwd,
)
]
),
]
)
student_cfg = 'configs/pascal_voc/retinanet_r18_fpn_1x_voc0712.py'
teacher_cfg = 'configs/pascal_voc/retinanet_r50_fpn_1x_voc0712.py'
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))
data = dict(
samples_per_gpu=2,
workers_per_gpu=2,)
# actual epoch = 3 * 3 = 9
lr_config = dict(policy='step', step=[9])
# runtime settings
runner = dict(
type='EpochBasedRunner', max_epochs=12) # actual epoch = 4 * 3 = 12
auto_scale_lr = dict(enable=True, base_batch_size=16)
Checklist
Describe the question you meet
I used the code in https://github.com/pppppM/mmdetection-distiller to distill using cwd on the voc dataset。
But the final map is only 0.0x
Post related information
2024-03-20 17:26:37,989 - mmdet - INFO - Saving checkpoint at 11 epochs
2024-03-20 17:32:31,759 - mmdet - INFO -
+-------------+------+--------+--------+-------+
| class | gts | dets | recall | ap |
+-------------+------+--------+--------+-------+
| aeroplane | 285 | 17144 | 0.642 | 0.155 |
| bicycle | 337 | 10921 | 0.433 | 0.053 |
| bird | 459 | 22980 | 0.612 | 0.100 |
| boat | 263 | 10601 | 0.506 | 0.152 |
| bottle | 469 | 14081 | 0.616 | 0.229 |
| bus | 213 | 8779 | 0.498 | 0.022 |
| car | 1201 | 27441 | 0.767 | 0.365 |
| cat | 358 | 21052 | 0.709 | 0.026 |
| chair | 756 | 35953 | 0.495 | 0.134 |
| cow | 244 | 8658 | 0.594 | 0.229 |
| diningtable | 206 | 14499 | 0.461 | 0.035 |
| dog | 489 | 27815 | 0.708 | 0.028 |
| horse | 348 | 14995 | 0.664 | 0.109 |
| motorbike | 325 | 11127 | 0.529 | 0.130 |
| person | 4528 | 194646 | 0.858 | 0.303 |
| pottedplant | 480 | 11252 | 0.394 | 0.133 |
| sheep | 242 | 8301 | 0.554 | 0.204 |
| sofa | 239 | 11333 | 0.456 | 0.008 |
| train | 282 | 14650 | 0.578 | 0.061 |
| tvmonitor | 308 | 8899 | 0.419 | 0.157 |
+-------------+------+--------+--------+-------+
| mAP | | | | 0.132 |
+-------------+------+--------+--------+-------+
2024-03-20 17:32:32,366 - mmdet - INFO - Exp name: cwd_retina_r50_fpn_1x_distill_retina_r18_fpn_1x_voc.py
2024-03-20 17:32:32,378 - mmdet - INFO - Epoch(val) [11][4952] mAP: 0.1317, AP50: 0.1320