GOT AN ERROR ON VGG19 FULLYCONNECTED LAYER

3 views (last 30 days)
Dear All
Anyone can help me to solve the problem?
Below is my code for VGG19 net.
I have 75 folder data. In each folder have 5 set images. every images have size 240x240x155.
But I got error below
Error using trainNetwork
Layer 39: Invalid initializer. Requested 75x285696000 (159.6GB) array exceeds maximum array size preference (15.9GB). This might
cause MATLAB to become unresponsive.
Caused by:
Error using nnet.internal.cnn.assembler.InitializeMixin/initializeLearnableParameters
Layer 39: Invalid initializer. Requested 75x285696000 (159.6GB) array exceeds maximum array size preference (15.9GB). This
might cause MATLAB to become unresponsive.
Related documentation
below is my code
clc
clear all
close all
%testDataimages
volReader = @(x) niftiread(x);
volds = imageDatastore('C:\Users\USER\Downloads\LGG',...
'IncludeSubfolders', true,...
'LabelSource', 'foldernames','FileExtensions','.nii','ReadFcn',volReader);
layers = [
image3dInputLayer([240 240 155],"Name","image3dinput")
convolution3dLayer([3 3 3],32,"Name","conv3d_1","Padding","same")
reluLayer("Name","relu_1")
convolution3dLayer([3 3 3],32,"Name","conv3d_2","Padding","same")
reluLayer("Name","relu_2")
maxPooling3dLayer([5 5 5],"Name","maxpool3d_1","Padding","same")
convolution3dLayer([3 3 3],32,"Name","conv3d_3","Padding","same")
reluLayer("Name","relu_3")
convolution3dLayer([3 3 3],32,"Name","conv3d_4","Padding","same")
reluLayer("Name","relu_4")
maxPooling3dLayer([5 5 5],"Name","maxpool3d_2","Padding","same")
convolution3dLayer([3 3 3],32,"Name","conv3d_5","Padding","same")
reluLayer("Name","relu_5")
convolution3dLayer([3 3 3],32,"Name","conv3d_6","Padding","same")
reluLayer("Name","relu_6")
convolution3dLayer([3 3 3],32,"Name","conv3d_7","Padding","same")
reluLayer("Name","relu_7")
convolution3dLayer([3 3 3],32,"Name","conv3d_8","Padding","same")
reluLayer("Name","relu_8")
maxPooling3dLayer([5 5 5],"Name","maxpool3d_3","Padding","same")
convolution3dLayer([3 3 3],32,"Name","conv3d_9","Padding","same")
reluLayer("Name","relu_9")
convolution3dLayer([3 3 3],32,"Name","conv3d_10","Padding","same")
reluLayer("Name","relu_10")
convolution3dLayer([3 3 3],32,"Name","conv3d_11","Padding","same")
reluLayer("Name","relu_11")
convolution3dLayer([3 3 3],32,"Name","conv3d_12","Padding","same")
reluLayer("Name","relu_12")
maxPooling3dLayer([5 5 5],"Name","maxpool3d_4","Padding","same")
convolution3dLayer([3 3 3],32,"Name","conv3d_13","Padding","same")
reluLayer("Name","relu_13")
convolution3dLayer([3 3 3],32,"Name","conv3d_14","Padding","same")
reluLayer("Name","relu_14")
convolution3dLayer([3 3 3],32,"Name","conv3d_15","Padding","same")
reluLayer("Name","relu_15")
convolution3dLayer([3 3 3],32,"Name","conv3d_16","Padding","same")
reluLayer("Name","relu_16")
maxPooling3dLayer([5 5 5],"Name","maxpool3d_5","Padding","same")
fullyConnectedLayer(75,"Name","fc_3")
reluLayer("Name","relu_18")
dropoutLayer(0.5,"Name","dropout_1")
fullyConnectedLayer(75,"Name","fc_2")
reluLayer("Name","relu_17")
dropoutLayer(0.5,"Name","dropout_2")
fullyConnectedLayer(75,"Name","fc_1")
softmaxLayer("Name","softmax")
pixelClassificationLayer("Name","pixel-class")];
plot(layerGraph(layers));
% Train network - 10000 epochs and 10 Augmentations per mask.
maxEpochs = 200;
options = trainingOptions('adam', ...
'MaxEpochs',maxEpochs, ...
'InitialLearnRate',1e-3, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',5, ...
'LearnRateDropFactor',0.97, ...
'Plots','training-progress', ...
'Verbose',false);
% 'CheckpointPath', checkpointPath );
[convnet, traininfo] = trainNetwork(volds, layers, options);

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by