Skip to content

Instantly share code, notes, and snippets.

@bigsnarfdude
Last active January 3, 2019 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bigsnarfdude/f04c5ee2743d48a43e98171b69d44a1d to your computer and use it in GitHub Desktop.
Save bigsnarfdude/f04c5ee2743d48a43e98171b69d44a1d to your computer and use it in GitHub Desktop.
face detection tensorflow demo with photo
import cv2
from faced import FaceDetector
from faced.utils import annotate_image
face_detector = FaceDetector()
thresh = 0.8
img_path = 'meCroppedNormal.PNG'
img = cv2.imread(img_path)
rgb_img = cv2.cvtColor(img.copy(), cv2.COLOR_BGR2RGB)
# Receives RGB numpy image (HxWxC) and
# returns (x_center, y_center, width, height, prob) tuples.
bboxes = face_detector.predict(rgb_img, thresh)
ann_img = annotate_image(img, bboxes)
cv2.imshow('image',ann_img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment