Caffe for Jetson TX2 with Jetpack 4.3

Hello Dear community

I’ve installed the latest jetpack to my Jetson Tx2 (4.3).
When I was installing Caffe from JetHacks https://www.jetsonhacks.com/2017/03/24/caffe-deep-learning-framework-nvidia-jetson-tx2/

But I have errors like this:

Scanning dependencies of target caffe
[  2%] Building CXX object src/caffe/CMakeFiles/caffe.dir/layers/window_data_layer.cpp.o
[  3%] Building CXX object src/caffe/CMakeFiles/caffe.dir/solvers/nesterov_solver.cpp.o
[  3%] Building CXX object src/caffe/CMakeFiles/caffe.dir/solvers/rmsprop_solver.cpp.o
[  3%] Building CXX object src/caffe/CMakeFiles/caffe.dir/syncedmem.cpp.o
[  4%] Building CXX object src/caffe/CMakeFiles/caffe.dir/solvers/sgd_solver.cpp.o
[  4%] Building CXX object src/caffe/CMakeFiles/caffe.dir/util/benchmark.cpp.o
/home/nvidia/caffe/src/caffe/layers/window_data_layer.cpp: In member function ‘virtual void caffe::WindowDataLayer<Dtype>::load_batch(caffe::Batch<Dtype>*)’:
/home/nvidia/caffe/src/caffe/layers/window_data_layer.cpp:293:42: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
         cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);
                                          ^~~~~~~~~~~~~~~~~~~
/home/nvidia/caffe/src/caffe/layers/window_data_layer.cpp:293:42: note: suggested alternative: ‘CV_IS_IMAGE_HDR’
         cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);
                                          ^~~~~~~~~~~~~~~~~~~
                                          CV_IS_IMAGE_HDR
src/caffe/CMakeFiles/caffe.dir/build.make:39377: recipe for target 'src/caffe/CMakeFiles/caffe.dir/layers/window_data_layer.cpp.o' failed
make[3]: *** [src/caffe/CMakeFiles/caffe.dir/layers/window_data_layer.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:272: recipe for target 'src/caffe/CMakeFiles/caffe.dir/all' failed
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[  4%] Linking CXX static library ../../lib/libgtest.a
[  4%] Built target gtest
CMakeFiles/Makefile2:372: recipe for target 'src/caffe/test/CMakeFiles/runtest.dir/rule' failed
make[1]: *** [src/caffe/test/CMakeFiles/runtest.dir/rule] Error 2
Makefile:255: recipe for target 'runtest' failed
make: *** [runtest] Error 2

Is there another way to install caffe in Jetson TX2 with jetpack 4.3??

I tried to follow https://devtalk.nvidia.com/default/topic/1050177/jetson-tx2/caffe-for-jetson-tx2-with-jetpack-4-2/1
(Posted 04/24/2019 05:56 AM by AastaLLL)

However when I tried to excute below command,

make -j4

I have errors like this:

./include/caffe/data_transformer.hpp:4:10: fatal error: opencv2/core/core.hpp: No such file or directory
 #include <opencv2/core/core.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:623: recipe for target '.build_release/cuda/src/caffe/layers/softmax_loss_layer.o' failed
make: *** [.build_release/cuda/src/caffe/layers/softmax_loss_layer.o] Error 1

Please help.

Hi,

The error indicates that Caffe cannot find the OpenCV package in your environment.

fatal error: opencv2/core/core.hpp: No such file or directory

The pre-installed OpenCV package in JetPack4.3 is v4.1.1 but Caffe still use OpenCV 3.x.
So it’s recommended to build OpenCV 3.x with following script first to fix this issue.
https://github.com/AastaNV/JEP/blob/276306e052aba5ff131d6e785960abbb187bacde/script/install_opencv3.4.0_TX2.sh

Thanks.