How to classify feature vectors of an image using fully connected layer

1 次查看(过去 30 天)
I have extracted image features using 3 different pretrained network and contenated them. Now I want to classify them using fully connected layer.
%%clear workspace;
path = char('E:\Mine\cluster'); %pass to this variable your complet data set path
net=alexnet();
net1=googlenet();
net2=resnet101();
imds = imageDatastore(fullfile(path),'IncludeSubfolders',true, 'LabelSource', 'foldernames');
augImds=augmentedImageDatastore(net.Layers(1, 1).InputSize(1:2),imds);
augImds1=augmentedImageDatastore(net1.Layers(1, 1).InputSize(1:2),imds);
augImds2=augmentedImageDatastore(net2.Layers(1, 1).InputSize(1:2),imds);
Labels=imds.Labels;
% count the number of images
numClass=numel(countcats(Labels));
% feature extraction with the pre-trained network
featurea=squeeze(activations(net,augImds,'fc8'));
featureg=squeeze(activations(net1,augImds,'inception_5b-1x1'));
featurer=squeeze(activations(net2,augImds,'res5b'));
combined_Vector = featurea( : ), featureg(:), featurer( : );
layer = fullyConnectedLayer(2,'Name','fc1');

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by