jingtianyilong / YOLOv4-pytorch

This is a pytorch repository of YOLOv4 that can be trained with custom dataset.
31 stars 12 forks source link

作者您好,一个关于注意力机制的问题 #4

Closed joe660 closed 3 years ago

joe660 commented 3 years ago

我在YOLO中使用了ECA、CBAM注意力机制,并和原模型热力图做了比较,发现了一些问题,依次为原图、原模型、ECA、CBAM的可视化后的结果。紫颜色越深代表对目标越感兴趣。可以看到原模型>CBAM>ECA。 image 现在不知道出现了什么问题,使用参数都是一样的。这是shi实验的结果 image 希望作者可以给一些建议。

jingtianyilong commented 3 years ago

I think @argusswift might have more insight on attention topics, since I didn't include attention anyway. But in general, I see obvious improvement on mAP and slight drop on F1-score. I would guess that the bounding box is better while the class regression wasn't as good. Simply changing the weight of the loss function will do the trick, but this might introduce downgrade in other metrics.

Remember, not every metrics is equal. You would often be in a situation where one metric seems to be fine while others don't. That's why metric design is really important.

"I want all" is a wish.

If this is a classification, i would prioritize F1-Score but for OD, mAP is imo the gold standard.

BTW, i'm really interested in youre experiments. seems like a retina or something?

joe660 commented 3 years ago

谢谢作者提供的建议 我使用数据集是结肠息肉,真的疑惑,为什么加入注意力机制效果没有变好,因为在大多数残差网络,都会效果变优,我是做的目标检测 ,可是大家在比较时,都在使用P R F1得分比较,似乎不太关注map

jingtianyilong commented 3 years ago

谢谢作者提供的建议 我使用数据集是结肠息肉,真的疑惑,为什么加入注意力机制效果没有变好,因为在大多数残差网络,都会效果变优,我是做的目标检测 ,可是大家在比较时,都在使用P R F1得分比较,似乎不太关注map

I would suggest that you change she decrease loss_ciou or increase loss_cls. This is rather simple and intuitive. I would also try FocalLoss since I would assume that the positive samples are in a relative small volume. So it might help in general.

If you rather rely on F1 score, why not change it to classification task anyway? The head would be a lot easier to design and the loss would only focus on class error.

jingtianyilong commented 3 years ago

谢谢作者啊 可以加您微信吗 我的微信:18614979331 谢谢

zijieguo@outlook.com. Feel free to contact me. Wechat is too personal.

joe660 commented 3 years ago

作者您好 ,我在加入注意力机制后,可以看到置信度损失明显下降,map也是会略有提升,可是F1得分却降低。在这种情况下有什么好的建议进行改进损失,提升F1吗?就如您上面说的,改变损失之间的权重。这个需要怎么做呢?

jingtianyilong commented 3 years ago

作者您好 ,我在加入注意力机制后,可以看到置信度损失明显下降,map也是会略有提升,可是F1得分却降低。在这种情况下有什么好的建议进行改进损失,提升F1吗?就如您上面说的,改变损失之间的权重。这个需要怎么做呢?

https://github.com/jingtianyilong/YOLOv4-pytorch/blob/c7eebcaa1d94860ba59afa6af22534631cc08707/model/loss/yolo_loss.py#L126 For instance you can change the loss here. Also check other places you might need to update this to all the loss related parts. I read your email. Actually it ended up in my spam-folder😂😂😂😂😂. Anyway, if there's only one class, I would suggest that you change the weight of loss_conf. This is the loss for obj and background.

jingtianyilong commented 3 years ago

Since there's no update, I would like to close this