LoginSignup
0
0

More than 5 years have passed since last update.

DeepCascadeモデルをインストールする(2)

Last updated at Posted at 2016-11-12

はじめに

前回
http://qiita.com/masataka46/items/61032ba4470e35557389
に続き、DeepCascadeモデルをインストールする。

環境

Ubuntu14.04
chainerやTensorflowが走る程度に諸々のlibrariesをインストール済み

compile step3

step2はCPUのみで走らせたが、ここからはGPUを使う。

cd ../objects_detection
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . && make -j2
.....
.....                   ^
/../../../src/objects_detection/GpuVeryFastIntegralChannelsDetector.hpp:10:28: fatal error: classification.h: そのようなファイルやディレクトリはありません
 #include "classification.h"
.....
.....
make[2]: *** [CMakeFiles/cpp_stuff_library.dir/ObjectsDetectionGui.cpp.o] エラー 1
make[1]: *** [CMakeFiles/cpp_stuff_library.dir/all] エラー 2
make[1]: *** 未完了のジョブを待っています....
.....
.....
[  4%] Built target cuda_stuff_library
make: *** [all] エラー 2

エラーが出た。はじめにGpuVeryFastIntegralChannelsDetector.hpp内の#include "classification.h"部分でそれに相当するファイルが無いと言っている。

調べてみると、GpuVeryFastIntegralChannelsDetector.hppと同じディレクトリにはなく、cnn/classification.hの位置にあるので

GpuVeryFastIntegralChannelsDetector.hpp
#include "classification.h"

GpuVeryFastIntegralChannelsDetector.hpp
#include "cnn/classification.h"

に変更し、再度make -j2を実行。今度は以下のようなエラーとなった。

make -j2
.....
.....
/../../../src/objects_detection/cnn/classification.h:1:27: fatal error: caffe/caffe.hpp: そのようなファイルやディレクトリはありません
 #include <caffe/caffe.hpp>
.....
.....
make[1]: *** [CMakeFiles/cpp_stuff_library.dir/all] エラー 2
make: *** [all] エラー 2

requirementsには一言も書かれていなかったが、caffeが必要なのか?以前、caffeのインストールを途中で挫折しているので、再度やり直した。
http://qiita.com/masataka46/items/ac22818aac89f9c9dd0e

しかしやっぱりcaffe/caffe.hppがないと言ってくる。caffeをイレギュラーな場所にインストールしたので、caffeへのパスが通ってないのか?

そこで.bashrcに以下を追加

export PATH=/media/ohmasa/'several data'/home/ohmasa/caffe/caffe/include:$PATH
export CPLUS_INCLUDE_PATH=/media/ohmasa/'several data'/home/ohmasa/caffe/caffe/include:$CPLUS_INCLUDE_PATH

再びmake -j4としたが、今後はcaffe/proto/caffe.ph.hが無いと言ってきた。確かにprotoディレクトリは別の場所にあったので、caffeルートにコピー。

再度makeした。

make -j4
.....
.....
Linking CXX static library libcpp_stuff_library.a
[ 99%] Built target cpp_stuff_library
Scanning dependencies of target objects_detection
[100%] Building CXX object CMakeFiles/objects_detection.dir/objects_detection.cpp.o
.....
.....
Linking CXX executable objects_detection
libcpp_stuff_library.a(GpuVeryFastIntegralChannelsDetector.cpp.o): 関数 `doppia::GpuVeryFastIntegralChannelsDetector::compute_v2()' 内:
/media/ohmasa/several data/home/ohmasa/Pedestrian/model/DeepCascade/src/objects_detection/GpuVeryFastIntegralChannelsDetector.cpp:875: `Classifier::Classify(cv::Mat const&, int)' に対する定義されていない参照です
.....
.....
collect2: error: ld returned 1 exit status
make[2]: *** [objects_detection] エラー 1
make[1]: *** [CMakeFiles/objects_detection.dir/all] エラー 2
make: *** [all] エラー 2

100%まではいったが、その直後に「〜に対する定義されていない参照です」という表示が複数続き、最終的にエラーが表示された。

そもそもcmakeの段階で以下のように

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo .
.....
.....
CMake Warning at CMakeLists.txt:62 (find_package):
  By not providing "FindCaffe.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Caffe", but
  CMake did not find one.

  Could not find a package configuration file provided by "Caffe" with any of
  the following names:

    CaffeConfig.cmake
    caffe-config.cmake

  Add the installation prefix of "Caffe" to CMAKE_PREFIX_PATH or set
  "Caffe_DIR" to a directory containing one of the above files.  If "Caffe"
  provides a separate development package or SDK, be sure it has been
  installed.
.....
.....

などと表示されていることが問題だろうか?

そこで別のディレクトリにCaffeをCmakeで入れなおした
http://qiita.com/masataka46/items/7e1033012749b43247cc
ところ、CaffeConfig.cmakecaffe-config.cmakが作成された。改めてPATHを設定する。

export PYTHONPATH=/home/USER/work/caffe/build/caffe/python/:$PYTHONPATH
export PATH=/home/USER/work/caffe/build/caffe/include:$PATH
export PATH=/home/USER/work/caffe/build/caffe/:$PATH
export CPLUS_INCLUDE_PATH=/home/USER/work/caffe/build/caffe/include:$CPLUS_INCLUDE_PATH

再度Cmakeする。

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo .
.....
.....
CMake Warning (dev) at /home/ohmasa/work/caffe/build/caffe/CaffeConfig.cmake:22 (if):
  given arguments:

    "ON"

  An argument named "ON" appears in a conditional statement.  Policy CMP0012
  is not set: if() recognizes numbers and boolean constants.  Run "cmake
  --help-policy CMP0012" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.
Call Stack (most recent call first):
  CMakeLists.txt:62 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.
......
......

またWarningが出たが、developerに対するWarningとなっているので、大丈夫なのだろうか?

make -j4したが、やはり100%の後に「〜に対する定義されていない参照です」と表示される。

エラーのほとんどは

...../GpuVeryFastIntegralChannelsDetector.cpp:875: `Classifier::Classify(cv::Mat const&, int)' に対する定義されていない参照です

とある。中々エラーが改善されない。そこで次回は方針を変更する。

DeepCascadeモデルをインストールする(3)
http://qiita.com/masataka46/items/acf698e8f169cabae7fb

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0