How can I calculate BatchNormalisationLayer's parameters after a checkpoint saving
2 views (last 30 days)
Show older comments
Hi, I use matlab R2017b with the neural network toolbox. I trained the following neural-network with the following training options :
layers = [
imageInputLayer([60 60 1])
convolution2dLayer(3,32,'Padding',2)
batchNormalizationLayer % My problem comes from the batch Normalisation Layers...
% whose parameters are not saved at it checkPoint saving
reluLayer
convolution2dLayer(3,32,'Padding',2)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,128,'Padding',2)
batchNormalizationLayer
reluLayer
convolution2dLayer(3,128,'Padding',2)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,256,'Padding',2)
batchNormalizationLayer
reluLayer
convolution2dLayer(3,256,'Padding',2)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Padding', 'same','Stride',2)
fullyConnectedLayer(1024)
reluLayer
fullyConnectedLayer(128)
reluLayer
fullyConnectedLayer(16)
reluLayer
fullyConnectedLayer(2)
softmaxLayer
classificationLayer()];
options = trainingOptions('sgdm',...
'MaxEpochs',50, ...
'ValidationData',testDigitData,...
'ValidationFrequency',10,...
'ValidationPatience',Inf,...
'Verbose',false,...
'Plots','training-progress',...
'MiniBatchSize',10,...
'CheckpointPath','savedNetworkAtEachEpoch',... % I saved My network at each epoch but the parameters of the
% batchNormalisationLayer are not saved
'LearnRateSchedule','piecewise',...
'LearnRateDropFactor',.1,...
'LearnRateDropPeriod',2,...
'Shuffle','every-epoch');
PierreNet = trainNetwork(trainDigitData,layers,options);
When I load a checkpoint network saved at the end of one epoch, the BatchNormalisationLayer parameters 'TrainedMean' and 'TrainedVariance' are empty. Therefore, it is not possible to do any classification. I got this error : "Unable to use networks with batch normalization layers before training is complete. UsetrainNetwork to complete network training."
Am I oblige to run the training again to compute the missing parameters ? If not, how can I easily compute those parameters ?
Thanks
2 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!