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

조회 수: 2 (최근 30일)
Learner
Learner 2022년 5월 2일
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