Skip to content

Instantly share code, notes, and snippets.

@qmaruf
Created May 14, 2019 02:28
Show Gist options
  • Save qmaruf/f59601100e51243cc560c7c150205a30 to your computer and use it in GitHub Desktop.
Save qmaruf/f59601100e51243cc560c7c150205a30 to your computer and use it in GitHub Desktop.
img = image_np.copy()/255.0
im_height, im_width, _ = img.shape
print (width, height)
for boxes, classes, scores in zip(output_dict['detection_boxes'], output_dict['detection_classes'], output_dict['detection_scores']):
if classes == 1 and scores >= 0.5:
ymin, xmin, ymax, xmax = boxes
xmin, xmax, ymin, ymax = xmin * im_width, xmax * im_width, ymin * im_height, ymax * im_height
xmin, xmax, ymin, ymax = int(xmin), int(xmax), int(ymin), int(ymax)
print (left, right, top, bottom)
img = cv2.rectangle(img, (xmin, ymin), (xmax, ymax), (255, 255, 0), 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment