Python 属性错误:';图';对象没有属性';签名';

Python 属性错误:';图';对象没有属性';签名';,python,tensorflow,tensorflow2.0,object-detection,object-detection-api,Python,Tensorflow,Tensorflow2.0,Object Detection,Object Detection Api,我正在尝试将Tensorflow的对象检测API与预先训练的模型结合使用。我正在加载带有以下内容的模型: model_name='fish_inception_v2_graph2' PATH_TO_CKPT='models/research/object_detection/'+model_name+'/frozen_inference_graph.pb' ### Load a (frozen) Tensorflow model into memory. detection_model = t

我正在尝试将Tensorflow的对象检测API与预先训练的模型结合使用。我正在加载带有以下内容的模型:

model_name='fish_inception_v2_graph2'
PATH_TO_CKPT='models/research/object_detection/'+model_name+'/frozen_inference_graph.pb'

### Load a (frozen) Tensorflow model into memory.
detection_model = tf.Graph()
with detection_graph.as_default():
    od_graph_def = tf.compat.v1.GraphDef()
    with tf.compat.v2.io.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
        serialized_graph = fid.read()
        od_graph_def.ParseFromString(serialized_graph)
        tf.import_graph_def(od_graph_def, name='')
这似乎很好,但API有一个部分“检查模型的输入签名,它需要一批uint8类型的3色图像”:

当我运行时,即出现错误“AttributeError:“Graph”对象没有属性“signatures”


有人知道怎么解决这个问题吗?谢谢大家!

在检查点的路径中,只需提到model.ckpt-10000或类似的东西。您提供了一个.pb文件,因此出现了错误。

请详细说明,您在这里尝试做什么?你是想对图像进行推理还是想找到输入张量或其他什么?因为错误是正确的,因为图形不提供任何签名属性。
print(detection_model.signatures['serving_default'].inputs)