def run_image_classifier(tensor, graph_def, input_tensor,
output_tensor, scope='RunClassifier'):
"""Runs a network from a frozen graph.
Args:
tensor: An Input tensor.
graph_def: A GraphDef proto.
input_tensor: Name of input tensor in graph def.
output_tensor: Name of output tensor in graph def.
scope: Name scope for classifier.
Returns:
Classifier output. Shape depends on the classifier used, but is often
[batch, classes].
Raises:
ValueError: If `image_size` is not `None`, and `tensor` are not the correct
size.
"""
input_map = {input_tensor: tensor}
return_elements = [output_tensor]
classifier_output = tf.import_graph_def(
graph_def, input_map, return_elements, name=scope)[0]
return classifier_output
评论列表
文章目录