Python Face Detector ExampleΒΆ

Initialize face detector model

from oneML import faceAPI as api
detector = api.FaceDetector()

Initialize face detector model with licensing

from oneML import faceAPI as api
license_manager = api.LicenseManager()
license_manager.set_key("LICENSE_KEY_VALUE_HERE")
license_manager.activate_key()
detector = api.FaceDetector(license_manager)

Read input as numpy array

img = np.array(cv2.cvtColor(cv2.imread(image_path), cv2.COLOR_BGR2RGB), dtype=np.uint8)
imgs = np.expand_dims(img, axis=0)

Run the model

results = detector.detect(imgs)

or

result = detector.detect(img)

And get the output

scores = result.get_scores()
bboxes = result.get_bboxes()
landmarks = result.get_landmarks()
poses = result.get_poses()
size = result.get_size()
statuses = result.get_return_status()