TrainNetwork bug for 3D CNN

7 views (last 30 days)
Duman
Duman on 28 Jun 2019
Commented: Duman on 20 Nov 2019
I have a train data set with the size as follows:
size(X_train)= 512*512*14*1*200
size(Y_train)=200*1
I designed a 3D CNN network3D CNN network (3D convolution) and I am trying to train the designed 3D model using trainNetwork function:
[net, tr] = trainNetwork(X_train,Y_train,layers,options);
When the 'MiniBatchSize' is bigger than one (MiniBatchSize>1), I get the following Error:
Error using trainNetwork (line 165)
Invalid input array.
Caused by:
Error using builtin
Invalid input array.
But for 'MiniBatchSize of 1, it starts to train the model!
My designed network properties are as follows:
layers = [
image3dInputLayer([512 512 14 1],"Name","image3dinput")
convolution3dLayer([11 11 7],96,"Name","conv3d","BiasLearnRateFactor",2,"Padding",[1 1 1;1 1 1],"Stride",[4 4 7])
reluLayer("Name","relu1")
crossChannelNormalizationLayer(5,"Name","norm1","K",1)
averagePooling3dLayer([3 3 1],"Name","avgpool3d","Stride",[2 2 1])
fullyConnectedLayer(2,"Name","fc")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
options = trainingOptions('sgdm', ...
'MiniBatchSize',10, ...
'MaxEpochs',50, ...
'InitialLearnRate',3e-4, ...
'Shuffle','every-epoch', ...
'Plots','training-progress');
Can you please help me to solve this issue?
Thank you,
Dooman

Answers (2)

cui,xingxing
cui,xingxing on 12 Aug 2019
Edited: cui,xingxing on 13 Aug 2019
if i set your "X_train , Y_train" like this:
X_train = zeros(320,320,16,3,200);
Y_train = categorical(randi(2,[200,1]));
and use your code can wok!
but i use my self custum datastore , can't work,why?

Amir Ebrahimi
Amir Ebrahimi on 20 Nov 2019
As it seems, "crossChannelNormalizationLayer" does not work in 3D workflow in MATLAB 2019b. You may train your model with "MiniBatchSize"=1 but it is not correct anyway. Try to use other 3D models without "crossChannelNormalizationLayer". This bug is reported to Mathworks and they may fix it in future releases.
  1 Comment
Duman
Duman on 20 Nov 2019
Yes, that is right. I already used another CNN network without "crossChannelNormalizationLayer".
Thanks

Sign in to comment.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!