Python Face Embedder ExampleΒΆ

Initialize face embedder model

from oneML import faceAPI as api
embedder = api.FaceEmbedder()

Initialize face embedder 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)

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 = embedder.embed(imgs)

or

result = embedder.embed(img)

To enable flipped image embedding, run

results = embedder.embed(imgs, True)

And get the output

embedding = result.get_embedding()
status = result.get_return_status()