tf-faster-rcnn[cpu]实现目标检测(一)项目环境

2018-12-28  本文已影响0人  忘尘谷撑船人

- 下载项目

```

git clone https://github.com/endernewton/tf-faster-rcnn.git

```

- 编译,配置相应的运行环境

- 安装Cpython (这里相应的模块需要根据个人平时的使用下载,有很多的本人电脑已经存在,便没有一一列举出来)

        ```

          sudo apt-get install cpython

          ```

- 修改项目,改为cpu运行

【1】打开lib->fast_rcnn->config.py,查看第236行,将True修改为False.

作用:禁用gpu,使用cpu进行计算

【2】打开lib->fast_rcnn->nms_wrapper.py,进行注释,第12行

【3】打开lib->setup.py,进行注释,第55行,第120-136行

- 进入项目的lib目录中执行```make ```

- 安装Python COCO API,使用coco数据集

```shell

cd data

git clone https://github.com/pdollar/coco.git

cd coco/PythonAPI

make

```

- 运行demo和训练

- 下载预训练模型[voc_0712_80k-110k.tgz](https://pan.baidu.com/s/1kWkF3fT )

放在data文件目录下,解压.

- 建立训练模型的软连接,data文件目录下进行

```shell

NET=res101

TRAIN_IMDB=voc_2007_trainval+voc_2012_trainval

mkdir -p output/${NET}/${TRAIN_IMDB}

cd output/${NET}/${TRAIN_IMDB}

ln -s ../../../voc_2007_trainval+voc_2012_trainval ./default

cd ../../..

```

- 运行demo

data目录文件下

```python

../tools/demo.py

```

上一篇 下一篇

猜你喜欢

热点阅读