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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!