Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name '_mask' from 'pycocotools' #611

Closed
zhengxinvip opened this issue Jul 17, 2019 · 8 comments
Closed

ImportError: cannot import name '_mask' from 'pycocotools' #611

zhengxinvip opened this issue Jul 17, 2019 · 8 comments

Comments

@zhengxinvip
Copy link

ImportError: cannot import name '_mask' from 'pycocotools'
how can I fix it? thanks.

@kentaroy47
Copy link

kentaroy47 commented Jul 18, 2019

a silly workaround is just commenting out

# import pycocotools._mask as _mask

from

lib/pycocotools/coco.py
lib/pycocotools/cocoeval.py
lib/datasets/coco.py
since this repo doesn't use masks..

@decoli
Copy link

decoli commented May 12, 2020

a silly workaround is just commenting out

# import pycocotools._mask as _mask

from

lib/pycocotools/coco.py
lib/pycocotools/cocoeval.py
lib/datasets/coco.py
since this repo doesn't use masks..

So ... is this indeed a feasible and correct way to solve this problem?
And why there is the code import pycocotools._mask as _mask if it doesn't use masks?

@kentaroy47
Copy link

My take is that masks are used for instance segmentation tasks and not detection tasks. That's why you can simply comment out and still work frcnn😇

@decoli
Copy link

decoli commented May 12, 2020

My take is that masks are used for instance segmentation tasks and not detection tasks. That's why you can simply comment out and still work frcnn😇

なるほど…僕の理解がずれてました…
ちなみにコメントアウトするべき
import pycocotools._mask as _mask

lib/pycocotools/coco.py
lib/pycocotools/cocoeval.py
lib/datasets/coco.py

で見つからないです。
すみませんが何故でしょうか?

@loolzaaa
Copy link

You can install pycoctools with mask module compiled via conda or pip.

In other hand, you can compile _mask module from .pyx file with cython.

@kentaroy47
Copy link

@shirui-japina
pycocotools should be where you installed with pip or whatever.
you should modify the coco.py script.

Another good workaround is installing pycocotools properly.
Try:
pip install -U 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'

This should work for Linux.

@decoli
Copy link

decoli commented May 13, 2020

You can install pycoctools with mask module compiled via conda or pip.

In other hand, you can compile _mask module from .pyx file with cython.

Thanks for your comment.
I tried to
pip install pycocotools
but got error as below:

Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

So then I installed Visual Studio, but it doesn't work.
Do you know what I should do now?

@decoli
Copy link

decoli commented May 13, 2020

@shirui-japina
pycocotools should be where you installed with pip or whatever.
you should modify the coco.py script.

Thanks for your comment.
I'll try to install pycocotools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants