1.下载安装Anaconda
https://www.anaconda.com/products/individual
2.配置tensorflow-keras环境
conda create –n tensorflow-gpu python=3.6
activate tensorflow-gpu
pip install tensorflow-gpu==1.13.2
pip install keras==2.1.5
3.配置mask rcnn依赖环境
3.1安装skimage
pip install scikit-image==0.15.0
3.2安装matplotlib
pip install matplotlib
3.3安装opencv
conda install opencv==3.4.2
3.4安装imgaug
pip install imgaug
3.5安装pycocotools
3.5.1下载
https://github.com/philferriere/cocoapi下载源码,下载位置任意,并进行解压。打开 conda prompt 终端,并切换到cocoapi\PythonAPI目录下
3.5.2运行指令
# install pycocotools locally (先这一条,结束后再下一条)
python setup.py build_ext --inplace
# install pycocotools to the Python site-packages
python setup.py build_ext install
3.5.3可能出现的问题
(1)No module named 'Cython'
pip install Cython --install-option="--no-cython-compile"
(2)No module named 'cv2.cv2'
因为装的opencv是4.0.2版本的
卸载重装为3.4.2版本
https://stackoverflow.com/questions/55360459/no-module-named-cv2-cv2
(3)No module named 'pycocotools._mask'
https://www.twblogs.net/a/5ca71e63bd9eee59d33308d5/zh-cn
完成上述安装与配置,将pycocotools复制到项目路径下
(4)有效解决出现AttributeError: module 'labelme.utils' has no attribute 'draw_label'错误
换labelme版本
(5)AttributeError: 'Model' object has no attribute 'metrics_tensors'