Python Face Id ExampleΒΆ
Initialize faceID model
from oneML import faceAPI as api
embedder = api.FaceEmbedder()
face_id = api.FaceId(embedder)
Initialize faceID 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()
embedder = api.FaceEmbedder(license_manager)
face_id = api.FaceId(embedder, license_manager)
Read input as numpy array
img1 = np.array(cv2.cvtColor(cv2.imread(image_path), cv2.COLOR_BGR2RGB), dtype=np.uint8)
imgs1 = np.expand_dims(img1, axis=0)
img2 = np.array(cv2.cvtColor(cv2.imread(image_path), cv2.COLOR_BGR2RGB), dtype=np.uint8)
imgs2 = np.expand_dims(img2, axis=0)
Run the model for verification
is_same = face_id.is_the_same_person_img(img1, img2)
Run the model for identification
result = face_id.predict(img)
And get the output
status = result.get_return_status()
is_identifiable = result.is_identifiable()
id = result.get_id()
nearestDistance = result.get_nearest_node_distance()
combinedDistance = result.get_combined_distance()