Datastore array exceeds maximum array size preference

조회 수: 9 (최근 30일)
Nicola Carrassi
Nicola Carrassi 2021년 5월 26일
답변: Jayanti 2025년 4월 3일
I am currently working on an application of transfer learning. It is the first time i work with MATLAB and i followed all the courses available. I need to build a network which has an image as input and output. I updated the net I am using (Googlenet, but i have to eventually use other networks too) and when i try to make the command trainNetwork i have the error i mentioned in the title.
Here is the code:
x_images = imageDatastore("dataset\JPEGImages","LabelSource","foldernames");
contour_images = imageDatastore("dataset\contorni", "LabelSource","foldernames");
[train_x_images, test_x_images] = splitEachLabel(x_images, 0.8);
[train_contour_images, test_contour_images] = splitEachLabel(contour_images, 0.8);
train_x_images = augmentedImageDatastore([224,224], train_x_images);
test_x_images = augmentedImageDatastore([224,224], test_x_images);
train_contour_images= augmentedImageDatastore([224,224], train_contour_images);
test_contour_images= augmentedImageDatastore([224,224], test_contour_images);
net = googlenet;
lgraph = layerGraph(net);
layer_to_put = convolution2dLayer(224,224, "Name", "fc","Padding","same");
lgraph = replaceLayer(lgraph,"loss3-classifier", layer_to_put);
layer_to_put= convolution2dLayer(224,224,"Name","layer_conv","Padding","same");
lgraph = replaceLayer(lgraph, 'prob', layer_to_put);
layer_to_put = regressionLayer("Name", "output");
lgraph = replaceLayer(lgraph,"output",layer_to_put);
options = trainingOptions("sgdm","InitialLearnRate",0.001);
[myNet, info] = trainNetwork(train_x_images,lgraph,options);
I have another question which may seem stupid, when training the net how can i pass the correct output? (Which is stored in train_contour_images)

답변 (1개)

Jayanti
Jayanti 2025년 4월 3일
Hi Nicola,
I think the issue you are facing is due to maximum array size limitations in MATLAB. To resolve this try increasing the MATLAB's maximum array size preference.
Goto MATLAB Home tab-> Preferences -> Workspace -> Uncheck MATLAB array size limit checkbox
For your other question when training a neural network you can use “combine function to create a combined datastore that pairs each input image with its corresponding output image.
Hope this will resolve the issue!

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by