Comments (25)
When generate_coco_format_labels, this repo make img_id
by osp.basename(img_path).split('.')[0]
in datasets.py
. You will get str
label.
BUT, when evaluating results, this repo make img_id
by int(path.stem) if path.stem.isnumeric() else path.stem
in convert_to_coco_format
in evaler.py
. You may get int
label.
Then, coco tools will check these img_id
, so lead this AssertionError
.
So I suggest to modify image_id = int(path.stem) if path.stem.isnumeric() else path.stem
to image_id = path.stem
to solve this error.
from yolov6.
Thanks for your reply! I solve the problem by this way. @ExWang
from yolov6.
Have already pulled the newest commit, but still get the same error:
pred = anno.loadRes(pred_json)
File "/opt/conda/lib/python3.8/site-packages/pycocotools/coco.py", line 341, in loadRes
assert set(annsImgIds) == (set(annsImgIds) & set(self.getImgIds())),
AssertionError: Results do not correspond to current coco set
from yolov6.
老哥你解决了吗?我也是遇到了相同的问题
from yolov6.
from yolov6.
so how can I solve it? 2022-06-27 15:05:30"Nebula Wang" @.>写道: when generate_coco_format_labels, this repo make img_id by osp.basename(img_path).split('.')[0] in datasets.py. You will get 'str' label. BUT, when evaluating results, this repo make img_id by 'int(path.stem) if path.stem.isnumeric() else path.stem'. You may get 'int' label. After, coco tools will check these img_id, so lead this AssertionError — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.>
from yolov6.
之前的错误是:
TypeError: '<' not supported between instances of 'str' and 'int'
我根据你的方法改了,出现了这个问题
AssertionError: Results do not correspond to current coco set
是不是数据集的名字必须是数字吗?不能包含英文吗或者其他字符吗?
from yolov6.
Hello, I would like to know which file needs to be modified
from yolov6.
Hello, I would like to know which file needs to be modified
no file need to be modified now, some one fix it, pull new repo will slove the problem.
from yolov6.
之前的错误是: TypeError: '<' not supported between instances of 'str' and 'int'
我根据你的方法改了,出现了这个问题 AssertionError: Results do not correspond to current coco set
是不是数据集的名字必须是数字吗?不能包含英文吗或者其他字符吗?
我看不是必须数字的,最早这个repo生成image_id用的 img_id = osp.basename(img_path).split('.')[0]
是str的id。但是在后面predict的时候,用的 img_id = int(path.stem) if path.stem.isnumeric() else path.stem
,也就是说,假设你的图片名字是数字的,就会转成int的id。这就造成了coco检查img_id的时候,发现他们对不上,引发了这个Error.
不过这个不统一的问题好像在最近的一个commit中修复了,pull一下最新的就行
from yolov6.
@nidetaoge have you fixed the problem?
from yolov6.
将这里的images_id修改后,仍然还是报错。感觉这一块有问题没有完全解决。其中我的环境是:
torch 1.10.0+cu111
torchaudio 0.10.0+rocm4.1
torchvision 0.11.0+cu111
修改处
def save_one_json(predn, jdict, path, class_map):
# Save one JSON result {"image_id": 42, "category_id": 18, "bbox": [258.15, 41.29, 348.26, 243.78], "score": 0.236}
#image_id = int(path.stem) if path.stem.isnumeric() else path.stem
image_id = path.stem
报错处
assert set(annsImgIds) == (set(annsImgIds) & set(self.getImgIds())),
AssertionError: Results do not correspond to current coco set
terminate called without an active exception
Aborted (core dumped)
from yolov6.
1.把datasets.py文件的img_id = int(path.stem) if path.stem.isnumeric() else path.stem改成img_id = path.stem
2.把evaler.py文件的image_id = int(path.stem) if path.stem.isnumeric() else path.stem改成img_id = path.stem
就可以运行起来了
from yolov6.
1.把datasets.py文件的img_id = int(path.stem) if path.stem.isnumeric() else path.stem改成img_id = path.stem 2.把evaler.py文件的image_id = int(path.stem) if path.stem.isnumeric() else path.stem改成img_id = path.stem 就可以运行起来了
Thanks, I made it
from yolov6.
谢谢博主解答,我已经按照提示将datasets.py evaler.py val.py 三个文件中关于image_id的赋值都改成了path.stem
但还是报错,如果别人没错的话,那应该就是我这边数据集或者别的问题了
assert set(annsImgIds) == (set(annsImgIds) & set(self.getImgIds())),
AssertionError: Results do not correspond to current coco set
from yolov6.
问题解决了,要记得删掉先前跑数据生成的json文件。
from yolov6.
之前的错误是: TypeError: '<' not supported between instances of 'str' and 'int'
我根据你的方法改了,出现了这个问题 AssertionError: Results do not correspond to current coco set
是不是数据集的名字必须是数字吗?不能包含英文吗或者其他字符吗?
不用改源代码,只用一个粗暴的方式解决了:
- 数据集中文件的名称只用数字
- 删除之前训练产生的所有过程文件,即只保留原始数据集的图片和标注
from yolov6.
训练前,自己数据集分布和制作方法跟yolov5一样,不需要json格式标签。我参考这个博主的方法训练成功了,https://blog.csdn.net/DeepLearning_/article/details/125511165?spm=1001.2014.3001.5502
from yolov6.
训练前,自己数据集分布和制作方法跟yolov5一样,不需要json格式标签。我参考这个博主的方法训练成功了,https://blog.csdn.net/DeepLearning_/article/details/125511165?spm=1001.2014.3001.5502
兄弟,你的yaml文件是什么样子的,我参考了你发的链接还是有问题的
from yolov6.
官方已经解决这个问题了,重新下载工程,按照docs/Train_custom_data.md运行即可
from yolov6.
训练前,自己数据集分布和制作方法跟yolov5一样,不需要json格式标签。我参考这个博主的方法训练成功了,https://blog.csdn.net/DeepLearning_/article/details/125511165?spm=1001.2014.3001.5502
兄弟,你的yaml文件是什么样子的,我参考了你发的链接还是有问题的
yaml中只保留train和val,去掉test和anno_path
from yolov6.
1.把datasets.py文件的img_id = int(path.stem) if path.stem.isnumeric() else path.stem改成img_id = path.stem 2.把evaler.py文件的image_id = int(path.stem) if path.stem.isnumeric() else path.stem改成img_id = path.stem 就可以运行起来了
成功啦,必须把datasets.py、evaler.py都改了才能运行起来,只改evaler.py文件还是会报错的哟
from yolov6.
1.把datasets.py文件的img_id = int(path.stem) if path.stem.isnumeric() else path.stem改成img_id = path.stem 2.把evaler.py文件的image_id = int(path.stem) if path.stem.isnumeric() else path.stem改成img_id = path.stem 就可以运行起来了
成功啦,必须把datasets.py、evaler.py都改了才能运行起来,只改evaler.py文件还是会报错的哟
新版的好像datasets.py好像img_id-int()那里改了
from yolov6.
Evaluating mAP by pycocotools.
Saving runs/train/ttop_6s_3004/predictions.json...
ERROR in evaluate and save model.
ERROR in training loop or eval/save model.
Training completed in 0.039 hours.
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
Loading and preparing results...
Traceback (most recent call last):
File "tools/train.py", line 94, in
main(args)
File "tools/train.py", line 84, in main
trainer.train()
File "/YOLOv6/yolov6/core/engine.py", line 70, in train
self.train_in_loop()
File "/YOLOv6/yolov6/core/engine.py", line 89, in train_in_loop
self.eval_and_save()
File "/YOLOv6/yolov6/core/engine.py", line 115, in eval_and_save
self.eval_model()
File "/YOLOv6/yolov6/core/engine.py", line 134, in eval_model
results = eval.run(self.data_dict,
File "/yolov6/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/YOLOv6/tools/eval.py", line 83, in run
eval_result = val.eval_model(pred_result, model, dataloader, task)
File "/YOLOv6/yolov6/core/evaler.py", line 127, in eval_model
pred = anno.loadRes(pred_json)
File "/home/suza/.conda/envs/yolov6/lib/python3.8/site-packages/pycocotools/coco.py", line 327, in loadRes
assert set(annsImgIds) == (set(annsImgIds) & set(self.getImgIds())),
AssertionError: Results do not correspond to current coco set
When generate_coco_format_labels, this repo make
img_id
byosp.basename(img_path).split('.')[0]
indatasets.py
. You will getstr
label.BUT, when evaluating results, this repo make
img_id
byint(path.stem) if path.stem.isnumeric() else path.stem
inconvert_to_coco_format
inevaler.py
. You may getint
label.Then, coco tools will check these
img_id
, so lead thisAssertionError
.So I suggest to modify
image_id = int(path.stem) if path.stem.isnumeric() else path.stem
toimage_id = path.stem
to solve this error.
After changing to "image_id = path.stem" now this error appears !!
from yolov6.
This resolved in my case
from yolov6.
Related Issues (20)
- 可以提供一下webui界面吗 HOT 2
- YOLOv6分割模型训练期间应用数据增强的时候,标注区域是否未正确跟随变化? HOT 1
- Image not found error
- Multi-gpu problem HOT 1
- yolov6n_seg.pt是P6模型吗?为什么训练的时候设置--fuse_ab的时候训练会出现异常 HOT 2
- Training failed using yolov6l on 1GPU, Assertion `target_val >= zero && target_val <= one` failed, Data is verified but still training fails HOT 2
- eval - empty exp folder HOT 1
- Code Modification and Object Detection Implementation with Jetson RT [error] "gain=ratio_pad[0] is not subscritable" HOT 1
- 请问val loss在哪里看呢?训练过程只输出了train loss(How to see val loss??) HOT 1
- Custom dataset format for segmentation
- 如何在不改变分割模型尺寸的情况下,调整推理结果中mask的尺寸?
- yolov6s quant problem HOT 3
- map为0 HOT 3
- distill的流程与配置 HOT 2
- Invalid label with my custom dataset from roboflow
- 自蒸馏教师模型的模型结构
- 自蒸馏损失
- Inference bottlenecked by _local_scalar_dense running on CPU
- Issue with YOLOv6 Segmentation Model Using Polygon Labels HOT 1
- YOLOv6 continues to be awesome
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yolov6.