hukaixuan19970627 / yolov5_obb

yolov5 + csl_label.(Oriented Object Detection)(Rotation Detection)(Rotated BBox)基于yolov5的旋转目标检测
GNU General Public License v3.0
1.81k stars 425 forks source link

测试自己模型的问题 #57

Closed fxcdl closed 2 years ago

github-actions[bot] commented 3 years ago

Hello @fxcdl, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

For more information please visit https://www.ultralytics.com.

hukaixuan19970627 commented 3 years ago

尝试下调低detect的置信度阈值

fxcdl commented 3 years ago

您好,根据您的建议以及看了一些类似的问题,我在自己的数据集中还是存在detect出的box形状位置错误以及置信度非常低的现象,我把我的处理流程以及结果大致描述一下,麻烦您看下问题可能出现在哪里

1、我的数据集中每张图像的长宽都是不一样的,我按照每张图像的最长边进行padding成正方形,最后统一resize成1024*1024。 目前我只标注了100张图像,使用全部的100张图象进行训练,且只包含2类。

2、使用默认参数以及mosaic增强训练1000轮,train_batch图像以及loss曲线放在下面。loss中除了box的损失其他损失看起来都是比 较正常的。我使用训练集数据进行测试,按照初始的置信度以及IOU阈值是没有任何pred的,再将阈值设置成0.05后有部分输 出,但是box的位置以及大小基本都是错的,置信度普遍非常低。 train_batch0 loss

3、关闭了mosaic增强训练了1000轮,train_batch图像以及loss曲线放在下面。box的loss看起来更加异常,最后稳定在了一个很高的 值 train_batch0 results

4、我看了其他类似的问题,正在尝试增加Loss中box以及置信度的权重,减少其他2种loss的权重,下图是我调整的比例,这个目前 正在训练,但是看初步结果收敛的也不是很理想 image

我个人觉得可能是数据量太低导致的这种结果,但是我用训练集数据去测试模型结果不应该这么糟糕啊,数据量很少训练集感觉会过拟合才对。

hukaixuan19970627 commented 3 years ago
  1. 想直接过拟合的话把mosaic关掉比较好,另外这最后的loss曲线已经不算过拟合了,网络甚至都没更新参数,把train.py中的--Adam置为True看看效果。
  2. 非密集中小物体检测不推荐使用mosaic,而且你这个物体的区域有点太大了,使用mosaic明显会使得目标特征不完整,建议: (1) scratch.yaml中mosaic触发概率改为0.8~0.5 (2) 另外去datasets.py中将random_perspective函数里面的s=random.uniform(1-scale, 1+scale)改为s=random.uniform(1-scale, 1), 尽量让mosaic之后的图像进行缩小来保证目标的完整性,或者直接s=0.5,确保四张图片中的信息在mosaic输出中能完整保留
fxcdl commented 3 years ago

好的,谢谢,我试一下

BruceFreedom commented 3 years ago

好的,谢谢,我试一下

hi,这位朋友你问题解决了么?我也是自制数据集(长宽不相等,差别还较大,大约800张),2个类别,没有使用mosaic训练,训练了150epoch,测试碰到和你类似问题:刚开始没有检测到任何目标(使用的训练集),后来将置信度调整到0.05,才有部分目标,但是bbox的尺寸明显不对,想请教下你是怎么做的

fxcdl commented 3 years ago

好的,谢谢,我试一下

hi,这位朋友你问题解决了么?我也是自制数据集(长宽不相等,差别还较大,大约800张),2个类别,没有使用mosaic训练,训练了150epoch,测试碰到和你类似问题:刚开始没有检测到任何目标(使用的训练集),后来将置信度调整到0.05,才有部分目标,但是bbox的尺寸明显不对,想请教下你是怎么做的

您好,您可以尝试下以下几个思路解决: 1、确保您的输入图像尺寸统一,使用padding而不是直接resize 2、打开mosaic,如果您的物体比较大的话,参考上面作者的建议,我试了是可以的

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

cxt321 commented 2 years ago

您好,请问您将Adam设置为true了嘛,我修改了mosaic和将Adam设置为true,发现box loss正常下降了,obj loss却上升了