Extracting feature vectors as input to train other network
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
After Extracting feature vectors from pre-trained models, I would like to use those produced features to train a deep neural network with a number of fully connected layers. What can i do?
Thank you for your answer.
0 Kommentare
Antworten (1)
Animesh Gupta
am 30 Aug. 2022
Hello,
It is my understanding that you want to reuse the feature vector from pre-trained model and then append it with fully connected layers to train a custom deep learning model.
You may refer the following script that demonstrates a similar procedure.
In this demonstrattion, we are using pretrained GoolgeLeNet neural network and replacing fully connected layer and output layer.
net = googlenet; % loading pretrained GoogleLeNet neural network
lgraph = layerGraph(net); % extracting the layer graph of the model
newLearnableLayer = fullyConnectedLayer(5, ...
'Name','new_fc', ...
'WeightLearnRateFactor',10, ...
'BiasLearnRateFactor',10); % creating a new custom layer for our model
lgraph = replaceLayer(lgraph,'loss3-classifier',newLearnableLayer); % replace the existing 'loss3-classifier' with our newLearnableLayer
newClassLayer = classificationLayer('Name','new_classoutput'); % creating a new classification layer of name as new_classoutput
lgraph = replaceLayer(lgraph,'output',newClassLayer); % replacing output layer of original GoogleLeNet with our custom output layer
deepNetworkDesigner(lgraph) % visualizing the change
It can be observed that "loss3-classifier" and "output" layers are replaced with our new custom layers.
In a similar fashion, new layers can also be added in the network using addLayers and connectLayers method of layerGraoh object.
You can refer the following documentation for more information -
Transfer learning using pretrained network - https://www.mathworks.com/help/deeplearning/ug/transfer-learning-using-pretrained-network.html
I hope it helps.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!