
Datastore array exceeds maximum array size preference
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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)
0 commentaires
Réponses (1)
Jayanti
le 3 Avr 2025
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!
0 commentaires
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!