models icon indicating copy to clipboard operation
models copied to clipboard

ImportError: No module named 'pycocotools'

Open wyl0608 opened this issue 8 years ago • 7 comments

wyl0608 avatar Apr 01 '18 07:04 wyl0608

Same problem too.

Traceback (most recent call last): File "object_detection/eval.py", line 50, in from object_detection import evaluator File "/home/eco/tensorflow/models/research/object_detection/evaluator.py", line 24, in from object_detection import eval_util File "/home/eco/tensorflow/models/research/object_detection/eval_util.py", line 28, in from object_detection.metrics import coco_evaluation File "/home/eco/tensorflow/models/research/object_detection/metrics/coco_evaluation.py", line 20, in from object_detection.metrics import coco_tools File "/home/eco/tensorflow/models/research/object_detection/metrics/coco_tools.py", line 47, in from pycocotools import coco ImportError: No module named pycocotools

liangxiao05 avatar Apr 02 '18 02:04 liangxiao05

Installation of cocoapi is covered in https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

I'm going to close this issue. If you followed these instructions and are still having issues feel free to reopen and @ me.

robieta avatar Apr 03 '18 16:04 robieta

Hi @robieta, I think the confusion arises because in the Installation.md, it says

Download the cocoapi and copy the pycocotools subfolder to the tensorflow/models/research directory if you are interested in using COCO evaluation metrics

which gave me the impression that if I don't need to use the COCO evaluation metrics then I don't need to install it, resulting in this import error when I run the evaluation script. Possible to modify the wording there to make it sound compulsory?

yangsiyu007 avatar May 02 '18 18:05 yangsiyu007

That seems reasonable.

robieta avatar May 02 '18 19:05 robieta

It is still there, and still confusing. I got the same error for my custom dataset

mirayyuce avatar Nov 07 '18 08:11 mirayyuce

The way I've solved it (and the way I solve all similar ones) : git clone [email protected]:cocodataset/cocoapi.git make # might be not necessary python setup.py build python setup.py install

All above when you've activated you virtual environment. Or will be installed globally at your wish.

osvadimos avatar May 21 '19 08:05 osvadimos

pycocotools_mask.c(4): fatal error C1083: 无法打开包括文件: “Python.h”: No such file or directory

dreamlovesft avatar Jun 22 '20 00:06 dreamlovesft