C# Face Embedder Example

Initialize face embedder model

using OneML.Face;
FaceEmbedder embedder = new FaceEmbedder();

Initialize face embedder model with licensing

using OneML.Face;
LicenseManager licenseManager = new LicenseManager();
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE");
licenseManager.ActivateKey();
FaceEmbedder embedder = new FaceEmbedder(licenseManager);

Initialize oneML’s Utils

Utils utils = new Utils();

Initialize oneML’s Utils with licensing

Utils utils = new Utils(licenseManager);

Read input as oneML’s Image

Image img = utils.ReadImageCV(filePath);

Run the model

FaceEmbedderResultList results = embedder.Embed(batch);

or

FaceEmbedderResult result = embedder.Embed(img);

To enable flipped image embedding, run

FaceEmbedderResult result = embedder.Embed(img, true);

And get the output

Embedding emb = result.GetEmbedding();
int status = result.GetReturnStatus();

Cleanup

embedder.Dispose();
utils.Dispose();

or wrap the application with

using (FaceEmbedder embedder = new FaceEmbedder())
using (Utils utils = new Utils())
{
// use embedder, utils here
}