Multi stream CNN implementation

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

Ankita Jain
Ankita Jain 2022년 3월 3일
Hey.. did you solve this problem? Any help would be appreciated.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

Rd
2020년 11월 19일

댓글:

2022년 3월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by