Azzera filtri
Azzera filtri

Extracting feature vectors as input to train other network

3 visualizzazioni (ultimi 30 giorni)
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.

Risposte (1)

Animesh Gupta
Animesh Gupta il 30 Ago 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 -
I hope it helps.

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by