Clear Filters
Clear Filters

Out of memory error

3 views (last 30 days)
Adrian Kleffler
Adrian Kleffler on 8 May 2023
Answered: Sourabh on 15 May 2023
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.

Answers (1)

Sourabh
Sourabh on 15 May 2023
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!

Community Treasure Hunt

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

Start Hunting!