cannot convert argument 1 from 'char *' to 'const caffe::NetParameter

196 Views Asked by At

i have this issue when building opencl caffe with matlab .

"D:\Projects\shawkat\caffe-opencl\caffe-opencl\build\ALL_BUILD.vcxproj" (default target) (1) -> "D:\Projects\shawkat\caffe-opencl\caffe-opencl\build\Matlab\matlab.vcxproj" (default target) (25) -> (ClCompile target) -> D:\Projects\shawkat\caffe-opencl\caffe-opencl\matlab+caffe\private\caffe_.cpp(285): error C2664: 'caffe::Net: :Net(const caffe::Net &)': cannot convert argument 1 from 'char *' to 'const caffe::NetParameter &' [D:\Projects \shawkat\caffe-opencl\caffe-opencl\build\Matlab\matlab.vcxproj

the problem is in function get_net in file caffe_.cpp here is this function from the file

// Usage: caffe_('get_net', model_file, phase_name)

static void get_net(MEX_ARGS) {
  mxCHECK(nrhs == 2 && mxIsChar(prhs[0]) && mxIsChar(prhs[1]),
      "Usage: caffe_('get_net', model_file, phase_name)");
  char* model_file = mxArrayToString(prhs[0]);
  char* phase_name = mxArrayToString(prhs[1]);
  mxCHECK_FILE_EXIST(model_file);
  Phase phase;
  if (strcmp(phase_name, "train") == 0) {
      phase = TRAIN;
  } else if (strcmp(phase_name, "test") == 0) {
      phase = TEST;
  } else {
    mxERROR("Unknown phase");
  }
  shared_ptr<Net<float> > net(new caffe::Net<float>(model_file, phase));
  nets_.push_back(net);
  plhs[0] = ptr_to_handle<Net<float> >(net.get());
  mxFree(model_file);
  mxFree(phase_name);
}
1

There are 1 best solutions below

0
On

solved by adding NULL as a third input to the function as follow shared_ptr > net(new caffe::Net(model_file, phase , NULL));