尝试使用MATLAB R2018a中的预训练AlexNet模型提取图像特征时出错

时间:2018-12-11 09:23:48

标签: matlab conv-neural-network feature-extraction

我有273个灰度图像(无人驾驶飞机),我想应用更快的R-CNN模型对图像中的对象进行分类,但是首先我使用了预先训练的AlexNet模型来提高项目速度。但是,在尝试使用预先训练的AlexNet模型提取图像特征并在Mathworks网站(AlexNet : Extract Image Features)的下面编写代码时

layer = 'fc7';

featuresTrain = activations(net,augimdsTrain,layer,'OutputAs','rows');
featuresTest = activations(net,augimdsTest,layer,'OutputAs','rows');

MATLAB显示以下错误:

Error using nnet.internal.cnn.validateMiniBatchDatastore>checkPartitionByIndex (line 90)
Incorrectly defined MiniBatchable Datastore. Error in partitionByIndex method of F:\Program Files\MATLAB\R2018a\toolbox\nnet\cnn\+nnet\+internal\+cnn\ImageDatastoreMiniBatchDatastore.m at line 59:
Undefined function 'categories' for input arguments of type 'double'.

Error in nnet.internal.cnn.validateMiniBatchDatastore (line 16)
    checkPartitionByIndex(ds);

Error in nnet.internal.cnn.DataDispatcherFactory.createDataDispatcher (line 67)
    nnet.internal.cnn.validateMiniBatchDatastore(inputs);

Error in SeriesNetwork>iDataDispatcher (line 1112)
    dispatcher = nnet.internal.cnn.DataDispatcherFactory.createDataDispatcher( ...

Error in SeriesNetwork/activations (line 790) 
    dispatcher = iDataDispatcher( X, miniBatchSize, precision, ...

Error in myprj (line 24)     
    featuresTrain = activations(net,augimdsTrain,layer,'OutputAs','rows');

如何解决此问题?

0 个答案:

没有答案