clear
clc
close all
if exist('../../+caffe', 'dir')
addpath('../..');
else
error('Please run this demo from caffe/matlab/demo');
end
caffe.reset_all
% Set caffe mode
if exist('use_gpu', 'var') && use_gpu
caffe.set_mode_gpu();
gpu_id = 0; % we will use the first gpu in this demo
caffe.set_device(gpu_id);
else
caffe.set_mode_cpu();
end
% model_dir = '../mnist_data/';
% net_model = [model_dir 'lenet.prototxt'];
model_dir = './';
net_model = [model_dir 'lenet_train_test.prototxt'];
net_weights = [model_dir 'lenet_iter_10000.caffemodel'];
if ~exist(net_weights, 'file')
error('Please download CaffeNet from Model Zoo before you run this demo');
end
% Initialize a network
net = caffe.Net(net_model, net_weights, 'test');
acc=[];
for i=1:100
net.forward_prefilled
acc=[acc; net.blobs('accuracy').get_data()];
end
acc
评论0
最新资源