Datastore array exceeds maximum array size preference

5 ビュー (過去 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 Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by