solver_factory.hpp error: ‘const class caffe::SolverParameter’ has no member named ‘type’
I am working on ubuntu 14 and compiled caffe as described on its official website of Berkely I want to compile my code by including some caffe functions using qmake here is the .pro file
`TEMPLATE = app CONFIG += console c++11 CONFIG -= app_bundle CONFIG -= qt
SOURCES += ../main.cpp
INCLUDEPATH += "pkg-config opencv --cflags" INCLUDEPATH += /home/user1/caffe/src INCLUDEPATH += /usr/include INCLUDEPATH += /home/user1/caffe/build/include INCLUDEPATH += /home/user1/caffe/include INCLUDEPATH += /usr/include/atlas INCLUDEPATH += /usr/include/opencv INCLUDEPATH += /usr/local/cuda/include INCLUDEPATH += /usr/local/include INCLUDEPATH += /usr/include/opencv
LIBS += pkg-config opencv --libs
LIBS += -L/usr/lib/x86_64-linux-gnu/ -lboost_system -lboost_thread -lboost_filesystem -lpthread -lglog -lgflags -lprotobuf -lhdf5_hl -lhdf5 -lhdf5_hl -llmdb -lleveldb -lcuda
LIBS += -L/usr/lib/ -lsnappy -llapack -lcblas -latlas LIBS += -L/home/user1/caffe/build/lib/ -lcaffe LIBS += -L/home/user1/caffe/build/install/lib/ -lcaffe LIBS += -L/home/user1/caffe/build/lib/ -lproto LIBS += -L/usr/local/cuda/lib64/ -lcudart -lcublas -lcurand `
And this is the main file
`#ifdef WITH_PYTHON_LAYER #include "boost/python.hpp" namespace bp = boost::python; #endif
#include <gflags/gflags.h> #include <glog/logging.h>
#include
#include "boost/algorithm/string.hpp" #include "caffe/caffe.hpp" #include "caffe/util/signal_handler.h"
using caffe::Blob; using caffe::Caffe; using caffe::Net; using caffe::Layer; using caffe::Solver; using caffe::shared_ptr; using caffe::string; using caffe::Timer; using caffe::vector; using std::ostringstream;
static void get_gpus(vector
// Device Query: show diagnostic information for a GPU device.
int device_query(string gpu) {
std::cout << "Querying GPUs " << gpu<<std::endl;
vector
// Load the weights from the specified caffemodel(s) into the train and
// test nets.
void CopyLayers(caffe::Solver
// Train / Finetune a model. int train(string solverFile, string weightFile){//,string gpu) { if(solverFile.empty()){ std::cout<<"Need a solver definition to train. "<<std::endl; }
caffe::SolverParameter solver_param;
caffe::ReadSolverParamsFromTextFileOrDie(solverFile, &solver_param);
// If the gpus flag is not provided, allow the mode and device to be set
// in the solver prototxt.
string gpu;
if (gpu.size() == 0 && solver_param.solver_mode() == caffe::SolverParameter_SolverMode_GPU){
if (solver_param.has_device_id()) {
gpu = "" + boost::lexical_cast<string>(solver_param.device_id());
}
else { // Set default GPU if unspecified
gpu = "" + boost::lexical_cast<string>(0);
}
}
vector<int> gpus;
get_gpus(&gpus,gpu);
if (gpus.size() == 0) {
std::cout << "Use CPU."<<std::endl;
Caffe::set_mode(Caffe::CPU);
}
else {
ostringstream s;
for (int i = 0; i < gpus.size(); ++i) {
s << (i ? ", " : "") << gpus[i];
}
LOG(INFO) << "Using GPUs " << s.str();
#ifndef CPU_ONLY cudaDeviceProp device_prop; for (int i = 0; i < gpus.size(); ++i) { cudaGetDeviceProperties(&device_prop, gpus[i]); std::cout << "GPU " << gpus[i] << ": " << device_prop.name<<std::endl;
}
#endif
solver_param.set_device_id(gpus[0]);
Caffe::SetDevice(gpus[0]);
Caffe::set_mode(Caffe::GPU);
Caffe::set_solver_count(gpus.size());
}
boost::shared_ptr<caffe::Solver
if (gpus.size() > 1) {
caffe::P2PSync<float> sync(solver, NULL, solver->param());
sync.Run(gpus);
}
else {
std::cout << "Starting Optimization"<<std::endl;
solver->Solve();
}
std::cout << "Optimization Done."<<std::endl;
//delete solver;
return 0;
}
int main() { string filename="solver.prototxt"; train(filename,""); } `
I got this error
In file included from ../../user1/include/caffe/solver.hpp:8:0, from ../../user1/include/caffe/parallel.hpp:13, from ../../user1/include/caffe/caffe.hpp:13, from ../main.cpp:15: ../../user1/include/caffe/solver_factory.hpp: In static member function ‘static caffe::Solver<Dtype>* caffe::SolverRegistry<Dtype>::CreateSolver(const caffe::SolverParameter&)’: ../../user1/include/caffe/solver_factory.hpp:74:32: error: ‘const class caffe::SolverParameter’ has no member named ‘type’ const string& type = param.type();
@marwaSaid, the problem was solved?
how did you solve the problem?