Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def run_inference_for_single_image(image, graph):
- with tf.Session(graph = graph) as sess:
- ops = graph.get_operations()
- all_tensor_names = {output.name for op in ops for output in op.outputs}
- tensor_dict = {}
- for key in [
- 'num_detections', 'detection_boxes', 'detection_scores',
- 'detection_classes', 'detection_masks']:
- tensor_name = model_name + '/' + key + ':0'
- if tensor_name in all_tensor_names:
- tensor_dict[key] = graph.get_tensor_by_name(tensor_name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement