Last active
January 3, 2019 18:44
-
-
Save bigsnarfdude/f04c5ee2743d48a43e98171b69d44a1d to your computer and use it in GitHub Desktop.
face detection tensorflow demo with photo
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
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