Skip to content

Instantly share code, notes, and snippets.

@natxopedreira
Created May 14, 2020 22:02
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 natxopedreira/0cb99433eaf85f0834bd73e5aad12e3d to your computer and use it in GitHub Desktop.
Save natxopedreira/0cb99433eaf85f0834bd73e5aad12e3d to your computer and use it in GitHub Desktop.
from facelib import facerec
import cv2
import time
face_detector = facerec.SSDFaceDetector(tpu=True)
landmark_detector = facerec.LandmarkDetector(name='mobilenet_int8_tpu')
feature_extractor = facerec.FeatureExtractor(name='mobilenet_int8_tpu')
pipeline = facerec.Pipeline(face_detector, landmark_detector, feature_extractor)
path_img = '/home/pi/Desktop/images.jpeg'
img = cv2.imread(path_img)
#img = img[...,::-1] # cv2 returns bgr format but every method inside this package takes rgb format
inicio = time.time()
bboxes, landmarks, features = pipeline.predict(img)
print(time.time()-inicio)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment