Import Keras Network: The value of 'TrainedVariance' is invalid. Expected input to be positive.

2 次查看(过去 30 天)
I am trying to import a model from Keras to MATLAB. I am unable to create the variable containing the model.
modelfile = '4k_mag_run1.h5';
net =importKerasNetwork(modelfile, 'WeightFile', modelfile,'ImageInputSize',[256,256]);
The model is a version of the UNet model which I have trained myself and is being used for semantic segmentation.
The error message recieved is:
Error using importKerasNetwork (line 94)
The value of 'TrainedVariance' is invalid. Expected input to be positive.
Error in Classify_LT (line 3)
net =importKerasNetwork(modelfile, 'WeightFile', modelfile,'ImageInputSize',[256,256]);

回答(1 个)

Prince Kumar
Prince Kumar 2021-9-9
Hello,
If your "modelfile" contains the weights of the model then there is no need to pass "WeightFile" as parameter to the "importKerasNetwork" funtion else your weights for the model should be in different file.
Please refere to "Name-Value Pair Arguments" section in the article

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by