Multi stream CNN implementation
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Recognition, Object Detection, and Semantic Segmentation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!