该错误是使用matlab 运行classification_demo产生的
三要素仔细检查
一、添加系统环境变量
把 \caffe-master\Build\x64\Release添加到系统环境变量中
二、添加 Caffe 路径
打开 MATLAB,在命令窗口输入pathtool,添加 Caffe 路径,主要是添加 \caffe-master\Build\x64\Release\matcaffe这个文件的路径
一定一定注意,是选择添加并包含子文件夹
,我就是这里搞错了,改了之后就好了
保存后,重启matlab,不然测试时会报找不到caffe_mexw64模块的错误。
三.dll 文件复制
很多博文都推荐将 caffe-master\Build\x64\Debug
或者caffe-master\Build\x64\Release
中所有的 .dll 文件全复制到 caffe-master\matlab\+caffe\private
中去,原因是为了防止出现 Undefined variable “caffe” or class “caffe.reset_all” 报错。
我这儿复制的文件共有41个。
除此之外,还有一点,运行classification_demo.m文件之前,需要将addpath('..');
修改为addpath('../../Build/x64/Release/matcaffe');
I resolved the issue using the following steps:Add <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.Now open a Matlab session and add the generated matcaffe folder to the Matlab search path, e.g. addpath('D:\caffe-windows\Build\x64\Release\matcaffe')Edit classification_demo.m by changing
addpath('..');
to
addpath('../../Build/x64/Release/matcaffe');Run 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.
来源:来源:https://github.com/BVLC/caffe/issues/4461
附:参考博客
博客:Win10 + Caffe + CPU + MATLAB (包括各种问题详细解决)(二) —— MATLAB 端设置
地址:https://blog.csdn.net/u014546828/article/details/80447583