Out of memory error in matlab
1 次查看(过去 30 天)
显示 更早的评论
trainingFeatures = activations(net, trainingSet, featureLayer, ...
'MiniBatchSize', 10, 'OutputAs', 'columns');
trainingSet is an imagestore containing 3 million entries.
net is a pretrained alexnet.
featureLayer we are using is fc7 .
This is the line which I am using, But I am getting error messege
Error using zeros
Out of memory. Type HELP MEMORY for your options.
Error in SeriesNetwork/activations (line 365)
Y = precision.cast( zeros(sz) );
I am using Matlab 2017a, GPU enabled & RAM of 16GB. I had done below mention things to resolve problem but it doesn't get resolved
In Matlab, Home-> Preference->General->JavaHeapMemory->(Then increase the size)
0 个评论
回答(2 个)
Joss Knight
2018-2-15
Clearly you can't store the activations for your entire dataset in memory. fc7 of AlexNet has 4096 single precision outputs. That's 16K. So 3 million of those takes 45 GB.
Try computing the activations in chunks.
0 个评论
Javier Pinzón
2018-3-8
Hello Suhani,
That happens when you GPU can store all the data of one iteration or the data of the activations, so it do not let you continue with the process.
The best way to know what is happening in your GPU consumption, is with this:
- I recommend you to install a third party program called AfterBurner, it let you see how many memory are you using in your GPU.
- If your GPU is about 2 GB space, so it probably is getting out of memory because of it capacity, so you can check if the highest value of memory is reached with the third party software at the time you run your program.
Hope it may help you
Regards,
Javier
1 个评论
Walter Roberson
2020-6-8
If I recall, alexnet uses GPU by default. GPUs just do not have a lot of memory (and the situation is worse on MS Windows, which reserves a large chunk of memory for communicating with the GPU.)
Switching to Python will not increase the amount of memory that is available on your GPUs.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!