Mask_rcnn: ModuleNotFoundError: No module named 'coco

Created on 28 Jun 2019  路  2Comments  路  Source: matterport/Mask_RCNN

ModuleNotFoundError: No module named 'coco'

While running through the step-by-step inspect_weights.ipynb, I tried to run the very first notebook cell (just by copy and paste). I got the error:

ModuleNotFoundError Traceback (most recent call last)
in ()
1 sys.path.insert(0, '/~/Downloads/mask_rcnn_coco.h5')
----> 2 import coco
3 config = coco.CocoConfig()

ModuleNotFoundError: No module named 'coco'

I was hoping someone might be able to help me solve this problem because it has taken me forever to research, and I can't seem to figure it out! The link is: https://github.com/matterport/Mask_RCNN/blob/master/samples/coco/inspect_weights.ipynb

Thank you so much!

Most helpful comment

You can follow these steps:

Install Visual studio build tools from this link
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017

Then clone the cocoapi repository from github
git clone https://github.com/cocodataset/cocoapi.git

After cloning, go to the PythonAPI sub-directory in the same folder and run,
python setup.py install

If all these steps went well then you are good to go.

Or simply you can try:
!pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

And then try to import
from pycocotools.coco import COCO

All 2 comments

You can follow these steps:

Install Visual studio build tools from this link
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017

Then clone the cocoapi repository from github
git clone https://github.com/cocodataset/cocoapi.git

After cloning, go to the PythonAPI sub-directory in the same folder and run,
python setup.py install

If all these steps went well then you are good to go.

Or simply you can try:
!pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

And then try to import
from pycocotools.coco import COCO

You can follow these steps:

Install Visual studio build tools from this link
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017

Then clone the cocoapi repository from github
git clone https://github.com/cocodataset/cocoapi.git

After cloning, go to the PythonAPI sub-directory in the same folder and run,
python setup.py install

If all these steps went well then you are good to go.

Or simply you can try:
!pip install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"

And then try to import
from pycocotools.coco import COCO

I did a similar thing as you suggested and then for import I did:
import pycocotools.coco as coco
Then it failed for me on - coco.CocoConfig()...
In this line :
class InferenceConfig(coco.CocoConfig):
I did as described here - link.

Regards, hope it helps.

Was this page helpful?
0 / 5 - 0 ratings