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

蒸馏损失实现时类别能否改用变量? #2

Open
LiangYongAI opened this issue Jul 6, 2022 · 6 comments
Open

蒸馏损失实现时类别能否改用变量? #2

LiangYongAI opened this issue Jul 6, 2022 · 6 comments

Comments

@LiangYongAI
Copy link

我看yolo_head.py里实现蒸馏损失时类别数固定成5了,能否用变量替换?方便类别数变化。

@LiangYongAI
Copy link
Author

我现在用coco数据集在验证,把yolo_head.py里面的类别数全部由5改成80还是没能跑通

@xiao-hua-sheng
Copy link
Owner

错误是什么了?蒸馏损失里的类别确实被固定了 你数据的路径设置对了吗?exps/example/ 下面的学生模型文件进行设置,我使用的是VOC的数据格式,你COCO的格式要自己修改

@LiangYongAI
Copy link
Author

看到你在readme上的改动了,除了你说的那一处,但好像还有几处也需要改动一下,我列出来你确认一下需要不需要把5改成80?
1、

mixup = labels.shape[2] > 5

2、
label_cut = labels[..., :5]

3、
gt_bboxes_per_image = labels[batch_idx, :num_gt, 1:5]

@LiangYongAI
Copy link
Author

还有这一处为什么传T=20? 请教一下,谢谢

d_loss = self.distill_loss(outputs, T_pre, T=20)

@LiangYongAI
Copy link
Author

@xiao-hua-sheng 期待你的回复,谢谢

@xiao-hua-sheng
Copy link
Owner

xiao-hua-sheng commented Jul 7, 2022

你列的1、2、3不需要修改,labels的前4位([...,:4])是bbox的中心坐标和宽高,第5位是置信度([..., 4]),剩下位数是类别
([..., 5:])。
T的取值范围在[20,100],请根据训练结果进行调整。T表示蒸馏温度,值越大,负样本信息贡献值越大。

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

2 participants