CenterFace
CenterFace face detection.
Installing CenterFace
Add the following items to your Unity project's Packages/manifest.json
:
{
"scopedRegistries": [
{
"name": "NatML",
"url": "https://registry.npmjs.com",
"scopes": ["ai.natml"]
}
],
"dependencies": {
"ai.natml.vision.centerface": "1.0.1"
}
}
Detecting Faces in an Image
First, create the CenterFace predictor:
var predictor = await CenterFacePredictor.Create();
Then detect faces in the image:
Texture2D image = ...;
var imageFeature = new MLImageFeature(image);
(imageFeature.mean, imageFeature.std) = modelData.normalization;
imageFeature.aspectMode = modelData.aspectMode;
Rect[] faces = predictor.Predict(imageFeature);
Requirements
Quick Tips
Thank you very much!