首发于 ML and NLP

Mask R-CNN TensorFlow 实验

源码

github: github.com/CharlesShang

实验环境

推荐使用:Python2.7+,TensorFlow1.0.0+,cuDNN5.1

我的实验环境:Python3.6(需要修改与Python2版本不兼容的地方),TensorFlow1.1.0 (在TensorFlow1.3.0版本下测试有问题,建议使用1.1.0或1.0.0版本),cuDNN5.1

下载

COCO数据集: mscoco.org/dataset/#

Resnet50: download.tensorflow.org

实验步骤

Step 1: Go to ./libs/datasets/pycocotools and make run,执行命令:

cd ./libs/datasets/pycocotools
make run 

Step 2: Download COCO dataset, place it into ./data, then run python download_and convert_data.py to build tf-records. It takes a while.

COCO dataset在目录中的结构为:

./data
    ./coco
        ./annotations
        ./train2014
        ./val2014

转到FastMaskRCNN-master主目录下,执行命令:

python download_and_convert_data.py

82783 images转换需要很长时间,全部转换成功之后会显示:

Finished converting the coco dataset!

Step 3: Download pretrained resnet50 model, unzip it, and place it into ./data/pretrained_models

Step 4: Go to ./libs and run make

cd libs
make
  • Error 4.1
SyntaxError:Missing parentheses in call to 'print'.

对./libs/setup.py文件line 85进行修改:

print(extra_postargs)
  • Error 4.2
AttributeError:'dict' object has no attribute 'iteritems'

对./libs/setup.py文件line 51进行修改:

for k,v in cudaconfig.items():
  • Error 4.3

可能会报cython相关的错误,忘记保存具体的错误了,安装cython就能解决了。

sudo apt-get install cython

Step 5: Run python train/train.py for training

cd ./train