为了账号安全,请及时绑定邮箱和手机立即绑定

将多个 MetaGraphDefs 导入单个图形并恢复变量

将多个 MetaGraphDefs 导入单个图形并恢复变量

杨魅力 2021-10-05 16:06:35
与TensorFlow类似的问题:Restoring Multiple Graphs but using the tf.train.import_meta_graph() interface。我的代码:    with self.graph.as_default(), tf.device(device):        with tf.Session(graph=self.graph, config=self.tf_config) as sess:            # Add inherited graphs to CenterNet's graph.            self.mm_saver = tf.train.import_meta_graph(self.maskmaker.model_ckpt + ".meta")            self.dv_saver = tf.train.import_meta_graph(self.deepvar.model_ckpt + ".meta")            # First saver can restore            self.mm_saver.restore(sess, self.maskmaker.model_ckpt)            # Second saver raises an exception            self.dv_saver.restore(sess, self.deepvar.model_ckpt)异常(没有回溯,这是非常非常长的)。NotFoundError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:Key classifier/bias not found in checkpoint     [[node save/RestoreV2 (defined at /home/markemus/dev/IHC/ihc/neuralnets.py:936)  = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]看起来 dv_saver 正在尝试恢复图形上的所有变量,而不仅仅是它自己的变量。失败的关键,“分类器/偏差”,最初是 mm 图表的一部分。我如何限制它恢复自己的密钥?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 205 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信