【发布时间】:2020-06-13 15:45:37
【问题描述】:
我有 .h5 格式的 Keras 模型。我想用这段代码阅读它:
#model.h5 is name of mode, tf and modellib is read
custom_objects={'tf': tf,'BatchNorm':modellib.BatchNorm,'ProposalLayer':
modellib.ProposalLayer}
model=tf.keras.models.load_model("model.h5")
但我得到一个错误
TypeError:init() 缺少 2 个必需的位置参数:“proposal_count”和“nms_threshold”
我有最新版本的 TensorFlow (2.2)。更改 TensorFlow 的版本没有帮助。
【问题讨论】:
-
看来你使用的自定义层没有正确实现,很可能缺少get_config()方法。
标签: python tensorflow keras