Multi stream CNN implementation

2 visualizzazioni (ultimi 30 giorni)
Rd
Rd il 19 Nov 2020
Commentato: Ankita Jain il 3 Mar 2022
i have designed CNN and it is trained with dataset stored in XTrain image datastore.
layers = [
imageInputLayer([227 227 3],"Name","imageinput")
.
.
.
averagePooling2dLayer([5 5],"Name","avgpool2d_5","Padding","same","Stride",[2 2])
fullyConnectedLayer(10,"Name","fc")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
options = trainingOptions('sgdm', ...
'LearnRateSchedule','piecewise', ...
'InitialLearnRate',0.01, ...
'ValidationFrequency',10,...
'MaxEpochs',10, ...
'MiniBatchSize',10, ...
'ValidationData',{input,testinput},...
'Plots','training-progress')
[net, traininfo] = trainNetwork(input,layers,options);
YPred = classify(net,testinput);
accuracy = mean(YPred==YTest)
confusion = plotconfusion(YTest,YPred)
I got a good result.
I have to train my CNN with three different datasets namely input_in, input_mid, input_rin. Reference block is attached below.
After last pooling layer i have to concatenate the features. Then fully connect, softmax and classification layer should appear.
i have try like this:
deepnet1=Layer(input_in);
deepnet2=Layer(input_mid);
deepnet3=Layer(input_rin);
deepnet4=createLayerFullyConnect(numHiddenDimension);
function deepnet=createLayerFullyConnect(numHiddenDimension)
layers = [
imageInputLayer([1 numHiddenDimension*3 1],"Name","imageinput","Normalization","none")
fullyConnectedLayer(30,"Name","fc_1")
fullyConnectedLayer(20,"Name","fc_2")
fullyConnectedLayer(10,"Name","fc_3")];
lgraph = layerGraph(layers);
deepnet = dlnetwork(lgraph);
end
I don't know how to train same network with different images and concatenate them after training. Any help is appriciated. Thanks in advnace.
Regards,
Ramasenthil.
  1 Commento
Ankita Jain
Ankita Jain il 3 Mar 2022
Hey.. did you solve this problem? Any help would be appreciated.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by