Caffe: Caffe doest not build with opencv 4.0.1

Created on 28 Dec 2018  ·  6Comments  ·  Source: BVLC/caffe

Issue summary

Caffe doest not build with opencv 4.0.1 (which is the latest opencv at the time of writing). This was identified as part of Homebrew testing: https://github.com/Homebrew/homebrew-core/pull/35521/files

Steps to reproduce

  1. Doc for caffe 1.0 says:

    Optional dependencies:

    • OpenCV >= 2.4 including 3.0
  2. Compile with: cmake . -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/caffe/1.0_8 -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DALLOW_LMDB_NOLOCK=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_docs=OFF -DBUILD_matlab=OFF -DBUILD_python=OFF -DBUILD_python_layer=OFF -DCPU_ONLY=ON -DUSE_LEVELDB=ON -DUSE_LMDB=ON -DUSE_NCCL=OFF -DUSE_OPENCV=ON -DUSE_OPENMP=OFF && make install

  3. OpenCV is correctly identified:

18:16:47 -- ******************* Caffe Configuration Summary *******************
18:16:47 -- General:
18:16:47 --   Version           :   1.0.0
18:16:47 --   Git               :   unknown
18:16:47 --   System            :   Darwin
18:16:47 --   C++ compiler      :   /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang++
18:16:47 --   Release CXX flags :   -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
18:16:47 --   Debug CXX flags   :   -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
18:16:47 --   Build type        :   Release
18:16:47 -- 
18:16:47 --   BUILD_SHARED_LIBS :   ON
18:16:47 --   BUILD_python      :   OFF
18:16:47 --   BUILD_matlab      :   OFF
18:16:47 --   BUILD_docs        :   OFF
18:16:47 --   CPU_ONLY          :   ON
18:16:47 --   USE_OPENCV        :   ON
18:16:47 --   USE_LEVELDB       :   ON
18:16:47 --   USE_LMDB          :   ON
18:16:47 --   USE_NCCL          :   OFF
18:16:47 --   ALLOW_LMDB_NOLOCK :   OFF
18:16:47 -- 
18:16:47 -- Dependencies:
18:16:47 --   BLAS              :   Yes (vecLib)
18:16:47 --   Boost             :   Yes (ver. 1.68)
18:16:47 --   glog              :   Yes
18:16:47 --   gflags            :   Yes
18:16:47 --   protobuf          :   Yes (ver. 3.6.1)
18:16:47 --   lmdb              :   Yes (ver. 0.9.23)
18:16:47 --   LevelDB           :   Yes (ver. 1.20)
18:16:47 --   Snappy            :   Yes (ver. 1.1.7)
18:16:47 --   OpenCV            :   Yes (ver. 4.0.1)
18:16:47 --   CUDA              :   No
  1. But the build fails nonetheless:
18:16:47 /tmp/caffe-20181228-53962-vg617x/caffe-1.0/src/caffe/layers/window_data_layer.cpp:293:42: error: use of undeclared identifier 'CV_LOAD_IMAGE_COLOR'
18:16:47         cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);
18:16:47                                          ^
18:16:47 1 error generated.

Tried solutions

System configuration

  • Operating system: macOS 10.12 to 10.14
  • Compiler: clang from Apple Xcode
  • BLAS: Apple's system blas library

Issue checklist

  • [X] read the guidelines and removed the first paragraph
  • [X] written a short summary and detailed steps to reproduce
  • [X] explained how solutions to related problems failed (tick if found none)
  • [X] filled system configuration
  • [X] attached relevant logs/config files (tick if not applicable)

Most helpful comment

All 6 comments

I opened #6638, and I built it passed all the tests. Tell me if it doesn't work in any cases. I'll try to fix it.

Is the project alive?

I personally forked it with my #6638 patch added. Feel free to try it out. [https://github.com/xlert/caffe]

let me know if there is any issues.

what if I don't build with opencv?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamhankai picture iamhankai  ·  3Comments

sdemyanov picture sdemyanov  ·  3Comments

prathmeshrmadhu picture prathmeshrmadhu  ·  3Comments

Ruhjkg picture Ruhjkg  ·  3Comments

kelvinxu picture kelvinxu  ·  3Comments