通过import_meta_graph加载元图时出现ImageProjectiveTransformV2错误

问题描述 投票:0回答:1

我正在尝试使用tf.train.import_meta_graph("./name.ckpt-1.meta")加载训练有素的网络“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版本或其他东西。

tensorflow checkpointing
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.