下丸子のコネクショニスト

機械学習、人工知能などの話題について触れます。

SSD: Single Shot MultiBox Detector Caffe Install Log on Ubuntu 14.04 LTS with GTX 1050Ti

f:id:yukisaito:20170529015409p:plain

(visualization results on the video streaming)

 

Single Shot MultiBox Detector (SSD)

[1512.02325] SSD: Single Shot MultiBox Detector

is faster than faster R-CNN, described in : page 42 of

www.slideshare.net

I tried to install SSD caffe on Ubuntu 14.04 LTS with GTX 1050Ti.

My CUDA version is 8.0 and cuDNN is 6.0.

 

First of all, install prerequired softwares of official BLVC caffe:

Caffe | Deep Learning Framework

and opencv with ffmpeg on python (cv2).

 

Following author's readme,

github.com

git clone https://github.com/weiliu89/caffe.git

mv caffe SSD

cd SSD

git checkout ssd

here, I define this SSD folder as $SSD.

Copy Makefile.config from your latest caffe folder to the $SSD.

mkdir $SSD/build

cd $SSD/build

cmake ..

make all -j8

then I got errors *1

 

For update the repo, I tried to merge newer caffe following by:

hirotaka-hachiya.hatenablog.com

cd $SSD

git remote add caffe https://github.com/BVLC/caffe.git

git fetch caffe

git merge -X theirs caffe/master

cd build

rm -rf *

# Note that following steps were not correct! It may cause errors while running sample codes.

cmake ..

make all -j8

make install -j8

make pycaffe -j8

make runtest -j8

 

Let's try to evaluate the trained model.

Downdload the model files:

models_VGGNet_VOC0712_SSD_300x300.tar.gz - Google ドライブ

export CAFFE_ROOT=$SSD

export PYTHONPATH=$SSD/python/:$PYTHONPATH

cd $SSD

tar xvf models_VGGNet_VOC0712_SSD_300x300.tar.gz(downloaded model files)

python examples/ssd/ssd_pascal_video.py

 However, I got errors *2

I think this error is caused by overwriting "$SSD/python/caffe/net_spec.py" with git merge. So I just replaced merged "$SSD/python/caffe/net_spec.py" with "https://github.com/weiliu89/caffe/blob/ssd/python/caffe/net_spec.py", and tried to build SSD caffe again.

cd $SSD/build

rm -rf *

cmake ..

make all -j8

make install -j8

make pycaffe -j8

make runtest -j8

cd $SSD

python examples/ssd/ssd_pascal_video.py

Then I got visualization of SSD results on the sample video!

f:id:yukisaito:20170529015409p:plain

 

For training/evaluation, follow "Preparation" and "Train/Eval"of

https://github.com/weiliu89/caffe/tree/ssd

 

 

*1:/home/caffe/SSD/include/caffe/util/cudnn.hpp(112): error: too few arguments in function call
/home/caffe/SSD/include/caffe/util/cudnn.hpp(112): error: too few arguments in function call
/home/caffe/SSD/include/caffe/util/cudnn.hpp(112): error: too few arguments in function call
/home/caffe/SSD/include/caffe/util/cudnn.hpp(112): error: too few arguments in function call
1 error detected in the compilation of "/tmp/tmpxft_00007bb9_00000000-5_rmsprop_solver.cpp4.ii".
/home/caffe/SSD/include/caffe/util/cudnn.hpp(112): error: too few arguments in function call
/home/caffe/SSD/include/caffe/util/cudnn.hpp(112): error: too few arguments in function call
1 error detected in the compilation of "/tmp/tmpxft_00007ba6_00000000-5_adagrad_solver.cpp4.ii".
CMake Error at cuda_compile_generated_rmsprop_solver.cu.o.cmake:264 (message):
  Error generating file
  /home/caffe/SSD/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_rmsprop_solver.cu.o
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/solvers/cuda_compile_generated_rmsprop_solver.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
1 error detected in the compilation of "/tmp/tmpxft_00007baa_00000000-5_nesterov_solver.cpp4.ii".
CMake Error at cuda_compile_generated_adagrad_solver.cu.o.cmake:264 (message):
  Error generating file
  /home/caffe/SSD/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_adagrad_solver.cu.o
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/solvers/cuda_compile_generated_adagrad_solver.cu.o] Error 1
CMake Error at cuda_compile_generated_nesterov_solver.cu.o.cmake:264 (message):
  Error generating file
  /home/caffe/SSD/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_nesterov_solver.cu.o
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/solvers/cuda_compile_generated_nesterov_solver.cu.o] Error 1
1 error detected in the compilation of "/tmp/tmpxft_00007bb8_00000000-5_adadelta_solver.cpp4.ii".
/home/caffe/SSD/include/caffe/util/cudnn.hpp(112): error: too few arguments in function call
CMake Error at cuda_compile_generated_adadelta_solver.cu.o.cmake:264 (message):
  Error generating file
  /home/caffe/SSD/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_adadelta_solver.cu.o
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/solvers/cuda_compile_generated_adadelta_solver.cu.o] Error 1
1 error detected in the compilation of "/tmp/tmpxft_00007bb7_00000000-5_adam_solver.cpp4.ii".
1 error detected in the compilation of "/tmp/tmpxft_00007bcc_00000000-5_sgd_solver.cpp4.ii".
CMake Error at cuda_compile_generated_adam_solver.cu.o.cmake:264 (message):
  Error generating file
  /home/caffe/SSD/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_adam_solver.cu.o
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/solvers/cuda_compile_generated_adam_solver.cu.o] Error 1
CMake Error at cuda_compile_generated_sgd_solver.cu.o.cmake:264 (message):
  Error generating file
  /home/caffe/SSD/build/src/caffe/CMakeFiles/cuda_compile.dir/solvers/./cuda_compile_generated_sgd_solver.cu.o
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/solvers/cuda_compile_generated_sgd_solver.cu.o] Error 1
1 error detected in the compilation of "/tmp/tmpxft_00007bd2_00000000-5_sigmoid_cross_entropy_loss_layer.cpp4.ii".
CMake Error at cuda_compile_generated_sigmoid_cross_entropy_loss_layer.cu.o.cmake:264 (message):
  Error generating file
  /home/caffe/SSD/build/src/caffe/CMakeFiles/cuda_compile.dir/layers/./cuda_compile_generated_sigmoid_cross_entropy_loss_layer.cu.o
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/layers/cuda_compile_generated_sigmoid_cross_entropy_loss_layer.cu.o] Error 1
/home/caffe/SSD/include/caffe/util/cudnn.hpp(112): error: too few arguments in function call
1 error detected in the compilation of "/tmp/tmpxft_00007bdc_00000000-5_math_functions.cpp4.ii".
CMake Error at cuda_compile_generated_math_functions.cu.o.cmake:264 (message):
  Error generating file
  /home/caffe/SSD/build/src/caffe/CMakeFiles/cuda_compile.dir/util/./cuda_compile_generated_math_functions.cu.o
make[2]: *** [src/caffe/CMakeFiles/cuda_compile.dir/util/cuda_compile_generated_math_functions.cu.o] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

*2:python examples/ssd/ssd_pascal_video.py
Traceback (most recent call last):
  File "examples/ssd/ssd_pascal_video.py", line 87, in <module>
    conf_loss_type = P.MultiBoxLoss.SOFTMAX
  File "/home/caffe/SSD/python/caffe/net_spec.py", line 240, in __getattr__
    return getattr(getattr(caffe_pb2, name + 'Parameter'), param_name)
AttributeError: 'module' object has no attribute 'MultiBoxLossParameter'