Out of memory error in matlab

1 回表示 (過去 30 日間)
Suhani Agarwal
Suhani Agarwal 2018 年 2 月 15 日
コメント済み: Walter Roberson 2020 年 6 月 8 日
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)

回答 (2 件)

Joss Knight
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.

Javier Pinzón
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
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 ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by