創建虛擬環境
conda create -n MaskRCNN python=3.6 pip
激活命令:conda activate MaskRCNN
退出命令:conda deactivate
安裝環境(也可根據requiremens.txt文件一鍵安裝)
# 有顯卡使用gpu版,沒顯卡就不要-gpu
# 這個版本配套的是CUDA10.1和cudnn7.6.5
pip install tensorflow-gpu==1.14.0
# 避免多余錯誤使用keras2.2.5
pip install keras-gpu==2.2.5
裝好tensorflow和keras后numpy、scipy之類的包已經順帶裝好了,接下來就是查漏補缺,根據requiremens補充
pip install pillow
pip install cython
pip install matplotlib
#這個推薦pip安裝 conda裝的容易出問題閹割版opencv
pip install opencv-python
pip install h5py
pip install scikit-image
pip install jupyter
pip install install ipython
有一個重點是imgaug這個包,requirements里面沒有說安裝shapely,不裝這個是無法安裝imgaug的
pip install shapely
pip install imgaug
clone MaskRCNN庫(有兩種下載途徑選擇其一)
git clone https://github.com/matterport/Mask_RCNN.git
git clone https://gitee.com/kongmo/Mask_RCNN.git
安裝 pycocotools
(注:需要Visual C++2015 build tools)
最后,安裝pycocotools工具,windows和linux下安裝方法不同,windows下安裝必須要有visual c++2015這個東西,沒有的話可以參考https://github.com/philferriere/cocoapi來安裝vc++2015,必須是在線安裝,有這個之后就能安裝pycocotool了
-
clone pycocotools 庫
git clone https://github.com/philferriere/cocoapi.git
git clone https://gitee.com/ACANX/cocoapi.git
-
使用 pip安裝pycocotools庫
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
pip install git+https://gitee.com/ACANX/cocoapi.git#subdirectory=PythonAPI
下載預訓練權重
官方給出的下載地址:https://github.com/matterport/Mask_RCNN/releases
樣例有一個做氣球和coco數據集的,看名稱就可以簡單分辨,下載對應的就行
下載好的mask_rcnn_coco.h5文件放在項目下文件夾內
測試
-
進入MaskRCNN虛擬環境打開jupyter notebook
-
打開演示文稿
-
執行文件
-
運行目標檢測結果
參考資料
Mask RCNN with Keras and Tensorflow (pt.1) Setup and Installation
【Tensorflow】Windows安裝tensorflow錯誤原因查詢、卸載tensorflow與重新安裝
神經網絡學習小記錄42——windows下的tensorflow-gpu=1.13.2環境配置
干貨:TensorFlow1.2~2.1各個GPU版本CUDA和cuDNN對應版本整理
【實踐】MaskRCNN——01.環境配置(基於Anaconda)
本文由博客群發一文多發等運營工具平台 OpenWrite 發布