cocodataset / cocoapi

COCO API - Dataset @ http://cocodataset.org/
Other
6.07k stars 3.75k forks source link

I get error: "ImportError: cannot import name 'mask'" for evaluation of custom model Mask R-CNN with pycocotools library #543

Open nataliameira opened 3 years ago

nataliameira commented 3 years ago

Hello everyone!

I implemented the Mask R-CNN algorithm. Now I would like to do the evaluation with the pycocotools library.

I configured the pycocotools library, however when I give the command to evaluate my model, I get the following error message:

File "cocoaFile "cocoapi/PythonAPI/pycocotools/cocoeval.py", line 7, in <module>
    from . import mask as maskUtils
ImportError: cannot import name 'mask'pi/PythonAPI/pycocotools/cocoeval.py", line 7, in <module>
    from . import mask as maskUtils
ImportError: cannot import name 'mask'

I'm using an env on conda. I've already installed packages including cython and numpy. Then I gave the commands:

python3 setup.py build_ext install
make

I got no errors. So I don't understand why I can't evaluate my model.

How do you organize directories? Why do I get the mentioned error?

File "cocoaFile "cocoapi/PythonAPI/pycocotools/cocoeval.py", line 7, in <module>
    from . import mask as maskUtils
ImportError: cannot import name 'mask'pi/PythonAPI/pycocotools/cocoeval.py", line 7, in <module>
    from . import mask as maskUtils
ImportError: cannot import name 'mask'

Your help will be appreciated.

VtojeC commented 2 years ago

Try: from pycocotools import mask as maskUtils

Or if you have your code slightly higher in project tree: from PythonAPI.pycocotools import mask as maskUtils