0

In deep learning there are many model of convolution neural network CNN. To try VGG-S model, I download "imagenet-vgg-s.mat" from here and I try it by this code to extract the output feature from 2nd fully connected layer:

net = load('./Model/imagenet-vgg-s.mat');
layer = net.layers{1,18}.name;
outputFeatures = activations(net,Img,layer);

but this error shown:

_ *Undefined function 'activations' for input arguments of type 'struct'.
  Error in Project (line 31)
        outputFeatures = activations(net,Img,layer);*_

So I download prototxt and caffe model of it "VGG_CNN_S.caffemodel" and "VGG_CNN_S_deploy.prototxt" from this link here . I try it by this code

protofile = './model/ VGG_CNN_S_deploy.prototxt ';
datafile = './model/ VGG_CNN_S.caffemodel ';
net = importCaffeNetwork(protofile, datafile);

but this error is shown:

Error using
nnet.internal.cnn.caffe.CaffeModelReader/checkIfPoolingLayerOutputSizeMatchesCaffe
(line 1081)
The pooling layer 'pool1' is not compatible with MATLAB. Caffe computes the output
size as [37 37 96] but MATLAB computes it as [36 36 96].
Error in nnet.internal.cnn.caffe.CaffeModelReader/makePoolingLayer (line 928)
            checkIfPoolingLayerOutputSizeMatchesCaffe(this, inputSize, internalLayer);
Error in nnet.internal.cnn.caffe.CaffeModelReader/importLayers (line 257)
                        [layers(layerIdx), internalLayer, outputSize] =
                        makePoolingLayer(this, origLayerIdxInFile, outputSize);
Error in nnet.internal.cnn.caffe.CaffeModelReader/importSeriesNetwork (line 310)
            layers = importLayers(this);
    Error in importCaffeNetwork (line 82)
        network = importSeriesNetwork(readerObj);

Could you help me how to use VGG-S and how to extract output features by it?

stop-cran
  • 4,229
  • 2
  • 30
  • 47
Tripoli
  • 1
  • 4
  • [`activations`](https://www.mathworks.com/help/nnet/ref/activations.html) is a function in the Neural Network Toolbox. Since MATLAB says it can't find it, I am guessing you don't have the toolbox. – buzjwa Feb 21 '18 at 12:53
  • I have the Neural Network Toolbox, because I test it in another code and it works. but now when i'm using Caffe it's not work. So I want to get the output features from layers in VGG-S with Caffe? – Tripoli Feb 22 '18 at 07:12

0 Answers0