【发布时间】:2018-09-16 18:33:41
【问题描述】:
我在 MATLAB 中有这个 AlexNet 模型:
net = alexnet;
layers = net.Layers;
layers(end-2) = fullyConnectedLayer(numClasses);
layers(end) = classificationLayer;
我正在使用它从不同类别视频的帧序列中学习特征。因此,我需要从该模型的“fc7”层中提取学习到的特征,以将这些特征保存为向量并将其传递给 LSTM 层。 这个迁移学习模型的训练过程还可以,好吧。
我在 imageDatastore() 中使用 splitEachLabel() 将数据集划分为 x_train 和 x_test 集,并使用函数 augmentedImageSource() 调整网络中所有图像的大小。一切正常!
但是当我尝试使用下面显示的代码的 sn-p 来调整我的 imageDatastore 中的图像大小以由函数激活()读取时,以将特征保存为向量,我得到一个错误:
imageSize = [227 227 3];
auimds = augmentedImageSource(imageSize, imds, 'ColorPreprocessing', 'gray2rgb');
功能激活:
layer = 'fc7';
fclayer = activations(mynet, auimds, layer,'OutputAs','columns');
错误:
Error using SeriesNetwork>iDataDispatcher (line 1113)
For an image input layer, the input data for predict must be a single image, a 4D array of images, or an imageDatastore with the correct size.
Error in SeriesNetwork/activations (line 791)
dispatcher = iDataDispatcher( X, miniBatchSize, precision, ...
请有人帮助我! 感谢支持!
【问题讨论】:
标签: matlab machine-learning deep-learning feature-extraction