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

hello,I want to ask a question about yolox distillation #85

Closed
yingwenmingzi123 opened this issue Mar 15, 2023 · 8 comments
Closed

hello,I want to ask a question about yolox distillation #85

yingwenmingzi123 opened this issue Mar 15, 2023 · 8 comments

Comments

@yingwenmingzi123
Copy link

when I use a 2.11.0 version of mmdet, there is an error of yolox is not in the detector registry.
When I use a higher version of mmdet,I dont know how to revise the SGD optimizer. Can you help me to solve it? how to use your method in yolox.

@yzd-v
Copy link
Owner

yzd-v commented Mar 16, 2023

For mmdet < 3.0, refer this for optimizer

@yzd-v yzd-v closed this as completed Mar 16, 2023
@yingwenmingzi123
Copy link
Author

I revised the optimizer,but it still has error.
File "/home/yxy/anaconda3/envs/yolox/lib/python3.7/site-packages/mmdet/models/backbones/csp_darknet.py
patch_top_left = x[..., ::2,::2]
TypeError: string indices must be integers
But I use the code to distill retinanet,there is no error.

@yzd-v
Copy link
Owner

yzd-v commented Mar 16, 2023

Do you try yolox without distillation ? The error may in mmdet codes instead of distillation.

@yingwenmingzi123
Copy link
Author

I try yolox without distillation ,there is no error. I used the version mmdet==2.19.0 and mmcv-full==1.5.0 , is it maybe related to mmdet and mmcv version mismatch? Thank you for your reply.

@yzd-v
Copy link
Owner

yzd-v commented Mar 16, 2023

Fine, I do not know how to fix it either. You can run yolox, that means the mmdet and mmcv-full is matched.

@yingwenmingzi123
Copy link
Author

        scale_y = 1.0
        scale_x = 1.0
        gt = kwargs['gt_bboxes']
        if self.yolox:
            scale_y = self.student._input_size[0] / self.student._default_input_size[0]
            scale_x = self.student._input_size[1] / self.student._default_input_size[1]
            student_loss, img, gt = self.student.forward_train(img, img_metas, **kwargs)
        else:
            student_loss = self.student.forward_train(img, img_metas, **kwargs)
        
        with torch.no_grad():
            fea_t = self.teacher.extract_feat(img)

您好,在in the mmdet/distillation/distillers/detection_distiller.py 这个文件里
当self.yolox is true, fea_t = self.teacher.extract_feat(img) 里面的img传入的实际并不是图像,而是loss_bbox.
然后,您能看下,是不是这个问题导致输入的类型错误。但是当我改成student_loss = self.student.forward_train(img, img_metas, **kwargs)的时候,又会报下面的错误。但是我看代码里面有特征图对齐的代码,不知道这是怎么搞的了
assert preds_S.shapel-2:] == preds_T.shapel-2:],'the output dim of teacher and student differ AssertionError: the output dim of teacher and student differ

@yzd-v
Copy link
Owner

yzd-v commented Mar 17, 2023

返回的应该就是img,你看看你有没有对yolox这个detetcor做修改,这里执行forward_train后会返回loss, img, bbox
image

@xin-art
Copy link

xin-art commented Jun 20, 2024

when I use a 2.11.0 version of mmdet, there is an error of yolox is not in the detector registry. When I use a higher version of mmdet,I dont know how to revise the SGD optimizer. Can you help me to solve it? how to use your method in yolox.

have you solved your problem?

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

3 participants