How to use Bag of features with inceptionv3?

4 views (last 30 days)
Chinatip
Chinatip on 22 Aug 2022
Answered: Udit06 on 22 Nov 2024 at 6:24
i have imdsTrain and imdsValidation
Then i want to bring this
bag = bagOfFeatures(trainingSet);
to use with this code
net = inceptionv3;
lgraph = layerGraph(net);
figure('Units','normalized','Position',[0.1 0.1 0.8 0.8]);
plot(lgraph)
net.Layers(1)
inputSize = net.Layers(1).InputSize;
lgraph = removeLayers(lgraph, {'predictions','predictions_softmax','ClassificationLayer_predictions'});
numClasses = numel(categories(imdsTrain.Labels));
newLayers = [
fullyConnectedLayer(numClasses,'Name','fc','WeightLearnRateFactor',10,'BiasLearnRateFactor',10)
softmaxLayer('Name','softmax')
classificationLayer('Name','classoutput')];
lgraph = addLayers(lgraph,newLayers);
lgraph = connectLayers(lgraph,'avg_pool','fc');
pixelRange = [-30 30];
imageAugmenter = imageDataAugmenter( ...
'RandXReflection',true, ...
'RandXTranslation',pixelRange, ...
'RandYTranslation',pixelRange);
augimdsTrain = augmentedImageDatastore(inputSize(1:2),imdsTrain, ...
'DataAugmentation',imageAugmenter);
augimdsValidation = augmentedImageDatastore(inputSize(1:2),imdsValidation);
options = trainingOptions('sgdm', ...
'MiniBatchSize',10, ...
'MaxEpochs',4, ...
'InitialLearnRate',1e-4, ...
'ValidationData',augimdsValidation, ...
'ValidationFrequency',3, ...
'ValidationPatience',Inf, ...
'Verbose',false ,...
'Plots','training-progress');
net = trainNetwork(augimdsTrain,lgraph,options);
i want to know how to use Bag of features as features with inceptionv3

Answers (1)

Udit06
Udit06 on 22 Nov 2024 at 6:24
You can refer to the following research paper for the same:
Lorente, Ò., Riera, I., & Rana, A. (2021). Image classification with classic and deep learning techniques. arXiv preprint arXiv:2105.04895.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!