<CudaDependencies></CudaDependencies> 不能填写 false ,
1、修改配置文件
2、配置环境变量
4、 matcaffe 工程的VC incude 和LIB 目录配置
5、设置matlan 目录
5、切换caffe matlab demo 目录
C:\Program Files\MATLAB\MATLAB Production Server\R2015a\extern\include
#include "C:\Program Files\MATLAB\MATLAB Production Server\R2015a\toolbox\distcomp\gpu\extern\include\gpu\mxGPUArray.h" #include "C:\Program Files\MATLAB\MATLAB Production Server\R2015a\extern\include\mex.h"
6、运行程序
im = imread('D:\caffe\caffe-master\examples\images\cat.jpg'); scores = classification_demo(im, 1); (1为GPU,0为CPU) [score, class] = max(scores);
7.clear clc im = imread('../../examples/images/cat.jpg');%读取图片 figure;imshow(im);%显示图片 [scores, maxlabel] = classification_demo(im, 0);%获取得分第二个参数0为CPU,1为GPU maxlabel %查看最大标签是谁 figure;plot(scores);%画出得分情况 axis([0, 999, -0.1, 0.5]);%坐标轴范围 grid on %有网格 fid = fopen('synset_words.txt', 'r'); i=0; while ~feof(fid) i=i+1; lin = fgetl(fid); lin = strtrim(lin); if(i==maxlabel) fprintf('the label of %d is %s\n',i,lin) break end end