我正在尝试使用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类型的三色图像”:
print(detection_model.signatures['serving_default'].inputs)当我运行的时候,我得到了错误"AttributeError:'Graph‘object has no attribute 'signatures'“。
有人知道怎么解决这个问题吗?谢谢!
发布于 2020-09-23 17:08:06
在指向检查点的路径中,只需提及10000. sort 10000或类似的内容。您提供的是.pb文件,因此出现错误。
https://stackoverflow.com/questions/64015393
复制相似问题