Checkpoint not working with batch normalization

I am using the Deep Learning Toolbox to build and train a convolutional network. In my network I have batch normalization layers after my convolutional layers. I attempted to save my progress using the CheckpointPath option, but when I loaded my network from a checkpoint via load('checkpoint_name.mat'), using predict(net, XValidation) gave the following error:
"Error using DAGNetwork/calculatePredict>predictBatch (line 157)
Input network must not have batch normalization layers with empty
Mean or Variance properties. To calculate the batch normalization
statistics, use the trainNetwork function.
Error in DAGNetwork/calculatePredict (line 17)
Y = predictBatch( ...
Error in DAGNetwork/predict (line 131)
Y = this.calculatePredict( ...
Error in SeriesNetwork/predict (line 263)
Y = this.UnderlyingDAGNetwork.predict(X, varargin{:});
Error in TestNetworks (line 7)
YPredicted = predict(net, XValidation);"
Does someone know what causes this and/or how to fix it?
Thanks in advance.

답변 (1개)

Mahesh Taparia
Mahesh Taparia 2020년 7월 13일

0 개 추천

Hi
The possible workaround of this problem is to save the weights of the network or the complete workspace after completion of training using save function. While making the inference, load that back to the workspace. Hope it will help!

댓글 수: 2

Gelin Guo
Gelin Guo 2022년 4월 20일
편집: Gelin Guo 2022년 4월 20일
Hi,
This is still a standing issue after 2yrs passed in R2022a. Do you have any updates on this issue? Due to this bug, the checkpoint functionality in the trainedNetwork is basically rendered useless when BatchNormalization layer is in use.
For anyone else stuck, there is a fix here: https://uk.mathworks.com/matlabcentral/answers/423588-how-to-classify-with-dag-network-from-checkpoint

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2020년 7월 8일

댓글:

2022년 12월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by