Effacer les filtres
Effacer les filtres

how to connect new network to existing model

2 vues (au cours des 30 derniers jours)
Shilpa Sonawane
Shilpa Sonawane le 4 Avr 2023
I have combined output of 2 networks. I need to connect combined output with 3rd network. I am unable to do it. I have to connect add_1 to deconv1 layer. please guide.
load netop.mat;
load trained_net.mat;
lgraph = layerGraph;
lgraph = addLayers(lgraph,visual_net_layes);
lgraph = addLayers(lgraph,audio_net_layers);
add = additionLayer(2,'Name','add_1')
lgraph = addLayers(lgraph,add);
lgraph = connectLayers(lgraph,'fc1','add_1/in1');
lgraph = connectLayers(lgraph,'fc2','add_1/in2');
% plot(lgraph)
newlayers = [
transposedConv2dLayer(11,96,'Stride',4,'Name','deconv1');
batchNormalizationLayer
reluLayer
transposedConv2dLayer(11,96,'Stride',4);
batchNormalizationLayer
reluLayer
transposedConv2dLayer(11,96,'Stride',4);
batchNormalizationLayer
reluLayer
averagePooling2dLayer(2,'Stride',2)
fullyConnectedLayer(2)
softmaxLayer
classificationLayer];
%lgraph = layerGraph(newlayers);
lgraph = addLayers(lgraph,newlayers);
figure
plot(lgraph)

Réponse acceptée

Vinayak Choyyan
Vinayak Choyyan le 10 Avr 2023
Hi Shilpa Sonawane,
As per my understanding, you are facing an issue when trying to combine 3 deep neural networks.
From the code provided, I see that you are trying to combine the output of ‘add_1’ to the input of ‘deconv1’ layer. Please try out the following code.
lgraph=connectLayers(lgraph,'add_1/out','devcon1');
For more information on ‘additionLayer’, please check out the following documentation https://www.mathworks.com/help/deeplearning/ref/nnet.cnn.layer.additionlayer.html
I hope this resolves the issue you are facing.
  3 commentaires
Vinayak Choyyan
Vinayak Choyyan le 11 Avr 2023
I am glad to be of help.
Shilpa Sonawane
Shilpa Sonawane le 11 Avr 2023
Thanks Sir.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by