在深度学习中有很多卷积神经网络CNN模型。为了尝试 VGG-S 模型,我从这里下载“imagenet-vgg-s.mat”,并通过以下代码尝试从第二个全连接层提取输出特征:
net = load('./Model/imagenet-vgg-s.mat');
layer = net.layers{1,18}.name;
outputFeatures = activations(net,Img,layer);
但显示此错误:
_ *Undefined function 'activations' for input arguments of type 'struct'.
Error in Project (line 31)
outputFeatures = activations(net,Img,layer);*_
所以我从这里的这个链接下载了 prototxt 和它的 caffe 模型“VGG_CNN_S.caffemodel”和“VGG_CNN_S_deploy.prototxt”。我用这段代码试试
protofile = './model/ VGG_CNN_S_deploy.prototxt ';
datafile = './model/ VGG_CNN_S.caffemodel ';
net = importCaffeNetwork(protofile, datafile);
但显示此错误:
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);
你能帮我如何使用 VGG-S 以及如何通过它提取输出特征吗?