Can the "input data normalization" of "trainNetwork" be done separatedly?

18 views (last 30 days)
Hi,
I am begining with Convolutional Nural Networks in Matlab following the available examples.
I have prepared the input data and parameters. When I have run the training of the networks (trainNetworks) it has began with the 'input data normalization' (during more than 2 hours). Once it has been done, when it should have began the iterations, Matlab has failed (Gpu out of memory).
Would any way to have the normalization done before the training so that I could get the errors (logical errors while I am learning) without expending the previous 2 hours each time?
Thanks a lot,
Jaime

Accepted Answer

Madhav Thakker
Madhav Thakker on 14 Sep 2020
Hi Jaime,
I understand that you want to stop the inbuilt data normalization. You can do so by creating your own input data layer and setting normalization to none. I was able to disable normalization in https://www.mathworks.com/help/deeplearning/ug/create-simple-deep-learning-network-for-classification.html by calling
imageInputLayer([28 28 1], 'Normalization', 'none')
instead of
imageInputLayer([28 28 1])
when defining the network.
Hope this helps.
  1 Comment
Jaime Almonacid-Caballer
Jaime Almonacid-Caballer on 16 Sep 2020
Thanks a lot!!,
I have found the solution. I didn't want to preprocess all my images and save them in disk because of their volume. I expected to have a function pre-trainNetwork so that the image would be normalized. I have found the solution in an option of imageInputLayer:
imageInputLayer([128 128 4],'Normalization',@funcN)
Where funcN:
function Y = funcN(X)
Y=X/255.;
end
Anyway, thank you for guiding my steps,
Jaime

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!