Open mylifeasazucchini opened 1 year ago
I experienced the same problem with my custom yolo
dataset reader (#487) which is based on the xml
reader you are using. It seems that there is a bug in the xml_dataset.py#L119 which leads to labels without a category. When adding the category, the id
is set to index + 1
. For the category of the bounding box only the cat_id
is used (without +1).
So I would suggest to fix this by adding a +1
to the category id:
ann = {
"image_id": idx + 1,
"bbox": coco_box,
"category_id": cat_id + 1,
"iscrowd": 0,
"id": ann_id,
"area": coco_box[2] * coco_box[3],
}
Hi @cansik
Thanks for taking the time to look in and reply to my issue :) but unfortunately trying the aforementioned changes didn't do it for me unfortunately and the training logs and the validation metrics are still the same [ie 0 throughout]
I am not sure how VOC XML numbers the categories, but Yolo starts at 0
and I guess MS COCO starts at 1
, that's why my problem was fixed with it. It could be that there is something else going on.
I would suggest you debug the loading of the labels. Since the xml loader is based on COCO, I would add a breakpoint here, step through and see if the labels are correctly loaded: https://github.com/RangiLyu/nanodet/blob/main/nanodet/data/dataset/coco.py#L69
I am not sure how VOC XML numbers the categories, but Yolo starts at
0
and I guess MS COCO starts at1
, that's why my problem was fixed with it. It could be that there is something else going on.我不确定VOC XML是如何对类别进行编号的,但是Yolo从0
开始,我猜MS COCO从1
开始,这就是为什么我的问题被修复了。I would suggest you debug the loading of the labels. Since the xml loader is based on COCO, I would add a breakpoint here, step through and see if the labels are correctly loaded: https://github.com/RangiLyu/nanodet/blob/main/nanodet/data/dataset/coco.py#L69我建议你调试标签的加载。由于xml加载器是基于COCO的,我将在这里添加一个断点,单步执行并查看标签是否正确加载: https://github.com/RangiLyu/nanodet/blob/main/nanodet/data/dataset/coco.py#L69
我从voc转coco格式,跑出来map只有两个类别有 其他的都是0请问是格式的问题吗?
Hi! I am a bit new to Object Detector Models and I have been trying to train a single class object detector using the custom xml config file but the mAP remains 0 entirely
At epoch 0: INFO:Train|Epoch1/300|Iter0(1/5)| mem:4.18G| lr:1.00e-07| loss_qfl:0.0729| loss_bbox:0│· .0000| loss_dfl:0.0000| aux_loss_qfl:0.0658| aux_loss_bbox:0.0000| aux_loss_dfl:0.0000| │·
At epoch 300: INFO:NanoDet:Val|Epoch300/300|Iter1500(1/2)| mem:3.72G| lr:5.00e-05| loss_qfl:0.0001| loss_bbox:0.0000| loss_df│· l:0.0000| aux_loss_qfl:0.0000| aux_loss_bbox:0.0000| aux_loss_dfl:0.0000|
│· [NanoDet][01-26 09:42:45]INFO:Val_metrics: {'mAP': 0, 'AP_50': 0, 'AP_75': 0, 'AP_small': 0, 'AP_m': 0, 'AP_l':│· 0}
The main question is why does my bbox loss remain 0 throughout ?
This is my xml config file (in case it helps):
Would appreciate any help! Thxxx