1,安装MATLAB2016A,添加环境变量:
注意添加最后一行,不然vs2015编译caffe的matlab支持库,会报找不到libmx.dll的警告。
2,修改caffe-windows\scripts\build_win.cmd,设置:BUILD_MATLAB=1
3,运行build_win.cmd后,用vs2015打开caffe-windows\scripts\build\Caffe.sln,编译matlab支持库:
4,支持库生成在caffe-windows\matlab目录下,但是由于是通过vs2015编译的matlab库支持,需要把文件:
caffe-windows\matlab\+caffe\private\Release\caffe_.mexw64
移动到
caffe-windows\matlab\+caffe\private\caffe_.mexw64
否则在matlab中就会报:
>> test 未定义函数或变量 'caffe_'。
5,第一次运行,在caffe-windows\matlab\demo目录下创建test.m,并把matlab的当前文件夹移动到caffe-windows\matlab\demo:
test.m代码:
im = imread('D:/caffe-windows/examples/images/cat.jpg'); scores = classification_demo(im, 0); [score, class] = max(scores); fprintf('The max score: %f. and The class is %d. \n', score, class); disp(caffe.version())
6,可能会出现:
警告: 执行 'caffe.Net' 类析构函数时,捕获到以下错误: Could not convert handle to pointer due to invalid init_key. The object might have been cleared. > In classification_demo (line 59) In test (line 2)
需要修改:caffe-windows\matlab\+caffe\Net.m,第72行:
将:
function delete (self) if ~isempty(self.hNet_self) caffe_('delete_net', self.hNet_self); end end
改为:
function delete (self) if self.isvalid caffe_('delete_net', self.hNet_self); end end
7,使用classification_demo.m作为示例,注意第二个参数,我编译的是CPU版本,如果启用GPU版本,Matlab2016a会崩溃。
function [scores, maxlabel] = classification_demo(im, use_gpu)
8,classification_demo.m会自动添加扩展库的路径到环境中,所以必须要在caffe-windows\matlab\demo下使用。
% Add caffe/matlab to your Matlab search PATH in order to use matcaffe if exist('../+caffe', 'dir') addpath('..'); else error('Please run this demo from caffe/matlab/demo'); end
如果在其它目录,要引入caffe支持库,需要添加设置路径:
好久没有使用Matlab了,坑了一天。网上在windows下全是微软版caffe。其实这两天安装BVLC版windows的caffe,感觉还好,并不难装,而且也是2~3年前的东西了。
https://github.com/BVLC/caffe/tree/windows
似乎现在都没人使用caffe了,反正我入个门,学习嘛。
相关推荐
Win10X64 下 VS2017 编译的X64位 Caffe(GPU), 静态编译,MT,无任何dll,无需VS运行库,支持Python caffe.exe classification.exe compute_image_mean.exe convert_cifar_data.exe convert_imageset.exe convert_...
Win10X64 下 VS2017 编译的X64位 Caffe, 静态编译,MT,无任何dll,无需VS运行库,支持Python caffe.exe classification.exe compute_image_mean.exe convert_cifar_data.exe convert_imageset.exe convert_mnist_...
bvlc_reference_caffenet.caffemodel 是 matlab 调用 caffe 时需要的 model 文件。放到caffe-master\models\bvlc_reference_caffenet文件夹下。
Caffe 在 win10 环境下编译GPU、CPU版本的配置详细操作说明,长期使用CAFFE总结的安装方法及相关问题积累。
bvlc_alexnet.caffemodel,
plt.rcParams['figure.figsize'] = (10, 10) # large images plt.rcParams['image.interpolation'] = 'nearest' # don't interpolate: show square pixels plt.rcParams['image.cmap'] = 'gray' # use grayscale ...
CUDA 8.0.44 安装时会提示cuda中的驱动...如果出现这个提示,不用担心,在“下一步”选择安装模式时,把“默认”改为自定义。 然后下一步的三个钩选框中,只选择安装CUDA,不要钩选其他两个(是驱动和物理加速程序)。
bvlc_reference_caffenet.caffemodel 是 caffe分类网络的模型文件,可以运行caffe的example去运行该网络。模型放到caffe/models/bvlc_reference_caffenet文件夹下。
bvlc_reference_caffenet.caffemodel4
bvlc_reference_caffenet.caffemodel //source: http://dl.caffe.berkeleyvision.org/
windows下caffe的matlab接口
本文档为caffe官方教程翻译版,主要讲解caffe的matlab接口的使用方法。
CNN工具包caffe的MATLAB源代码
4.右键整个解决方案,生成解决方案,等待一段时间,整个项目编 caffe-master/Buid/x64下会出现Release文件夹,里面是全部的编译成功的和运行时候需要用到的动态库以及exe文件;此外,在整个项目编译过程中会提示...
caffe编译的可执行文件,用VS(win)编译而成,在win7,win10上运行,用于深度学习训练,预测等。
opencv.dnn做图像分类需要的googlenet caffe模型模型文件bvlc_googlenet.caffemodel bvlc_googlenet.prototxt及ImageNet标签文件synset_words.txt等
win10系统亲测可用。先配置caffe文件,再安装并打开VS软件进行编译。在线安装包的编译过程缓慢,可直接用Nugetpackage部署程序包作为依赖项进行编译即可。