代码地址:https://github.com/endernewton/iter-reason
Prerequisites(创建一个虚拟环境,名称自定,python=2.7)
1 Tensorflow, tested with version 1.6 with Ubuntu 16.04, installed with(官方提供的指令,我在Ubuntu主机上可用,在服务器上就安装不了):
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.6.0-cp27-none-linux_x86_64.whl
2 Other packages needed can be installed with pip:
pip install Cython easydict matplotlib opencv-python Pillow pyyaml scipy
#安装opencv时报错,可能是python版本问题,查阅资料进行解决
3 For running COCO, the API can be installed globally:(这一步务必要做,不然在最后训练的时候报错为找不到pycoco.data)any path is okay
mkdir ~/install && cd ~/install
git clone https://github.com/cocodataset/cocoapi.git cocoapi
cd cocoapi/PythonAPI
python setup.py install --user
这是执行完以上操作,生成的安装目录。
Setup and Running
1 Clone the repository.
git clone https://github.com/endernewton/iter-reason.git
cd iter-reason
2 Set up data, here we use ADE20K as an example.(下载解压设置数据集)
mkdir -p data/ADEcd data/ADE
wget -v http://groups.csail.mit.edu/vision/datasets/ADE20K/ADE20K_2016_07_26.zip
tar -xzvf ADE20K_2016_07_26.zip
mv ADE20K_2016_07_26/* ./
rmdir ADE20K_2016_07_26# then get the train/val/test split
wget -v http://xinleic.xyz/data/ADE_split.tar.gz
tar -xzvf ADE_split.tar.gz
rm -vf ADE_split.tar.gzcd ../..
#数据集下载解压的目录如上
3 Set up pre-trained ImageNet models. This is similarly done in tf-faster-rcnn. Here by default we use ResNet-50 as the backbone:
mkdir -p data/imagenet_weights
cd data/imagenet_weights
wget -v http://download.tensorflow.org/models/resnet_v1_50_2016_08_28.tar.gz
tar -xzvf resnet_v1_50_2016_08_28.tar.gz
mv resnet_v1_50.ckpt res50.ckpt
cd ../..
#以上是下载模型路径如图
4 Compile the library (for computing bounding box overlaps).
cd lib
Make
cd ..
编译操作
5 To train and test the reasoning modules (based on ResNet-50):
./experiments/scripts/train_memory.sh [GPU_ID] [DATASET] [MEM] [STEPS] [ITER] # MEM in {local} is the type of reasoning modules to use # Examples:# train on ADE20K on the local spatial memory.
./experiments/scripts/train_memory.sh 0 ade local 28 32
报错:
原因没有权限。
报错:
原因:GPU占用
训练截图:
完成的截图
输出的一些结果示例
备注:如果你在安装环境时遇到了问题,联系我,我把虚拟环境包导给你。发我邮箱20125032@bjtu.edu.cn