未定义变量或函数caffe_()

该错误是使用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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值