‘Results do not correspond to current coco set‘

编程入门 行业动态 更新时间:2024-10-27 23:27:39

‘Results do not <a href=https://www.elefans.com/category/jswz/34/1347292.html style=correspond to current coco set‘"/>

‘Results do not correspond to current coco set‘

在训练YOLOV6的时候碰上了

'Results do not correspond to current coco set'

这个问题。

assert set(annsImgIds) == (set(annsImgIds) & set(self.getImgIds())) 根据这个断言检查了下。

调用coco API检查了下,打印出来len((person_imgs_id)的值为297.

from pycocotools.coco import COCO
val_info = r'VOC/annotations/instances_val.json'coco = COCO(val_info)  # 导入验证集
person_imgs_id = coco.getImgIds()
print(len(person_imgs_id))

而在检查set(annsImgIds)时,在evaler.py文件的eval_model这个方法中

annsImgIds = [ann['image_id'] for ann in pred_results]
print(len(set(annsImgIds)))

打印出来的长度为497(也就是我验证集的数量)

然后检查了下instances_val.json文件,发现

 image_id是6,而我的数据图片id为6.8CAXX.jpg,那么就找到了问题的所在。

在dataset.py中的generate_coco_format_labels方法中

img_id = osp.basename(img_path).split('.')[0]

这样就导致以一个点分割了这个图片id,6.8CAXX.jpg被分割乘了6、8CAXX、jpg 三个字符串,所以导致了json文件中出现了image_id为6的情况。

解决办法:

在dataset.py中的generate_coco_format_labels方法中

img_id = osp.basename(img_path).split('j')[0].strip('.')

将img_id改成上述代码,以j分割,再去掉剩下来的点,代码就能成功跑通了

更多推荐

‘Results do not correspond to current coco set‘

本文发布于:2024-02-16 22:17:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1691637.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:correspond   Results   current   set   coco

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!