Borrar filtros
Borrar filtros

How to chose convolutional network size to fit in memory?

3 visualizaciones (últimos 30 días)
Denys Li
Denys Li el 11 de Ag. de 2017
Comentada: Mity sosi el 11 de Mayo de 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 comentario
Mity sosi
Mity sosi el 11 de Mayo de 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

Iniciar sesión para comentar.

Respuesta aceptada

Amy
Amy el 14 de Ag. de 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 comentarios
Chee Ho Ng
Chee Ho Ng el 27 de Dic. de 2017
Editada: Chee Ho Ng el 27 de Dic. de 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 el 11 de Mayo de 2019
Dear Amy,
Can you expalin how to define ' your regressors in the other columns ' , I do not know it .
Thanks

Iniciar sesión para comentar.

Más respuestas (1)

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

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by