How to match format of data for 3D (4D) CNN ??
Show older comments
Hi,
I want to process 3D time series by CNN in sequence-to-sequence mode. But I am unable to fit format of Patterns and Responses for 3D CNN.
Example of the problem:
function testInputCNN_4D
% some data - any random numbers for formal check
N=20; % number of datasets
for n = 1:N
% data sizes:
% size_1 x size_2 x number of samples x 3 channels ( eg. [R G B])
signalPattern{n}=rand(4,4,10,3);
signalRespons{n}=rand(4,4,10,3);
end
% simple Net to demonstrate the problem
layers = layerGraph();
layers1 = [
sequenceInputLayer([4 4 10 3],"Name","sequence")
convolution3dLayer([3 3 3],3,"Name","conv3d_1","Padding","same")
softmaxLayer("Name","softmax")
regressionLayer("Name","regressionoutput")];
lgraph = addLayers(layers,layers1);
plot(lgraph);
% training
maxEpochs = 5;
miniBatchSize = 4;
options = trainingOptions('adam', ...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'InitialLearnRate',0.022, ...
'GradientThreshold',0.7, ...
'Shuffle','never', ...
'Plots','training-progress',...
'ExecutionEnvironment','cpu',...
'Verbose',0);
CNNtest4D = trainNetwork(signalPattern',signalRespons',lgraph,options);
end
%=======eof====
the trainign process starts, but imediattely finshes with errors:
Error using trainNetwork
Array inputs have incompatible channel dimensions.
Error in testInputCNN_4D (line 47)
CNNtest4D = trainNetwork(signalPattern',signalRespons',lgraph,options);
Caused by:
Error using builtin
Array inputs have incompatible channel dimensions.
even if the formal check by Deep Network Designer is OK.
Welcome any idea or working example ....
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!