TrainNetwork bug for 3D CNN

4 次查看(过去 30 天)
Duman
Duman 2019-6-28
评论: Duman 2019-11-20
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

回答(2 个)

cui,xingxing
cui,xingxing 2019-8-12
编辑:cui,xingxing 2019-8-13
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 2019-11-20
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 个评论
Duman
Duman 2019-11-20
Yes, that is right. I already used another CNN network without "crossChannelNormalizationLayer".
Thanks

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by