Skip to content

Instantly share code, notes, and snippets.

@AyaanZaveri
Created May 22, 2021 16:19
Show Gist options
  • Save AyaanZaveri/02f2cbf40d3f0bbe25e003ab62d7fc5a to your computer and use it in GitHub Desktop.
Save AyaanZaveri/02f2cbf40d3f0bbe25e003ab62d7fc5a to your computer and use it in GitHub Desktop.
label_id_offset = 0
image_np_with_detections = image_np.copy()
# Use keypoints if available in detections
keypoints, keypoint_scores = None, None
if 'detection_keypoints' in result:
keypoints = result['detection_keypoints'][0]
keypoint_scores = result['detection_keypoint_scores'][0]
viz_utils.visualize_boxes_and_labels_on_image_array(
image_np_with_detections[0],
result['detection_boxes'][0],
(result['detection_classes'][0] + label_id_offset).astype(int),
result['detection_scores'][0],
category_index,
use_normalized_coordinates=True,
max_boxes_to_draw=200,
min_score_thresh=.30,
agnostic_mode=False,
keypoints=keypoints,
keypoint_scores=keypoint_scores,
keypoint_edges=COCO17_HUMAN_POSE_KEYPOINTS,
line_thickness=4)
fig = plt.figure(figsize=(24,32))
plt.imshow(image_np_with_detections[0])
plt.show()
fig.savefig('/content/frame.png', dpi=300, bbox_inches='tight')
#DPI is the quality of the image. It is set to 300, but if you want it to be higher quality you can set it to 1000, it will take longer to download the image.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment