Created
April 6, 2020 07:07
-
-
Save Alakhator/94be61947a18e3cb21806cb5fdf1c99a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show_inference(model, image_path): | |
# the array based representation of the image will be used later in order to prepare the | |
# result image with boxes and labels on it. | |
image_np = np.array(Image.open(image_path)) | |
# Actual detection. | |
output_dict = run_inference_for_single_image(model, image_np) | |
# Visualization of the results of a detection. | |
vis_util.visualize_boxes_and_labels_on_image_array( | |
image_np, | |
output_dict['detection_boxes'], | |
output_dict['detection_classes'], | |
output_dict['detection_scores'], | |
category_index, | |
instance_masks=output_dict.get('detection_masks_reframed', None), | |
use_normalized_coordinates=True, | |
line_thickness=8) | |
display(Image.fromarray(image_np)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment