ai.natml.vision.centerface
v1.0.1
Published
CenterFace anchor-free face detection in Unity Engine.
Downloads
937
Maintainers
Readme
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:
// Create the CenterFace predictor
var predictor = await CenterFacePredictor.Create();
Then detect faces in the image:
// Create image feature
Texture2D image = ...;
var imageFeature = new MLImageFeature(image); // This also accepts a `Color32[]` or `byte[]`
(imageFeature.mean, imageFeature.std) = modelData.normalization;
imageFeature.aspectMode = modelData.aspectMode;
// Detect faces
Rect[] faces = predictor.Predict(imageFeature);
Requirements
- Unity 2022.3+
Quick Tips
- Discover more ML models on NatML Hub.
- See the NatML documentation.
- Join the NatML community on Discord.
- Contact us at [email protected].
Thank you very much!