mask rcnn训练coco数据

1. 首先克隆mask r-cnn的代码仓库。

git clone git@github.com:matterport/Mask_RCNN.git

2.

cd Mask_RCNN
pip3 install -r requirements.txt

3.build

python3.5 setup.py install

出现错误:

running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/test-easy-install-24961.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python3.5/dist-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.

解决:加上sudo

sudo python3.5 setup.py install

4.下载预训练模型mask_rcnn_coco.h5.https://github.com/matterport/Mask_RCNN/releases

5安装pycocotools

1.git clone https://github.com/pdollar/coco
2.cd coco/PythonAPI
make -j8

出现错误:

python setup.py build_ext --inplace
running build_ext
building 'pycocotools._mask' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/home/amax/.local/lib/python2.7/site-packages/numpy/core/include -I../common -I/usr/include/python2.7 -c ../common/maskApi.c -o build/temp.linux-x86_64-2.7/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
../common/maskApi.c: In function ‘rleToBbox’:
../common/maskApi.c:141:31: warning: ‘xp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       if(j%2==0) xp=x; else if(xp<x) { ys=0; ye=h-1; }
                               ^
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/home/amax/.local/lib/python2.7/site-packages/numpy/core/include -I../common -I/usr/include/python2.7 -c pycocotools/_mask.c -o build/temp.linux-x86_64-2.7/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
x86_64-linux-gnu-gcc: error: pycocotools/_mask.c: 没有那个文件或目录
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 1

解决:

sudo python3.5 setup.py build_ext
running build_ext
skipping 'pycocotools/_mask.c' Cython extension (up-to-date)
running install
running bdist_egg
running egg_info
creating pycocotools.egg-info
writing dependency_links to pycocotools.egg-info/dependency_links.txt
writing requirements to pycocotools.egg-info/requires.txt
writing top-level names to pycocotools.egg-info/top_level.txt
writing pycocotools.egg-info/PKG-INFO
writing manifest file 'pycocotools.egg-info/SOURCES.txt'
reading manifest file 'pycocotools.egg-info/SOURCES.txt'
writing manifest file 'pycocotools.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying pycocotools/coco.py -> build/lib.linux-x86_64-3.5/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-3.5/pycocotools
copying pycocotools/__init__.py -> build/lib.linux-x86_64-3.5/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-3.5/pycocotools
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/pycocotools
copying build/lib.linux-x86_64-3.5/pycocotools/coco.py -> build/bdist.linux-x86_64/egg/pycocotools
copying build/lib.linux-x86_64-3.5/pycocotools/mask.py -> build/bdist.linux-x86_64/egg/pycocotools
copying build/lib.linux-x86_64-3.5/pycocotools/__init__.py -> build/bdist.linux-x86_64/egg/pycocotools
copying build/lib.linux-x86_64-3.5/pycocotools/_mask.cpython-35m-x86_64-linux-gnu.so -> build/bdist.linux-x86_64/egg/pycocotools
copying build/lib.linux-x86_64-3.5/pycocotools/cocoeval.py -> build/bdist.linux-x86_64/egg/pycocotools
byte-compiling build/bdist.linux-x86_64/egg/pycocotools/coco.py to coco.cpython-35.pyc
byte-compiling build/bdist.linux-x86_64/egg/pycocotools/mask.py to mask.cpython-35.pyc
byte-compiling build/bdist.linux-x86_64/egg/pycocotools/__init__.py to __init__.cpython-35.pyc
byte-compiling build/bdist.linux-x86_64/egg/pycocotools/cocoeval.py to cocoeval.cpython-35.pyc
creating stub loader for pycocotools/_mask.cpython-35m-x86_64-linux-gnu.so
byte-compiling build/bdist.linux-x86_64/egg/pycocotools/_mask.py to _mask.cpython-35.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pycocotools.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pycocotools.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pycocotools.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pycocotools.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pycocotools.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
pycocotools.__pycache__._mask.cpython-35: module references __file__
creating dist
creating 'dist/pycocotools-2.0-py3.5-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pycocotools-2.0-py3.5-linux-x86_64.egg
creating /usr/local/lib/python3.5/dist-packages/pycocotools-2.0-py3.5-linux-x86_64.egg
Extracting pycocotools-2.0-py3.5-linux-x86_64.egg to /usr/local/lib/python3.5/dist-packages
Adding pycocotools 2.0 to easy-install.pth file

Installed /usr/local/lib/python3.5/dist-packages/pycocotools-2.0-py3.5-linux-x86_64.egg
Processing dependencies for pycocotools==2.0
Searching for matplotlib==3.0.2
Best match: matplotlib 3.0.2
Adding matplotlib 3.0.2 to easy-install.pth file

Using /usr/local/lib/python3.5/dist-packages
Searching for Cython==0.29.1
Best match: Cython 0.29.1
Adding Cython 0.29.1 to easy-install.pth file
Installing cygdb script to /usr/local/bin
Installing cython script to /usr/local/bin
Installing cythonize script to /usr/local/bin

Using /home/amax/.local/lib/python3.5/site-packages
Searching for setuptools==39.1.0
Best match: setuptools 39.1.0
Adding setuptools 39.1.0 to easy-install.pth file
Installing easy_install-3.6 script to /usr/local/bin
Installing easy_install script to /usr/local/bin

Using /usr/local/lib/python3.5/dist-packages
Searching for kiwisolver==1.0.1
Best match: kiwisolver 1.0.1
Adding kiwisolver 1.0.1 to easy-install.pth file

Using /usr/local/lib/python3.5/dist-packages
Searching for pyparsing==2.0.3
Best match: pyparsing 2.0.3
Adding pyparsing 2.0.3 to easy-install.pth file

Using /usr/lib/python3/dist-packages
Searching for cycler==0.10.0
Best match: cycler 0.10.0
Adding cycler 0.10.0 to easy-install.pth file

Using /usr/local/lib/python3.5/dist-packages
Searching for numpy==1.16.3
Best match: numpy 1.16.3
Adding numpy 1.16.3 to easy-install.pth file
Installing f2py script to /usr/local/bin
Installing f2py3 script to /usr/local/bin
Installing f2py3.5 script to /usr/local/bin

Using /usr/local/lib/python3.5/dist-packages
Searching for python-dateutil==2.8.0
Best match: python-dateutil 2.8.0
Adding python-dateutil 2.8.0 to easy-install.pth file

Using /usr/local/lib/python3.5/dist-packages
Searching for six==1.12.0
Best match: six 1.12.0
Adding six 1.12.0 to easy-install.pth file

Using /usr/local/lib/python3.5/dist-packages
Finished processing dependencies for pycocotools==2.0

编译完成后,在PythonAPI文件夹下生成了一个pycocotools文件夹,将此文件夹复制到Mask_RCNN/samples/coco/目录下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值