I have a problem about " out of memory" for running VGG16 for image classification

3 views (last 30 days)
Hello Andrea and ioannisbaptista.
I have a problem when I am training the program for image classification. The error message is "out of memory". My GPU specification bellow.
Name: 'GeForce GTX 1650'
Index: 1
ComputeCapability: '7.5'
SupportsDouble: 1
DriverVersion: 11.1000
ToolkitVersion: 11
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 4.2950e+09
AvailableMemory: 3.3381e+09
MultiprocessorCount: 14
ClockRateKHz: 1710000
ComputeMode: 'Default'
GPUOverlapsTransfers: 1
KernelExecutionTimeout: 1
CanMapHostMemory: 1
DeviceSupported: 1
DeviceAvailable: 1
DeviceSelected: 1
I try to training for alexnet, it's not problem. When I training for VGG16, the problem occured as "out of memory".
This part is where the error occurs. I am set teh minibatch size=5. epoch =10. Amount of pictures are 300 only.
featuresTrain = activations(netTransfer,augimdsTrain,layer,'OutputAs','rows');
I need your help.
I still have to train also the Resnet 110 and iceptionV3 architecture. I need the help of both of you. God bless all fo you.

Answers (1)

Joss Knight
Joss Knight on 16 Sep 2021
It doesn't look as though you're setting the MiniBatchSize on the call to activations which means it's using the default value of 128 - no doubt this is too high for your GPU. Make sure you set this property: https://uk.mathworks.com/help/deeplearning/ref/seriesnetwork.activations.html#mw_366511e3-c444-4c5d-baad-e7c016a559fd

Community Treasure Hunt

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

Start Hunting!