0

当我试图在我的 RHEL 机器上编译 caffe 时,我遇到了这个错误:我确实遵循了这个链接的说明: http: //caffe.berkeleyvision.org/installation.html但它看起来不像工作。有什么帮助吗?谢谢

$make all
CXX src/caffe/data_transformer.cpp
src/caffe/data_transformer.cpp:1:33: warning: opencv2/core/core.hpp: No such file or directory
src/caffe/data_transformer.cpp: In member function ‘void caffe::DataTransformer<Dtype>::Transform(const cv::Mat&, caffe::Blob<Dtype>*)’:
src/caffe/data_transformer.cpp:199: error: invalid use of incomplete type ‘const struct cv::Mat’
./include/caffe/common.hpp:69: error: forward declaration of ‘const struct cv::Mat’
src/caffe/data_transformer.cpp:200: error: invalid use of incomplete type ‘const struct cv::Mat’
./include/caffe/common.hpp:69: error: forward declaration of ‘const struct cv::Mat’
src/caffe/data_transformer.cpp:201: error: invalid use of incomplete type ‘const struct cv::Mat’
./include/caffe/common.hpp:69: error: forward declaration of ‘const struct cv::Mat’
src/caffe/data_transformer.cpp:213: error: invalid use of incomplete type ‘const struct cv::Mat’
./include/caffe/common.hpp:69: error: forward declaration of ‘const struct cv::Mat’
src/caffe/data_transformer.cpp:213: error: ‘CV_8U’ was not declared in this scope
src/caffe/data_transformer.cpp:257: error: ‘Rect’ is not a member of ‘cv’
src/caffe/data_transformer.cpp:257: error: expected ‘;’ before ‘roi’
src/caffe/data_transformer.cpp:258: error: ‘roi’ was not declared in this scope
src/caffe/data_transformer.cpp:264: error: invalid use of incomplete type ‘struct cv::Mat’
./include/caffe/common.hpp:69: error: forward declaration of ‘struct cv::Mat’
src/caffe/data_transformer.cpp:269: error: expected initializer before ‘*’ token
src/caffe/data_transformer.cpp:279: error: ‘ptr’ was not declared in this scope
src/caffe/data_transformer.cpp: In member function ‘void caffe::DataTransformer<Dtype>::Transform(const cv::Mat&, caffe::Blob<Dtype>*) [with Dtype = float]’:
src/caffe/data_transformer.cpp:419:   instantiated from here
src/caffe/data_transformer.cpp:245: error: ‘cv_cropped_img’ has incomplete type
src/caffe/data_transformer.cpp: In member function ‘void caffe::DataTransformer<Dtype>::Transform(const cv::Mat&, caffe::Blob<Dtype>*) [with Dtype = double]’:
src/caffe/data_transformer.cpp:419:   instantiated from here
src/caffe/data_transformer.cpp:245: error: ‘cv_cropped_img’ has incomplete type
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/vector:65,
                 from src/caffe/data_transformer.cpp:4:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_vector.h: In member function ‘size_t std::vector<_Tp, _Alloc>::size() const [with _Tp = cv::Mat, _Alloc = std::allocator<cv::Mat>]’:
src/caffe/data_transformer.cpp:179:   instantiated from ‘void caffe::DataTransformer<Dtype>::Transform(const std::vector<cv::Mat, std::allocator<cv::Mat> >&, caffe::Blob<Dtype>*) [with Dtype = float]’
src/caffe/data_transformer.cpp:419:   instantiated from here
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_vector.h:533: error: invalid use of incomplete type ‘struct cv::Mat’
./include/caffe/common.hpp:69: error: forward declaration of ‘struct cv::Mat’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_vector.h: In member function ‘typename std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::const_reference std::vector<_Tp, _Alloc>::operator[](size_t) const [with _Tp = cv::Mat, _Alloc = std::allocator<cv::Mat>]’:
src/caffe/data_transformer.cpp:192:   instantiated from ‘void caffe::DataTransformer<Dtype>::Transform(const std::vector<cv::Mat, std::allocator<cv::Mat> >&, caffe::Blob<Dtype>*) [with Dtype = float]’
src/caffe/data_transformer.cpp:419:   instantiated from here
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_vector.h:626: error: invalid use of incomplete type ‘struct cv::Mat’
./include/caffe/common.hpp:69: error: forward declaration of ‘struct cv::Mat’
make: *** [.build_release/src/caffe/data_transformer.o] Error 1
4

1 回答 1

0

未安装正确的 opencv。即使你用过 opencv,它也可能是太低的版本。检查 /usr/local/include/opencv2 是否有 core/core.hpp 如警告所说。从http://opencv.org/downloads.html下载类似 2.4.10 的东西并安装它。

于 2015-03-23T09:19:54.873 回答