C# Face Pad Example¶
C# PadRGB Example¶
Initialize pad RGB model
using OneML.Face;
FacePad padRgb = new FacePad(PadType.Rgb);
Initialize face detector model with licensing
using OneML.Face;
LicenseManager licenseManager = new LicenseManager();
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE");
licenseManager.ActivateKey();
FacePad padRgb = new FacePad(PadType.Rgb, 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 img1 = utils.ReadImageCV(filePath1);
Run the model
FacePadResultList rgbResults = padRgb.Classify(batch1);
or
FacePadResult rgbResult = padRgb.Classify(img1);
And get the output
float spoofProb = output.GetSpoofProb();
bool isSpoof = output.IsSpoof();
int status = output.GetReturnStatus();
Cleanup
padRgb.Dispose();
utils.Dispose();
or wrap the application with
using (FacePad padRgb = new FacePad(PadType.Rgb))
using (Utils utils = new Utils())
{
// use padRgb, utils here
}
C# PadPaper Example¶
Initialize pad paper model
using OneML.Face;
FacePad padPaper = new FacePad(PadType.Paper);
Initialize pad paper model with licensing
using OneML.Face;
LicenseManager licenseManager = new LicenseManager();
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE");
licenseManager.ActivateKey();
FacePad padPaper = new FacePad(PadType.Paper, 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 img2 = utils.ReadImageCV(filePath2);
Run the model
FacePadResultList paperResults = padPaper.Classify(batch2);
or
FacePadResult paperResult = padPaper.Classify(img2);
And get the output
float spoofProb = output.GetSpoofProb();
bool isSpoof = output.IsSpoof();
int status = output.GetReturnStatus();
Cleanup
padPaper.Dispose();
utils.Dispose();
or wrap the application with
using (FacePad padPaper = new FacePad(PadType.Paper))
using (Utils utils = new Utils())
{
// use padPaper, utils here
}