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();