Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. def run_inference_for_single_image(image, graph):
  2. with tf.Session(graph = graph) as sess:
  3. ops = graph.get_operations()
  4. all_tensor_names = {output.name for op in ops for output in op.outputs}
  5. tensor_dict = {}
  6. for key in [
  7. 'num_detections', 'detection_boxes', 'detection_scores',
  8. 'detection_classes', 'detection_masks']:
  9. tensor_name = model_name + '/' + key + ':0'
  10. if tensor_name in all_tensor_names:
  11. tensor_dict[key] = graph.get_tensor_by_name(tensor_name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement