Extracting feature vectors as input to train other network
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Animesh Gupta
2022 年 8 月 30 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Parallel and Cloud についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!