1

我正在尝试使用加载训练网络“name.ckpt-1.meta”的元图,tf.train.import_meta_graph("./name.ckpt-1.meta") 但出现以下错误:

Traceback (most recent call last):
  File "/home/rapsodo/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3265, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-7-634d5d15ac05>", line 1, in <module>
    saver = tf.train.import_meta_graph(input_checkpoint + '.meta', clear_devices=False)
  File "/home/rapsodo/workspace_mike3352/anaconda2/envs/mike_tfpy36/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1960, in import_meta_graph
    **kwargs)
  File "/home/rapsodo/workspace_mike3352/anaconda2/envs/mike_tfpy36/lib/python3.6/site-packages/tensorflow/python/framework/meta_graph.py", line 744, in import_scoped_meta_graph
    producer_op_list=producer_op_list)
  File "/home/rapsodo/workspace_mike3352/anaconda2/envs/mike_tfpy36/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 432, in new_func
    return func(*args, **kwargs)
  File "/home/rapsodo/workspace_mike3352/anaconda2/envs/mike_tfpy36/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 391, in import_graph_def
    _RemoveDefaultAttrs(op_dict, producer_op_list, graph_def)
  File "/home/rapsodo/workspace_mike3352/anaconda2/envs/mike_tfpy36/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 158, in _RemoveDefaultAttrs
    op_def = op_dict[node.op]
KeyError: 'ImageProjectiveTransformV2'

我不明白原因,也没有在其他地方看到同样的东西,我不确定是因为 tensorflow 版本或其他原因。

4

1 回答 1

1

我找到了解决方案;这是因为版本不匹配。新版本的 tensorflow 在保存图等方面与旧版本不匹配。如果我们用旧版本保存检查点,我们应该使用正确的版本(首选相同版本)来加载元图或冻结图。

于 2018-11-21T14:22:14.323 回答