Mask_rcnn: Suggestion: Add `pycocotools` and `cython` to requirements + upade installation instructions

Created on 2 Nov 2017  路  7Comments  路  Source: matterport/Mask_RCNN

Hi Waleed,
This is wonderful work and I'm glad you made it available to the rest of us.
The two small edits to README.md might make it easier to experiment with your package:

## Requirements
* Python 3.4+
* TensorFlow 1.3+
* Keras 2.0.8+
* Jupyter Notebook
* Numpy, skimage, scipy
* pycocotools, cython

If you use Docker, the model has been verified to work on
[this Docker container](https://hub.docker.com/r/waleedka/modern-deep-learning/).

The package `pycocotools` requires `cython` and a C compiler to install correctly. See below for further instructions.

## Installation
1. Clone this repository
2. Download pre-trained COCO weights from the releases section of this repository.
3. Installing `pycocotools` as follows:
    - On Linux, run `pip install git+https://github.com/waleedka/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI`
    - On Windows, run `pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI`

Note that on Windows, for the avove to work, you must have the Visual C++ 2015 build tools on your path (see [this coco clone](https://github.com/philferriere/cocoapi) for additional details). 

Let me know it you'd like me to PR this.
Thanks again!

Most helpful comment

Hi @Helicqin,

It happens because there is a pycocotools directory in the same folder as the notebooks. The python code being imported then is the local implementation of pycocotools, not the one installed with pip. To fix this issue, move the notebooks tp their own demo directory.

You may want to take a look at https://github.com/philferriere/cocoapi for notebooks that have already been moved but also updated to automatically download data files in the proper folders.

Hope this helps, -- Philippe

All 7 comments

Yes, please! A PR would be great.

Done!

@philferriere Hi, I have done these steps as you said , but an error occurred when I run a pycocotools demo:
ImportError:No module named _mask

I have cloned the github in Ubuntu, and run make in coco/PythonApi/. I think it succeeded although some warning,because I run this:
>>>import pycocotools

And no errors!But when I run the pycocoDemo.ipynb in coco/PythonApi/, an error occurred:
ImportError: No module named _mask

I have searched many websites but no solution,the only one I found linked to the problem is that:
https://github.com/cocodataset/cocoapi/issues/59
which said it is bacause python3 doesn't match with pycocotools. So what do you think of this error?I would appreciate it much for your help. Thank you.

This is my environment:

  • Python3.6

  • TensorFlow 1.3

  • Keras 2.0.8

Hi @Helicqin,

It happens because there is a pycocotools directory in the same folder as the notebooks. The python code being imported then is the local implementation of pycocotools, not the one installed with pip. To fix this issue, move the notebooks tp their own demo directory.

You may want to take a look at https://github.com/philferriere/cocoapi for notebooks that have already been moved but also updated to automatically download data files in the proper folders.

Hope this helps, -- Philippe

@philferriere That works!!!
Thank you very much!!! What you have done is significant for beginners like me.
Best wishes.

Hi @Helicqin

can you please thell me how to do that?
where should i put that pycocotools module

@philferriere I try to runpip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
or run coco\PythonAPI python setup.py build_ext install in Windows10(Python3.5/Anaconda4.5). I am get the same error. Do you have any suggestions?
error message:

D:\cocoapi-master\cocoapi-master\PythonAPI>python setup.py build_ext install
running build_ext
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    ext_modules= ext_modules
  File "C:\Users\stust\Anaconda3\lib\site-packages\setuptools\__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\stust\Anaconda3\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\stust\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\stust\Anaconda3\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\stust\Anaconda3\lib\site-packages\setuptools\command\build_ext.py", line 78, in run
    _build_ext.run(self)
  File "C:\Users\stust\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "C:\Users\stust\Anaconda3\lib\distutils\command\build_ext.py", line 308, in run
    force=self.force)
  File "C:\Users\stust\Anaconda3\lib\distutils\ccompiler.py", line 1031, in new_compiler
    return klass(None, dry_run, force)
  File "C:\Users\stust\Anaconda3\lib\distutils\cygwinccompiler.py", line 285, in __init__
    CygwinCCompiler.__init__ (self, verbose, dry_run, force)
  File "C:\Users\stust\Anaconda3\lib\distutils\cygwinccompiler.py", line 129, in __init__
    if self.ld_version >= "2.10.90":
TypeError: unorderable types: NoneType() >= str()
Was this page helpful?
0 / 5 - 0 ratings