YOLOv6
YOLOv6 copied to clipboard
Error in evaluate and save model
Evaluating mAP by pycocotools. Saving runs/train/exp14/predictions.json... loading annotations into memory... Done (t=6.09s) creating index... index created! Loading and preparing results... ERROR in evaluate and save model. ERROR in training loop or eval/save model.
Training completed in 0.474 hours.
Traceback (most recent call last):
File "tools/train.py", line 94, in
AssertionError: Results do not correspond to current coco set
@meituan-gengyifei After the training is completed, before the evaluation results, I am getting the following error. I would really appreciate it, to get some insights on how to go about this issue as soon as possible.
I faced this issue when I was using custom dataset that was formatted in COCO format Are you using custom dataset? Have you recently cloned the repo? Please follow the directory structure provided in: Train custom set
Thank you, I could solve the issue by configuring the dataset.yaml file as my data. I am using the COCO dataset itself, but only two classes. Maybe, considering this as a custom dataset scenario makes more sense right now
Yes, you will need to set:
# whether it is coco dataset, only coco dataset should be set to True.
is_coco: False
@ShisuiUzumaki I already follow the directory structure, but still facing the same problem. I have a custom dataset
@ShisuiUzumaki I already follow the directory structure, but still facing the same problem. I have a custom dataset
What is your directory structure? Also, have you set is_coco = False
in yaml
file
@ShisuiUzumaki I already set is_coco = False in yaml file, and follow the directory structure as in Train custom data down below is the log of the error its create a Jason file for my dataset annotation but stop with the eval an give the error below.
ERROR in evaluate and save model. ERROR in training loop or eval/save model.
Training completed in 0.074 hours.
Traceback (most recent call last):
File "D:\yolov\YOLOv6\tools\train.py", line 92, in
main(args)
File "D:\yolov\YOLOv6\tools\train.py", line 82, in main
trainer.train()
File "D:\yolov\YOLOv6\yolov6\core\engine.py", line 70, in train
self.train_in_loop()
File "D:\yolov\YOLOv6\yolov6\core\engine.py", line 89, in train_in_loop
self.eval_and_save()
File "D:\yolov\YOLOv6\yolov6\core\engine.py", line 115, in eval_and_save
self.eval_model()
File "D:\yolov\YOLOv6\yolov6\core\engine.py", line 134, in eval_model
results = eval.run(self.data_dict,
File "C:\Users\abdul\AppData\Roaming\Python\Python310\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "D:\yolov\YOLOv6\tools\eval.py", line 83, in run
eval_result = val.eval_model(pred_result, model, dataloader, task)
File "D:\yolov\YOLOv6\yolov6\core\evaler.py", line 128, in eval_model
cocoEval = COCOeval(anno, pred, 'bbox')
File "C:\Users\abdul\AppData\Roaming\Python\Python310\site-packages\pycocotools\cocoeval.py", line 80, in init
self.params.imgIds = sorted(cocoGt.getImgIds())
TypeError: '<' not supported between instances of 'int' and 'str'
How to fix this?
@ShisuiUzumaki I already set is_coco = False in yaml file, and follow the directory structure as in Train custom data down below is the log of the error its create a Jason file for my dataset annotation but stop with the eval an give the error below.
ERROR in evaluate and save model. ERROR in training loop or eval/save model.
Training completed in 0.074 hours.
Traceback (most recent call last): File "D:\yolov\YOLOv6\tools\train.py", line 92, in main(args) File "D:\yolov\YOLOv6\tools\train.py", line 82, in main trainer.train() File "D:\yolov\YOLOv6\yolov6\core\engine.py", line 70, in train self.train_in_loop() File "D:\yolov\YOLOv6\yolov6\core\engine.py", line 89, in train_in_loop self.eval_and_save() File "D:\yolov\YOLOv6\yolov6\core\engine.py", line 115, in eval_and_save self.eval_model() File "D:\yolov\YOLOv6\yolov6\core\engine.py", line 134, in eval_model results = eval.run(self.data_dict, File "C:\Users\abdul\AppData\Roaming\Python\Python310\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "D:\yolov\YOLOv6\tools\eval.py", line 83, in run eval_result = val.eval_model(pred_result, model, dataloader, task) File "D:\yolov\YOLOv6\yolov6\core\evaler.py", line 128, in eval_model cocoEval = COCOeval(anno, pred, 'bbox') File "C:\Users\abdul\AppData\Roaming\Python\Python310\site-packages\pycocotools\cocoeval.py", line 80, in init self.params.imgIds = sorted(cocoGt.getImgIds()) TypeError: '<' not supported between instances of 'int' and 'str' How to fix this?
There is a possibility that there is a string in your variables that is being compared with ints. Why not debug it from the given line to see what is happening there?
@ShisuiUzumaki the names of my dataset images start with numbers. I rename the images with Pic_ (000), but there is space in the name of the images is this the cause of the problem?
what do you mean Why not debug it from the given line?
@ShisuiUzumaki the names of my dataset images start with numbers. I rename the images with Pic_ (000), but there is space in the name of the images is this the cause of the problem?
what do you mean Why not debug it from the given line?
I mean, if you are using pycharm or VS code you could add debug point on the cocoEval = COCOeval(anno, pred, 'bbox')
. and jump into thee code and execute line by line to check state of various variables