Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow object detection evaluation pycocotools missing

Following the TF tutorial on pet object detection : https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_pets.md

Ran locally : https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_locally.md

The training seems to work well.

Trying to launch the evaluation process from the tensorflow/models/research/ directory

python object_detection/eval.py \
    --logtostderr \
    --pipeline_config_path=${PATH_TO_YOUR_PIPELINE_CONFIG} \
    --checkpoint_dir=${PATH_TO_TRAIN_DIR} \
    --eval_dir=${PATH_TO_EVAL_DIR}

I got the following error

from pycocotools import coco \
ModuleNotFoundError: No module named 'pycocotools'

Had a look on coco API but I don't see any clear way to install it on Windows.

Any advice on how to get the evaluation running the simpliest way ?


More details about the error message :

Traceback (most recent call last):   File "object_detection/eval.py", line 50, in <module>
from object_detection import evaluator
File "D:\models\research\object_detection\evaluator.py", line 27, in <module>
from object_detection.metrics import coco_evaluation
File "D:\models\research\object_detection\metrics\coco_evaluation.py", line 20, in <module>
from object_detection.metrics import coco_tools
File "D:\models\research\object_detection\metrics\coco_tools.py", line 47, in <module>
from pycocotools import coco ModuleNotFoundError: No module named 'pycocotools'
like image 957
Frédéric Coubard Avatar asked Feb 12 '18 13:02

Frédéric Coubard


People also ask

Why am I getting a Modulenotfounderror No module named Pycocotools _mask error in my code?

modulenotfounderror: no module named pycocotools error occurs because of incompatibility of pycocotools in various top layer packages (TensorFlow etc). Typically we have seen this error in object detection with TensorFlow at the evaluation stage. But there may be multiple scenarios where we can get this error.

What is TensorFlow Object Detection API?

TensorFlow object detection is a computer vision technique that detects, locates, and traces an object from a still image or video. The method allows us to recognize how the models work and provides a fuller understanding of the image or video by detecting objects.


4 Answers

This solved the same issue for me:

pip3 install -U scikit-image
pip3 install -U cython 
pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

(and use pip instead of pip3 if you are using python 2.7)

like image 160
frostell Avatar answered Nov 07 '22 11:11

frostell


It works for me with this just simple method. If you are windows, try to install pycocotools in windows version. With code in following:

pip install pycocotools-windows

With this method, you don't need to install any visual build tools. Hope this can help those who finding the ways of installing pycocotools.

like image 41
Jack Wong Avatar answered Nov 07 '22 13:11

Jack Wong


Could you post the full stack trace so we can see where pycocotools is being imported from? We're adding COCO support to the Tensorflow Object-Detection API (with a few other goodies), and will update the installation instructions soon.

like image 29
Derek Chow Avatar answered Nov 07 '22 13:11

Derek Chow


Following command worked for me.

pip install pycocotools
like image 41
Ashiq Imran Avatar answered Nov 07 '22 12:11

Ashiq Imran