提问人:Sime 提问时间:11/15/2023 最后编辑:desertnautSime 更新时间:11/16/2023 访问量:31
将 tf 插件中的 tfa.metrics.F1Score 替换为 tf.keras.metrics.F1Score
Replace tfa.metrics.F1Score from tf addon by tf.keras.metrics.F1Score
问:
我有一个旧的 Kera 模型,该模型使用 Tensorflow Addon 的 F1Score 自定义模型编译,现已弃用,我想从保存的模型迁移到 tf.keras.metrics.F1Score。
这是我现在加载模型时使用的:
custom_objects = {
'F1Score': F1Score(num_classes=4, threshold=0.5)
}
我试图用新功能替换它,但我收到以下消息:
ValueError: Unable to restore custom object of class "Addons>F1Score" (type _tf_keras_metric). Please make sure that this class is included in the `custom_objects` arg when calling `load_model()`. Also, check that the class implements `get_config` and `from_config`.
Complete metadata: {'class_name': 'Addons>F1Score', 'name': 'f1_score', 'dtype': 'float32', 'config': {'name': 'f1_score', 'dtype': 'float32', 'num_classes': 4, 'average': None, 'threshold': 0.5}, 'shared_object_id': 32}
我该如何迁移到新功能?
答: 暂无答案
评论
Addons>F1Score
Addons>F1Score
F1Score
Addons>F1Score