更新时间:2023-12-01 21:36:10
是的! custom_objects期望使用与损失函数完全相同的函数(在您的情况下为内部函数):
Yes, there is! custom_objects expects the exact function that you used as loss function (the inner one in your case):
model = load_model(modelFile, custom_objects={ 'loss': penalized_loss(noise) })
不幸的是,keras不会在模型中存储噪声值,因此您需要将其手动输入到load_model函数.
Unfortunately keras won't store in the model the value of noise, so you need to feed it to the load_model function manually.