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

1 vue (au cours des 30 derniers jours)
Learner
Learner le 2 Mai 2022
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');

Réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by