0

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);
}
Shai
  • 111,146
  • 38
  • 238
  • 371
  • it seems like you are passing a string (file name) when in fact your function expects a parsed file object. – Shai Jul 20 '17 at 06:35
  • okay thanks for your quick comment now model_file and phase_name are strings and they show error in this line shared_ptr > net(new caffe::Net(model_file, phase)); as i stated earlier what should i do in this line or in the initial of these variables ? – Hesham Mohamed Jul 21 '17 at 10:14
  • i tried also to build with ninja and i got the same error – Hesham Mohamed Jul 22 '17 at 11:34
  • @HeshamMohamed can you please provide an already built matcaffe? – EkEhsaas Aug 03 '17 at 13:15
  • 1
    here it is but there is a good chance that it will not work for you because you have to build it on your platform from the beginning to actually work https://drive.google.com/open?id=0Byz3GHMzuz2xTzktRGhXb25UVHM – Hesham Mohamed Aug 04 '17 at 16:19

1 Answers1

1

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