One-Shot-Object-Detection icon indicating copy to clipboard operation
One-Shot-Object-Detection copied to clipboard

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

Open Bryce1010 opened this issue 5 years ago • 2 comments

Hi, thanks for your work at first.
But when I reimplement your results, I faced some errors. After I clone the repo, I run the command :
python setup.py build develop

My envirionment is python3.7 and PyTorch1.1.
Then, when I run the code, there is some errors:
ImportError: cannot import name '_mask' from 'pycocotools' (/home/xyang/Code/practical/Few-shot/One-Shot-Object-Detection/lib/pycocotools/__init__.py) I don't know if I need to run the setup.py with py2?

Bryce1010 avatar Jan 07 '20 14:01 Bryce1010

Hey! I met this issue too. I get new cocoapi files here and install it following the instruction separately ,then the test.py works well.(Not sure about train ,i diden't try it :)) P.S. take care the pathes of those files
P.S.. not native speaker ,hope you can understand :) P.S... python3.6 pytorch 1.0

CashewMIC avatar Jan 08 '20 10:01 CashewMIC

Another thing that worked for me was installing pycocotools from : https://github.com/philferriere/cocoapi - the installation was pretty straightforward.

Make sure to delete lib/pycocotools so that the imports point at the pip version and not the local version.

After the installation - You might need to convert the np.round(...) to integer in cocoeval.py -> Params.setDetParams and Params.getKpParams, wherever you installed it with pip.

RajathRD avatar Feb 11 '20 09:02 RajathRD