maskRCNN 在tensorflow上的实现 在上一篇的已经把相应的环境配置好:
maskRCNN 源码
https://github.com/CharlesShang/FastMaskRCNN
实现环境
建议使用的版本:python2.7,tensorflow-gpu=1.0.1,cuda7.5,cudnn5.1
下载COCO数据集:https://mscoco.org/dataset/#download
Resnet50: https://download.tensorflow.org/models/resnet_v1_50_2016_08_28.tar.gz
实验步骤
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数据集目录设置如下形式:
./data
./coco
./annotations
./train2014
./val2014
转到FastMaskRCNN-master主目录下,执行命令:
python download_and_convert_data.py
转换成功后会是这样的82783张图片 有80类外加一类背景,总有81类
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
/models/resnet_v1_50_2016_08_28.tar.gz
- 错误1:显示输入有错误根据制定的目录修改
SyntaxError:Missing parentheses in call to 'print'.
对./libs/setup.py文件line 85进行修改为如下:
print(extra_postargs)
错误2:错误显示没有属性'iteritems'这个原因是由于该版本所
AttributeError:'dict' object has no attribute 'iteritems'
对./libs/setup.py文件line 51进行修改:
for k,v in cudaconfig.items():
错误3:
ModuleNotFoundError:No module named 'timer'
解决方法:
pip install timer 或者使用conda install timer
错误4:
TabError:inconsistent use of tabs and spaces in indentation
解决方法,修改./libs/layers/sample.py 文件 line 117,118,119的缩进:
错误5:
ValueError:strings_input_producer requires a non-null input tensor
根据报错,可以知道指针指向了空的输入,经过检查,发现可能是路径问题,因此对./libs/datasets/dataset_factory.py的line 17进行修改:
tfrecords = glob.glob('../' + dataset_dir +'/records/' + file_pattern)
错误6:
根据错误提示,可以知道没有找到./data/pretrained_models目录下的resnet_v1_50.ckpt文件,但经过检查之后发现该路径是存在这个文件的,所以应该也是路径使用问题。对./train/train.py的line 141进行修改,改为绝对路径。
checkpoint_path:'/media/ubuntu/office/FastMaskRCNN/data/pretrained_models/resnet_v1_50
错误7:
UnknownError (see above for traceback):NameError: name 'xrange' is not defined
根据错误提示,显示xrange错误,找到xrange()函数出现在./libs/boxes/anchor.py文件中,对line 38进行修改为:
for i in range(ratio_anchors.shape[0])])
train运行中
以上的问题解决了 可以ran了 我计算了一下我的GTX1080TI显卡 一天ran的迭代次数25万次总的要250万次 ,大概要10天左右,今天腊月二十四了 等过年来看train的情况吧。
上一篇对环境的配置的一些介绍:《一 》FasteMaskRCNN-master实验代码实现环境需要