필터 지우기
필터 지우기

Extracting feature vectors as input to train other network

조회 수: 3 (최근 30일)
Kuan Yi Li
Kuan Yi Li 2022년 4월 4일
답변: Animesh Gupta 2022년 8월 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.

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by