Test Output file Using MATLAB

535 views
Skip to first unread message

Arghavan Arafati

unread,
Aug 25, 2015, 10:05:22 PM8/25/15
to Caffe Users
Hi guys,


I'm noob in caffe, I managed to install caffe and compile using the commands "make", train my netwok following tutorial in caffe berkley, but I don't understand how I test now, in other words how I use a output after end training?

 I don't know phyton, So I tried to use MATLAB and test mnist example on that. I linked MATLAB to caffe. But the problem is When I try to make the network by this code : "net = caffe.Net(model, weights, 'test'); % create net and load weights my net ", the network doesn't have any data blob as input!
net =

  Net with properties:

           layer_vec: [1x12 caffe.Layer]
            blob_vec: [1x14 caffe.Blob]
              inputs: {0x1 cell}
             outputs: {2x1 cell}
    name2layer_index: [12x1 containers.Map]
     name2blob_index: [14x1 containers.Map]
         layer_names: {12x1 cell}
          blob_names: {14x1 cell}


also, my caffemodel file is only 1.7 MB!!

can you help me with these issues, Please?! I can not find any information on using MATLAB!

thanks!

Saeed Izadi

unread,
Aug 27, 2015, 3:41:43 AM8/27/15
to Caffe Users
Arghavan,
here is a sample code for working with matlab wrapper: 

addpath(genpath('matlab'));

caffe.set_mode_gpu();
gpu_id = 0;
caffe.set_device(gpu_id);

model_dir = '../models/vgg/';
net_model = [model_dir 'deploy.prototxt'];
net_weights = [model_dir 'VGG_ILSVRC_16_layers.caffemodel'];
phase = 'test';

net = caffe.Net(net_model, net_weights, phase);

%Reshape the net to get one image (instead of 10 images)
net.blobs('data').reshape([224 224 3 1]);
net.reshape();

%Get the type of an layer
net.layers('conv1_1').type;

%read an input image
im = imread('boat.png');
im = imresize(im,[256,256]);
input{1} = im;

%Feed forward the image through layers
tic;
scores = net.forward(input);
toc;

%Get the intemediate blobes(features)
conv1_1_feat = net.blobs('conv1_1').get_data();
Reply all
Reply to author
Forward
0 new messages