3

I'm importing files from the following folder inside a python code:

Mask_RCNN
  -mrcnn
    -config.py
    -model.py
    -__init__.py
    -utils.py
    -visualize.py

I'm using the following imports:

These work ok: from Mask_RCNN.mrcnn.config import Config from Mask_RCNN. mrcnn import utils

These give me error:

from Mask_RCNN.mrcnn import visualize
import mrcnn.model as modellib

Error:

ImportError: No module named 'mrcnn'

How to import these properly?

2 Answers 2

2

You get an error for the 2nd import, where you omit Mask_RCNN from the package name.

Try changing the lines to:

from Mask_RCNN.mrcnn import visualize
import Mask_RCNN.mrcnn.model as modellib
Sign up to request clarification or add additional context in comments.

1 Comment

in colab.research.google.com, tf=2.5.0, keras=2.4.3. from Mask_RCNN.mrcnn import utils works but import Mask_RCNN.mrcnn.model as modellib throw the error "Requires TensorFlow 1.3+ and Keras 2.0.8+. ModuleNotFoundError: No module named 'mrcnn'" any ideas?
1

Use this line before importing the libraries

sys.path.append("Mask_RCNN/") 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.