mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

loss_cls: 0.0000, loss_bbox: 0.0000 when training YOLOX on my own dataset

Open pumpkin33498 opened this issue 3 years ago • 21 comments

我用YOLOX训练自己的数据集的时候一直显示loss_cls: 0.0000, loss_bbox: 0.0000,然后测试的时候会有ERROR The testing results of the whole dataset is empty 请问可能是什么原因?

pumpkin33498 avatar Dec 28 '21 13:12 pumpkin33498

我也遇到了,但是没有提示是error,loss_cls,loss_bbox都有值

ZouRuia avatar Jan 14 '22 02:01 ZouRuia

请问这个问题你解决了吗?我也遇到了同样的问题

VJoer avatar Jan 14 '22 04:01 VJoer

我用YOLOX训练自己的数据集的时候一直显示loss_cls: 0.0000, loss_bbox: 0.0000,然后测试的时候会有ERROR The testing results of the whole dataset is empty 请问可能是什么原因? 找到原因了,在coco.py文件中要设置类别,因为我自己的CoCo数据集也是80类,所以没有改,但是类别的名称和CoCo2017类别名称不一样,你需要将类别名称改一下 image. 参考这个链接

VJoer avatar Jan 14 '22 06:01 VJoer

不知道为啥,在运行一遍,正常跑通了。没有改任何东西。

ZouRuia avatar Jan 14 '22 06:01 ZouRuia

之前的是这样的: [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 5000/5000, 17.4 task/s, elapsed: 287s, ETA: 0s writing results to ./result.pkl

Evaluating bbox... Loading and preparing results... The testing results of the whole dataset is empty. 我用的都是coco2017的数据,没有变过,之前跑过faster_rcnn,mask_rcnn,yolo,都可以,跑fcos_50也可以,用同样的学习率,gpu个数去跑fcos_101就出现了上面的问题,但是没有改什么,再跑一遍,就又跑通了。

ZouRuia avatar Jan 14 '22 06:01 ZouRuia

之前的是这样的: [>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 5000/5000, 17.4 task/s, elapsed: 287s, ETA: 0s writing results to ./result.pkl

Evaluating bbox... Loading and preparing results... The testing results of the whole dataset is empty. 我用的都是coco2017的数据,没有变过,之前跑过faster_rcnn,mask_rcnn,yolo,都可以,跑fcos_50也可以,用同样的学习率,gpu个数去跑fcos_101就出现了上面的问题,但是没有改什么,再跑一遍,就又跑通了。

你是用自己训练的模型还是官方给的预训练模型跑测试的?

VJoer avatar Jan 14 '22 06:01 VJoer

没有用预训练模型,自己跑出来的模型测试的。

ZouRuia avatar Jan 14 '22 07:01 ZouRuia

我的loss_cls: 0.0000, loss_bbox: 0.0000这两个值不是0.0000,是有值的,还正常的值。

ZouRuia avatar Jan 14 '22 07:01 ZouRuia

我用YOLOX训练自己的数据集的时候一直显示loss_cls: 0.0000, loss_bbox: 0.0000,然后测试的时候会有ERROR The testing results of the whole dataset is empty 请问可能是什么原因? 找到原因了,在coco.py文件中要设置类别,因为我自己的CoCo数据集也是80类,所以没有改,但是类别的名称和CoCo2017类别名称不一样,你需要将类别名称改一下 image. 参考这个链接

谢谢,我看了一下我的类别应该改了QAQ

pumpkin33498 avatar Jan 14 '22 07:01 pumpkin33498

没有用预训练模型,自己跑出来的模型测试的。

我的问题是和楼主一样的训练自己的数据集的时候一直显示loss_cls: 0.0000, loss_bbox: 0.0000,然后测试的时候出现The testing results of the whole dataset is empty.,然后我就在coco.py中增加了类名解决了问题,你可以尝试在coco.py中增加类名,然后在coco.py中添加 test=dict( samples_per_gpu=32, classes=classes,

VJoer avatar Jan 14 '22 07:01 VJoer

同!跑coco2017都不行

JarvisKevin avatar Jan 20 '22 10:01 JarvisKevin

@VJoer You can see the training log we released, it is normal.

hhaAndroid avatar Feb 23 '22 09:02 hhaAndroid

Hey there! I had the same problem and maybe the solution helps you too: In your COCO Annotations you have to specify an area (how big the boxes are). If you set that to 0 the MMDet training ignores these boxes. That's why the loss quickly goes to 0 (because the boxes do not exist and it is trained to not find anything at all)

Snixells avatar Mar 02 '22 10:03 Snixells

@Snixells How to specify an area in COCO annotation. It's already there in my datasets. Could you please explain it again? Thanks. Screenshot 2022-03-15 192149

kaphleamrit2 avatar Mar 16 '22 00:03 kaphleamrit2

遇到了同样的问题,coco.py中的类别数量除了要保持一致,名称也要一样才行。

fire717 avatar Apr 18 '22 14:04 fire717

### 可以尝试把lr调低,有可能是lr过大,导致梯度消失

Kinglee90 avatar May 30 '22 08:05 Kinglee90

我跑yolov7也遇到这个问题了,但是我修改classes也没有解决

52THANOS avatar Jan 09 '23 05:01 52THANOS

同样遇到这样的问题,第一种文档里说可能是正常现象,第二种属于类别没有改,我用的yolov5,具体是yolov5cocodataset继承了mmdet中cocodataset的类别,在其中修改类别就可以。

1127244933 avatar Feb 28 '23 02:02 1127244933

Hey there! I had the same problem and maybe the solution helps you too: In your COCO Annotations you have to specify an area (how big the boxes are). If you set that to 0 the MMDet training ignores these boxes. That's why the loss quickly goes to 0 (because the boxes do not exist and it is trained to not find anything at all)

sir! how to specify the bbox size ? e.g. the areas field is?

kennyadelaide avatar Mar 08 '23 08:03 kennyadelaide