با سلام خدمت اساتید محترم بنده برا ی اجرای کد MaskRCNN مراحل زیر را دنبال کردم
Step 1: create a conda virtual environment with python 3.6
Step 2: install the dependencies
Step 3: Clone the Mask_RCNN repo
Step 4: install pycocotools
Step 5: download the pre-trained weights
Step 6: Test it
Step 1 - Create a conda virtual environment
we will be using Anaconda with python 3.6.
If you don’t have Anaconda, follow this tutorial
https://www.youtube.com/watch?v=T8wK5loXkXg
run this command in a CMD window
conda create -n MaskRCNN python=3.6 pip
1
Step 2 - Install the Dependencies
place the requirements.txt in your cwdir
https://github.com/markjay4k/Mask-RCNN-series/blob/master/requirements.txt
run these commands
actvitate MaskRCNN
pip install -r requirements.txt
1
2
NOTE: we’re installing these (tf-gpu requires some pre-reqs)
numpy, scipy, cython, h5py, Pillow, scikit-image,
tensorflow-gpu==1.5, keras, jupyter
Step 3 - Clone the Mask RCNN Repo
Run this command
git clone https://github.com/matterport/Mask_RCNN.git
1
Step 4 - Install pycocotools
NOTE: pycocotools requires Visual C++ 2015 Build Tools
download here if needed http://landinghub.visualstudio.com/visual-cpp-build-tools
clone this repo
git clone https://github.com/philferriere/cocoapi.git
1
use pip to install pycocotools
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
1
Step 5 - Download the Pre-trained Weights
Go here https://github.com/matterport/Mask_RCNN/releases
download the mask_rcnn_coco.h5 file
place the file in the Mask_RCNN directory
Step 6 - Let’s Test it!
open up the demo.ipynb and run it
ولی در مرحله 4 وقتی دستور pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
رو اجرا می کنم با خطای زیر مواجه میشم
(MaskRCNN) C:\Users\10\Documents>pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Collecting git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Cloning https://github.com/philferriere/cocoapi.git to c:\users\10\appdata\local\temp\pip-req-build-davgk179
Building wheels for collected packages: pycocotools
Running setup.py bdist_wheel for pycocotools ... error
Complete output from command C:\Users\10\Anaconda3\envs\MaskRCNN\python.exe -u -c "import setuptools, tokenize;file='C:\Users\10\AppData\Local\Temp\pip-req-build-davgk179\PythonAPI\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d C:\Users\10\AppData\Local\Temp\pip-wheel-z18_4n_0 --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools__init__.py -> build\lib.win-amd64-3.6\pycocotools
running build_ext
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\pycocotools
creating build\temp.win-amd64-3.6\common
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\10\Anaconda3\envs\MaskRCNN\lib\site-packages\numpy\core\include -I../common -IC:\Users\10\Anaconda3\envs\MaskRCNN\include -IC:\Users\10\Anaconda3\envs\MaskRCNN\include /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj
_mask.c
c:\users\10\anaconda3\envs\maskrcnn\include\pyconfig.h(59) : fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\cl.exe' failed with exit status 2
Failed building wheel for pycocotools
Running setup.py clean for pycocotools
Complete output from command C:\Users\10\Anaconda3\envs\MaskRCNN\python.exe -u -c "import setuptools, tokenize;file='C:\Users\10\AppData\Local\Temp\pip-req-build-davgk179\PythonAPI\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" clean --all:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\10\AppData\Local\Temp\pip-req-build-davgk179\PythonAPI\setup.py", line 25, in <module>
cythonize(ext_modules)
File "C:\Users\10\Anaconda3\envs\MaskRCNN\lib\site-packages\Cython\Build\Dependencies.py", line 897, in cythonize
aliases=aliases)
File "C:\Users\10\Anaconda3\envs\MaskRCNN\lib\site-packages\Cython\Build\Dependencies.py", line 777, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
File "C:\Users\10\Anaconda3\envs\MaskRCNN\lib\site-packages\Cython\Build\Dependencies.py", line 102, in nonempty
raise ValueError(error_msg)
ValueError: 'pycocotools/_mask.pyx' doesn't match any files
Failed cleaning build dir for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
Running setup.py install for pycocotools ... error
Complete output from command C:\Users\10\Anaconda3\envs\MaskRCNN\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\10\\AppData\\Local\\Temp\\pip-req-build-davgk179\\PythonAPI\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\10\AppData\Local\Temp\pip-record-lfqefmnl\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
running build_ext
building 'pycocotools._mask' extension
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\10\Anaconda3\envs\MaskRCNN\lib\site-packages\numpy\core\include -I../common -IC:\Users\10\Anaconda3\envs\MaskRCNN\include -IC:\Users\10\Anaconda3\envs\MaskRCNN\include /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj
_mask.c
c:\users\10\anaconda3\envs\maskrcnn\include\pyconfig.h(59) : fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "C:\Users\10\Anaconda3\envs\MaskRCNN\python.exe -u -c "import setuptools, tokenize;file='C:\Users\10\AppData\Local\Temp\pip-req-build-davgk179\PythonAPI\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\10\AppData\Local\Temp\pip-record-lfqefmnl\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\10\AppData\Local\Temp\pip-req-build-davgk179\PythonAPI