Debug Tensorflow :Two checkpoint references resolved to different objects

环境

报错

WARNING:tensorflow:Inconsistent references when loading the checkpoint into this object graph. Either the Trackable object references in the Python program have changed in an incompatible way, or the checkpoint was generated in an incompatible program.

Two checkpoint references resolved to different objects
在这里插入图片描述

训练的时候看不出来问题,可以保存模型。
以上警告发生在model.load_weights时

解决方案

比较像内部bug,直接保存为pb模型则没有问题。保存、预测都可以成功

model.save_weights("../weights/yolo")
# 替换为:
tf.saved_model.save(model, "../weights/yolo")

参考

colab上也有一个case:linkage
有类似报错,把两个function重写为一个解决了

更多内容,欢迎关注我的公众号:YueTan

Guess you like

Origin blog.csdn.net/weixin_38812492/article/details/111927932