Out of memory error

3 次查看(过去 30 天)
Adrian Kleffler
Adrian Kleffler 2023-5-8
回答: Sourabh 2023-5-15
Hello guys, i am training network using 800 images with 5 classes... first i get this error after 3rd epoch and now after 7th epoch...
i am using this detector :
detector = yolov4ObjectDetector("csp-darknet53-coco",className,anchorBoxes,InputSize=inputSize);
Here are my training options:
options = trainingOptions("adam",...
GradientDecayFactor=0.9,...
SquaredGradientDecayFactor=0.999,...
InitialLearnRate=0.001,...
LearnRateSchedule="none",...
MiniBatchSize=1,...
L2Regularization=0.0005,...
MaxEpochs=10,...
BatchNormalizationStatistics="moving",...
DispatchInBackground=true,...
ResetInputNormalization=false,...
Shuffle="every-epoch",...
VerboseFrequency=20,...
ValidationFrequency=2000,...
CheckpointPath=tempdir,...
ValidationData=validationData);
and here is the error i keep getting ...
Error using matlab.io.datastore.TransformedDatastore/read
Invalid transform function defined on datastore.
Error in nnet.internal.cnn.DataLoader/manageReadQueue (line 206)
data = read(ds);
Error in nnet.internal.cnn.DataLoader/nextBatch (line 82)
manageReadQueue(this);
Error in deep.internal.data.DatastoreDispatcher/readNextMiniBatchIntoCache (line 149)
nextMiniBatchAndSize = nextBatch(this.Dataloader);
Error in deep.internal.data.DatastoreDispatcher/next (line 59)
readNextMiniBatchIntoCache(this);
Error in deep.internal.data.BackgroundDispatcher>iCallNextOnPoolConstant (line 538)
[miniBatch, nextMiniBatchSize] = constantObject.Value.next();
Caused by:
Out of memory.

回答(1 个)

Sourabh
Sourabh 2023-5-15
Hey Adrian,
There might be a few reasons why you might be facing an ‘out of memory’ error when training your model:
  1. The size of your images might be too large. I would recommend resizing your input images using the imresize function to reduce the amount of memory consumed.
  2. It is also possible that your computer hardware might not be able to run the imported model. You could consider using a smaller model such as ‘tiny-yolov4-coco'.
To monitor the amount of memory on your computer and the amount of memory being used by MATLAB, run the command memory.
You might find the following links helpful:
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by