TensorFlow_Faster_RCNN in demo.py run (CPU Only)


GitHub project address, https://github.com/endernewton/tf-faster-rcnn
Tensorflow Faster RCNN for Object Detection .

Native environment:

  • Mac: 10.13.4 no GPU
  • python: 3.5
  • tensorflow: 1.11.0
1
git clone https://github.com/endernewton/tf-faster-rcnn.git

2. Modify the code for the CPU Only

① modified ./lib/setup.py
commented on 55,87,120-136 row cuda, GPU related code



②. / Lib / model / nms_wrapper.py
commented first row 12,20-21

3. Establish Cython module directory under ./lib

Clear a compiler generates executable file (.pyc, .so)

1
make clean

If the compiler error successful. .So file will be generated, " pycache .pyc file under"

1
make 

Back to previous

1
cd ..

4. Install Python COCO API at ./data

1
2
3
4
git clone https://github.com/pdollar/coco.git
cd coco/PythonAPI
make
cd ../../..

5. Download Data

setup VOC and COCO datasets (Part of COCO is done)

. 1 
2
. 3
. 4
. 5
. 6
. 7
. 8
. 9
10
. 11
Big 12 column   TensorFlow_Faster_RCNN in demo.py run (Only the CPU) PAN>
13 is
14
cd ./data


wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCdevkit_08-Jun-2007.tar

# ./Data/VOCdevkit/ the extract to
the tar-xvf VOCtrainval_06-Nov-2007.tar
the tar-xvf VOCtest_06-Nov-2007.tar
the tar-xvf VOCdevkit_08 On Jun-2007.tar

# Create a soft link
ln -s VOCdevkit VOCdevkit2007

After completing the above steps, data folder add two folders:

  • VOCdevkit (contains folders VOCcode, VOC2007 and some other files)
  • VOCdevkit2007 (soft link, when clicked, jump to ./data/VOCdevkit/)

6. Download the pre-training model

.sh file ./data/scripts/ under the URL can not access can be provided by the author Google Drive downloads.
Select voc_0712_80k-110k.tgz res101 is downloaded to ./data in.

7. Establish a pre-training model of soft link

1
2
3
4
5
6
NET=res101
TRAIN_IMDB=voc_2007_trainval+voc_2012_trainval
mkdir -p output/${NET}/${TRAIN_IMDB}
cd output/${NET}/${TRAIN_IMDB}
ln -s ../../../data/voc_2007_trainval+voc_2012_trainval ./default
cd ../../..

It features 6 lines of code is:
① create folders = ./output/res101/voc_2007_trainval+voc_2012_trainval/ NewDir
$ ② in the new folder {NewDir} pre-training model / default download link, that ./data/voc_2007_trainval + voc_2012_trainval in 4 parameter files
this time, click ./output/vgg16/coco_2014_train+coco_2014_valminusminival/default can jump to ./data/coco_2014_train+coco_2014_valminusminival four parameters file

8. Run ./tools/demo.py

Under the picture ./data/demo to detect


the main subject and confidence probability get the picture:

Guess you like

Origin www.cnblogs.com/lijianming180/p/12326825.html