Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to distill instance segmentation (maskrcnn /solo/boxinst) using the cwd algorithm in mmrazor? #563

Open
smntjugithub opened this issue Jul 25, 2023 · 0 comments

Comments

@smntjugithub
Copy link

###Checklist
• I have searched related issues but cannot get the expected help.
• I have read related documents and don't know what to do.

###Describe the question you meet
I tried distilling boxinst (an instance segmentation algorithm in mmdet) using the cwd algorithm, boxinst-resnet101 to boxinst-resnet50. However, the results show that the object detection accuracy is up to the annotation, but the instance segmentation accuracy is very low, only the edges of the object are split, as visualized below:

weqwe

It's worth noting that, due to lack of demo of instance segmentation, my config file references the CWD config file for object detection (mmrazor/configs/distill/mmdet/cwd/ cwd_fpn_frcnn_r101_frcnn_r50_1x_coco.py).
Directly using the object detection config file for instance segmentation may be the cause of the problem, I think.
Given that instance segmentation is an important computer vision task, could you provide some examples of knowledge distillation for instance segmentation, e.g. maskrcnn, yolo, boxinst? please help me! thanks a lot!

###Post related information

The config file that I used is as follows:
base = [
'mmdet::base/datasets/coco_detection.py',
'mmdet::base/schedules/schedule_1x.py',
'mmdet::base/default_runtime.py'
]

default_scope = 'mmrazor'
teacher_ckpt = 'iter_90000.pth' # noqa: E501
model = dict(
scope='mmrazor',
type='FpnTeacherDistill',
architecture=dict(
cfg_path='mmdet::boxinst/boxinst_r50_fpn_ms-90k_coco_ACID.py',
pretrained=False),
teacher=dict(
cfg_path='mmdet::boxinst/boxinst_r101_fpn_ms-90k_coco_ACID.py',
pretrained=False),
teacher_ckpt=teacher_ckpt,
distiller=dict(
type='ConfigurableDistiller',
student_recorders=dict(fpn=dict(type='ModuleOutputs', source='neck')),
teacher_recorders=dict(fpn=dict(type='ModuleOutputs', source='neck')),
distill_losses=dict(
loss_cwd_fpn0=dict(
type='ChannelWiseDivergence', tau=1, loss_weight=10),
loss_cwd_fpn1=dict(
type='ChannelWiseDivergence', tau=1, loss_weight=10),
loss_cwd_fpn2=dict(
type='ChannelWiseDivergence', tau=1, loss_weight=10),
loss_cwd_fpn3=dict(
type='ChannelWiseDivergence', tau=1, loss_weight=10),
loss_cwd_fpn4=dict(
type='ChannelWiseDivergence', tau=1, loss_weight=10)),
loss_forward_mappings=dict(
loss_cwd_fpn0=dict(
preds_S=dict(from_student=True, recorder='fpn', data_idx=0),
preds_T=dict(from_student=False, recorder='fpn', data_idx=0)),
loss_cwd_fpn1=dict(
preds_S=dict(from_student=True, recorder='fpn', data_idx=1),
preds_T=dict(from_student=False, recorder='fpn', data_idx=1)),
loss_cwd_fpn2=dict(
preds_S=dict(from_student=True, recorder='fpn', data_idx=2),
preds_T=dict(from_student=False, recorder='fpn', data_idx=2)),
loss_cwd_fpn3=dict(
preds_S=dict(from_student=True, recorder='fpn', data_idx=3),
preds_T=dict(from_student=False, recorder='fpn', data_idx=3)),
loss_cwd_fpn4=dict(
preds_S=dict(from_student=True, recorder='fpn', data_idx=4),
preds_T=dict(from_student=False, recorder='fpn',
data_idx=4)))))

find_unused_parameters = True

val_cfg = dict(delete=True, type='mmrazor.SingleTeacherDistillValLoop')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant