Effacer les filtres
Effacer les filtres

How to chose convolutional network size to fit in memory?

3 vues (au cours des 30 derniers jours)
Denys Li
Denys Li le 11 Août 2017
Commenté : Mity sosi le 11 Mai 2019
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 commentaire
Mity sosi
Mity sosi le 11 Mai 2019
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

Connectez-vous pour commenter.

Réponse acceptée

Amy
Amy le 14 Août 2017
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 commentaires
Chee Ho Ng
Chee Ho Ng le 27 Déc 2017
Modifié(e) : Chee Ho Ng le 27 Déc 2017
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 le 11 Mai 2019
Dear Amy,
Can you expalin how to define ' your regressors in the other columns ' , I do not know it .
Thanks

Connectez-vous pour commenter.

Plus de réponses (1)

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

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by