1:fatal error:caffe/proto/caffe.pb.h:no such file or directory
Workaround: Generate Caffe.pb.h and caffe.pb.cc from Caffe/src/caffe/proto/caffe.proto with Protoc
into the Caffe root directory, enter the command:
Protoc Src/caffe/proto/caffe.proto--cpp_out=.
mkdir include/caffe/proto
MV Src/caffe/proto/caffe.pb.h Include/caffe/proto
It's no problem to call again.
2:error: ' Class Caffe::memorydatalayer ' has no member named ' Addmatvector '
Error: ' Cvmattodatum ' is not ' a ' caffe '
This error was reported when loading data into the network using Memorydata because the "USE_OPENCV" was not declared. Looking at memory_data_layer.hpp and io.hpp, you can see that it explicitly contains functions Addmatvector and cvmattodatum, but you need to declare USE_OPENCV before they are visible:
#ifdef USE_OPENCV
virtual void addmatvector (const vector<cv::mat>& mat_vector,
const VECTOR<INT >& labels);
#endif //USE_OPENCV
#ifdef USE_OPENCV
cv::mat readimagetocvmat (const string& filename,
const int height, const int width, const b Ool Is_color);
Cv::mat Readimagetocvmat (const string& filename,
const int height, const int width);
Cv::mat Readimagetocvmat (const string& filename,
const bool is_color);
Cv::mat Readimagetocvmat (const string& filename);
Cv::mat decodedatumtocvmatnative (const datum& Datum);
Cv::mat Decodedatumtocvmat (const datum& Datum, bool is_color);
void Cvmattodatum (const cv::mat& cv_img, datum* Datum);
#endif //USE_OPENCV
Workaround: First of all, confirm that when compiling Caffe, the Makefile.config contains the OpenCV module, namely:
# Uncomment if you ' re using OpenCV 3
opencv_version: = 3
and comment out Use_opencv: = 0:
# Use_opencv: = 0
Second, when you include file memory_data_layer.hpp or IO.HPP, you explicitly declare the macro definition USE_OPENCV above the caller, for example:
#ifndef USE_OPENCV
#define USE_OPENCV
#include <caffe/caffe.hpp>
#include <caffe/layers/ memory_data_layer.hpp>
#include <caffe/util/io.hpp>
#endif
Compile again and solve the problem.