MATLAB Answers

Issue with batch normalization layer of saved CNN

27 views (last 30 days)
Kjetil Kveim
Kjetil Kveim on 21 Mar 2019
Commented: Kjetil Kveim on 25 Mar 2019
When loading a previously trained CNN, I got an issue with the batch normalization layers. When looking into the loaded CNN model the trainable mean and variance are empty.
Name: 'batchnorm_1'
TrainedMean: []
TrainedVariance: []
So the checkpoint doesn't seem to save these parameters. Are there any workarounds for this issue? I am using Matlab R2018b.


Sign in to comment.

Accepted Answer

Vivek Singh
Vivek Singh on 22 Mar 2019
We were able to reproduce the issue. We will inform you once the issue is fixed.
Since TrainedMean and TrainedVariance are calculated after the training is finished, therefore as a workaround you can use the below mentioned codes to explicitly save and load the Model.
%To save model with name "demoModel", assuming your network is in "net"
%To load model to variable net1
net1=load('demoModel.mat','net'); %where n is the batch normalization layer

More Answers (0)

Translated by