tf-faster-rcnn问题与研究总结

github地址:https://github.com/endernewton/tf-faster-rcnn

自己拿来研究时,总结的一些问题:
安装过程报错:
(1).
[root@amax PythonAPI]# make
python setup.py build_ext --inplace
running build_ext
building ‘pycocotools._mask’ extension
error: unknown file type ‘.pyx’ (from ‘pycocotools/_mask.pyx’)
make: *** [all] Error 1
[root@amax PythonAPI]#

解决:下载Pyrex-0.9.9.tar.gz ,并安装。

(2).
[root@amax PythonAPI]# make
python setup.py build_ext --inplace
running build_ext
pyrexc pycocotools/_mask.pyx --> pycocotools/_mask.c
/data/gpu_tf_py2_201812/tf-faster-rcnn/data/coco/PythonAPI/pycocotools/_mask.pyx:42:34: Expected ‘)’
building ‘pycocotools._mask’ extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/lib64/python2.7/site-packages/numpy/core/include -I…/common -I/usr/include/python2.7 -c …/common/maskApi.c -o build/temp.linux-x86_64-2.7/…/common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
…/common/maskApi.c: In function ‘rleToBbox’:
…/common/maskApi.c:141:31: warning: ‘xp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if(j%2==0) xp=x; else if(xp<x) { ys=0; ye=h-1; }
^
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/lib64/python2.7/site-packages/numpy/core/include -I…/common -I/usr/include/python2.7 -c pycocotools/_mask.c -o build/temp.linux-x86_64-2.7/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
gcc: error: pycocotools/_mask.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
error: command ‘gcc’ failed with exit status 4
make: *** [all] Error 1

解决方法:
手动用cython生成_mask.c
cd $FRCN_ROOT/lib/pycocotools
cython _mask.pyx

(3).
[root@amax scripts]# ./fetch_faster_rcnn_models.sh
Downloading Resnet 101 Faster R-CNN models Pret-trained on VOC 07+12 (340M)…
./fetch_faster_rcnn_models.sh: line 30: wget: command not found
Unzipping…
tar (child): voc_0712_80k-110k.tgz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Done. Please run this command again to verify that checksum = cb32e9df553153d311cc5095b2f8c340.

解决方法:
[root@amax scripts]# yum -y install wget

(4).
[root@amax scripts]# ./fetch_faster_rcnn_models.sh
Downloading Resnet 101 Faster R-CNN models Pret-trained on VOC 07+12 (340M)…
–2018-12-28 05:47:51-- http://ladoga.graphics.cs.cmu.edu/xinleic/tf-faster-rcnn/res101/voc_0712_80k-110k.tgz
Resolving ladoga.graphics.cs.cmu.edu (ladoga.graphics.cs.cmu.edu)… 128.2.220.68
Connecting to ladoga.graphics.cs.cmu.edu (ladoga.graphics.cs.cmu.edu)|128.2.220.68|:80… failed: Connection timed out.
Retrying.

解决方法:
网盘中下载:https://pan.baidu.com/s/1kWkF3fT
下载后copy到相应文件夹进行解压:
tar xvf voc_0712_80k-110k.tgz

(5).Create a folder and a soft link to use the pre-trained model
此步骤中,下面命令需要注意相对路径是否正确,如果不正确,链接会红色告警。
ln -s …/…/…/data/voc_2007_trainval+voc_2012_trainval ./default

(6).Demo for testing on custom images
此步骤中,需要注意demo.py的相对路径是否正确,py文件中直接定义了output开头的相对路径,这个命令需要认证核查下。
CUDA_VISIBLE_DEVICES=${GPU_ID} ./tools/demo.py

检测时原理:
对于一幅图像,生成一定数量的anthor,分别生成这个anthor对应的21个类别的分数和边框。对于每个类别的所有边框,进行NMS,获取NMS结果(NMS阈值用的0.3)。然后进行分数阈值过滤,得到最终结果,阈值这里用的0.8。

性能记录:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_41813620/article/details/85590891
今日推荐