在深度学习中,存在许多卷积神经网络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);*_
所以我从这个链接下载了它的原型和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以及如何通过它提取输出功能吗?