meituan / YOLOv6

YOLOv6: a single-stage object detection framework dedicated to industrial applications.
GNU General Public License v3.0
5.71k stars 1.03k forks source link

ModuleNotFoundError: No module named 'pycocotools._mask' #600

Open Shaoli7 opened 2 years ago

Shaoli7 commented 2 years ago

Before Asking

Search before asking

Question

我使用pycharm打开最新的代码,运行train.py文件出现报错ModuleNotFoundError: No module named 'pycocotools._mask',试了很多方法,都不行,您可以给个建议吗? "D:\Program Files\Anaconda3\envs\pytorch1.8.1\python.exe" "D:/Program Files/Anaconda3/envs/pytorch1.8.1/pycocotools/mask.py" Traceback (most recent call last): File "D:/Program Files/Anaconda3/envs/pytorch1.8.1/pycocotools/mask.py", line 3, in import pycocotools._mask as _mask ModuleNotFoundError: No module named 'pycocotools._mask' 环境配置里也有pycocotools包

Additional

No response

Chilicyy commented 2 years ago

您好,看起来pycocotools没有安装成功,可以尝试源码安装的方法。

Shaoli7 commented 2 years ago

您好,看起来pycocotools没有安装成功,可以尝试源码安装的方法。

好的,感谢您,经过重新安装几次好了。但是在训练运行中完成一个epoch后出现了TypeError: 'numpy.float64' object cannot be interpreted as an integer这个问题。 重新安装了,也按照网上的降低了numpy的版本,还是不行,具体错误信息如下: ERROR in evaluate and save model. ERROR in training loop or eval/save model. Traceback (most recent call last): File "F:/MrLi/YOLOv6-main/tools/train.py", line 126, in main(args) File "F:/MrLi/YOLOv6-main/tools/train.py", line 116, in main trainer.train() File "F:\MrLi\YOLOv6-main\yolov6\core\engine.py", line 99, in train self.train_in_loop(self.epoch) File "F:\MrLi\YOLOv6-main\yolov6\core\engine.py", line 119, in train_in_loop self.eval_and_save() File "F:\MrLi\YOLOv6-main\yolov6\core\engine.py", line 157, in eval_and_save self.eval_model() File "F:\MrLi\YOLOv6-main\yolov6\core\engine.py", line 192, in eval_model results, vis_outputs, vis_paths = eval.run(self.data_dict, File "D:\Program Files\Anaconda3\envs\pytorch1.8.1\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "F:\MrLi\YOLOv6-main\tools\eval.py", line 154, in run eval_result = val.eval_model(pred_result, model, dataloader, task) File "F:\MrLi\YOLOv6-main\yolov6\core\evaler.py", line 262, in eval_model cocoEval = COCOeval(anno, pred, 'bbox') File "D:\Program Files\Anaconda3\envs\pytorch1.8.1\lib\site-packages\pycocotools\cocoeval.py", line 76, in init self.params = Params(iouType=iouType) # parameters File "D:\Program Files\Anaconda3\envs\pytorch1.8.1\lib\site-packages\pycocotools\cocoeval.py", line 527, in init self.setDetParams() File "D:\Program Files\Anaconda3\envs\pytorch1.8.1\lib\site-packages\pycocotools\cocoeval.py", line 507, in setDetParams self.iouThrs = np.linspace(.5, 0.95, np.round((0.95 - .5) / .05) + 1, endpoint=True) File "<__array_function__ internals>", line 180, in linspace File "D:\Program Files\Anaconda3\envs\pytorch1.8.1\lib\site-packages\numpy\core\function_base.py", line 120, in linspace num = operator.index(num) TypeError: 'numpy.float64' object cannot be interpreted as an integer 非常期待您的解答

Chilicyy commented 2 years ago

看起来还是需要重新安装cocoapi,可以参考这篇教程:https://blog.csdn.net/flyfish1986/article/details/104513632 如果紧急的话,可以在评估时不用cocoapi,改用另一种方式做评估。具体可参考这个配置文件的设置 https://github.com/meituan/YOLOv6/blob/main/configs/experiment/yolov6n_with_eval_params.py#L60 , 将do_coco_metric设为False , do_pr_metric设为True。

Shaoli7 commented 2 years ago

看起来还需要重新安装 cocoapi,请参考:https ://blog.csdn.net/flyfish1986/article/details/104513632 紧急的话,可以在评估 cocoapi 时用另一种方式评估具体可以参考这个配置文件的设置https://github.com/meituan/YOLOv6/blob/main/configs/experiment/yolov6n_with_eval_params.py#L60,将do_coco_metric设为False,do_pr_metric设为True。

好的,我去试下,谢谢您的指导,我想问下要是用另一种方式评估cocoapi的话,对精度会有影响吗?

shensheng272 commented 2 years ago

看起来还需要重新安装 cocoapi,请参考:https ://blog.csdn.net/flyfish1986/article/details/104513632 紧急的话,可以在评估 cocoapi 时用另一种方式评估具体可以参考这个配置文件的设置https://github.com/meituan/YOLOv6/blob/main/configs/experiment/yolov6n_with_eval_params.py#L60,将do_coco_metric设为False,do_pr_metric设为True。

好的,我去试下,谢谢您的指导,我想问下要是用另一种方式评估cocoapi的话,对精度会有影响吗?

影响不大,只是注意对比的时候尽量使用一种评估方法