Closed stoneyang closed 8 years ago
the Undefined function 'caffe_' for input arguments of type 'char'
simply means caffe function is not found.
try the which command and see if matlab can find its path,
`which caffe do this to other functions as well, like
which caffe.set_mode_gpu()`
if it doesnt find caffe, it means it is not in the path or pdw . by the way when you run the demo, note that it first tries to see if the cafe+ folder which contains the caffe function , is in the path. I am talking about this line of code
% Add caffe/matlab to you Matlab search PATH to use matcaffe
if exist('../+caffe', 'dir')
addpath('..');
else
so basically if that folder is not your current folder, or caffe+ is not in your path you will get that error. What I myself did was to write something like this :
% Add caffe/matlab to you Matlab search PATH to use matcaffe
if exist('N:/Caffe_Win/Build/x64/Release/matcaffe/+caffe', 'dir')
addpath('..');
else
and I need to say that, I had already set matcaffe path to the MatlabPath. and having done that, I wrote the code I posted above . and things got executed just fine . by the way this stack overflow question helped me alot.
Hi, @Coderx7 , thanks a lot for timely reply and sorry for my delayed. :)
When I typed which caffe_
in the matlab console, it gives me: 'caffe_' not found.
While when I typed which caffe.set_mode_gpu()
, it gives me something interesting: D:\src\caffe\matlab\+caffe\set_mode_cpu.m % static method or package function
.
Then I tried to follow your advice on modifying the if exist()
line, to make it implicitly pointing to the right directory, matlab still returns the same error as in the original post ....
What is your advice on this stage? Or, should I abandon playing caffe on windows? Thanks again.
Edit: Another earlier issue found https://github.com/BVLC/caffe/issues/3967; and still, no effective solution yet....
@stoneyang : have you looked at the stackoverflow link I gave earlier? I am clueless whats wrong! make sure you check that link, it may help you get rid of the issue.
@Coderx7 : Yeah, I've checked that link at the latest trial and I cannot add path to matlab because the directory contains a +
symbol, which makes matlab resist accepting it ....
Thank you all the same for whatever you've helped. :+1:
I will return to this thread when I find the solution.
@stoneyang I am experiencing exactly similar issue as you. So far, I have not come across any solution.
I resolved the issue using the following steps:
<caffe_root>\Build\x64\Release
to your system path, e.g
PATH1;PATH2;D:\caffe-windows\Build\x64\Release
Important: When appending a new item to a former list of paths, make sure there is no white space after the semicolon.matcaffe
folder to the Matlab search path, e.g. addpath('D:\caffe-windows\Build\x64\Release\matcaffe')
addpath('..');
to
addpath('../../Build/x64/Release/matcaffe');
classification_demo.m
You should run it from <caffe_root>\matlab\demo
folder as your current directory. This is because the demo uses other paths relative to this folder for loading models, example images, etc.@z-khan , your suggestions works before I have time to solve it :)
Thank you very much!!!
I'm trying to follow this link. Caffe library built successfully with a bunch of warnings but I can not execute _caffe.runtests() statement. It terminates immediately resulting the following message -
Undefined function 'caffe_' for input arguments of type 'char'. Error in caffe.set_modecpu (line 5) caffe('set_mode_cpu'); Error in caffe.run_tests (line 7) caffe.set_mode_cpu();
I tried the above provided solutions but none worked. Did anyone face the same issue recently ? I'm using Windows-7, Cuda 7.0, CUDnn 4.0, Visual Studio 2013, Matlab 2016b(classroom licence). To build caffe I'm using the following configuration -
if NOT DEFINED MSVC_VERSION set MSVC_VERSION=12 if NOT DEFINED WITH_NINJA set WITH_NINJA=0 if NOT DEFINED CPU_ONLY set CPU_ONLY=1 if NOT DEFINED CMAKE_CONFIG set CMAKE_CONFIG=Debug if NOT DEFINED CMAKE_BUILD_SHARED_LIBS set CMAKE_BUILD_SHARED_LIBS=0 if NOT DEFINED PYTHON_VERSION set PYTHON_VERSION=2 if NOT DEFINED BUILD_PYTHON set BUILD_PYTHON=1 if NOT DEFINED BUILD_PYTHON_LAYER set BUILD_PYTHON_LAYER=1 if NOT DEFINED BUILD_MATLAB set BUILD_MATLAB=1 if NOT DEFINED PYTHON_EXE set PYTHON_EXE=python if NOT DEFINED RUN_TESTS set RUN_TESTS=0 if NOT DEFINED RUN_LINT set RUN_LINT=0 if NOT DEFINED RUN_INSTALL set RUN_INSTALL=0
Every time I build, before it prints the configuration summery it prints The system cannot find the drive specified. Any help or suggestion is greatly appreciated.
@avijoyChakma I have the same problem with you? Did you fix it? And I have installed the newest caffe ,but I didn't find a project named matcaffe. Can anybody help?
I figured that my Matlab R2014B can't add a path with a '+'. So the caffe.mex can't be found by matlab. I copy the file caffe.mex to the /caffe/matlab path. Then it's all right!
@YoungMagic See if #5219 can help you.
I also met this. I solved it by compiling matcaffe: make all matcaffe
caffe was pulled from github repo and was configured as the instructions under the windows branch, and the library was successfully compiled.
When running in-box matlab demo --- classification_demo.m, I got:
Error in caffe.set_modegpu (line 5) caffe('set_mode_gpu');
Error in classification_demo (line 66) caffe.set_mode_gpu();
PC resources:
PS: The generated matcaffe directory has already been set in path of MATLAB, and Release directory has already been included at the end of my system
PATH
.I've spent several days googling around and found someone asking the same (or alike) question, such as: 1, and 2. It seems of no avail to solve this problem.
Anyone could shed me some light? Thanks in advance!