How to chose convolutional network size to fit in memory?

3 次查看(过去 30 天)
Hi,
I am trying to use NN toolbox with convolutional layer for regression problem, specifically depth estimation from image. For this, I want to use 256x256 as input and kind of smaller size for output but still can't fit into RAM. What i need to do to chose best sizes of layers?
Another question, why I cant use datastores(without loading images into RAM) with Regression Layer?
Thanks for attention
  1 个评论
Mity sosi
Mity sosi 2019-5-11
Hi
Can you expalin how to define ' your regressors in the other columns ' , I do not know it . because I have the same problem.
Thanks

请先登录,再进行评论。

采纳的回答

Amy
Amy 2017-8-14
Hi Denys,
See https://www.mathworks.com/help/nnet/ug/layers-of-a-convolutional-neural-network.html for information on defining layers for your convolutional neural network.
In a CNN, the majority of the weights are held by the fully connected layers. The convolutional layers in the network convert spatial information into more compact semantic information. Pooling layers then downsample redundant information so that when you reach fully connected layers they are receiving fewer activations.
I am not sure what your CNN looks like, but if you have fewer convolutional layers in your network, your last fully connected layer ends up with a greater number of weights. This could be what is causing you to run out of RAM.
As an example, you could refer to the layers in the AlexNet network for ideas for defining your network layers: https://www.mathworks.com/help/nnet/examples/visualize-features-of-a-convolutional-neural-network.html
As for using image datastores, you can use them with a regression layer without loading them into memory. For now, you can get the image file names from the datastore, then create a table with the file names in the first column and your regressors in the other columns, and feed that to trainNetwork.
  3 个评论
Chee Ho Ng
Chee Ho Ng 2017-12-27
编辑:Chee Ho Ng 2017-12-27
Hello Ms.Amy, I found your answer helpful too. I got a related further question:
Do Matlab have any function that can calculate the required memory for a CNN? In my case, I'm training with GPU.
This can help user predict how much RAM is needed for a CNN design.
Since we have define our layers for CNN, I hope there is a function that can save user time for manual calculation.
Hope to hear from you. Thank you in advance!
Mity sosi
Mity sosi 2019-5-11
Dear Amy,
Can you expalin how to define ' your regressors in the other columns ' , I do not know it .
Thanks

请先登录,再进行评论。

更多回答(1 个)

Mity sosi
Mity sosi 2019-5-11
Dear Amy,
Can you expalin how to define ' your regressors in the other columns ' , I do not know it .
Thanks

类别

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