ai.natml.vision.ultraface
v1.0.0
Published
Ultra-light fast generic face detector.
Downloads
926
Maintainers
Readme
UltraFace
Ultra-light Fast Generic Face Detector for high performance face detection.
Installing UltraFace
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.ultraface": "1.0.0"
}
}
Detecting Faces in an Image
First, create the UltraFace predictor:
// Fetch the model data from NatML Hub
var modelData = await MLModelData.FromHub("@natsuite/ultraface");
// Deserialize the model
var model = modelData.Deserialize();
// Create the UltraFace predictor
var predictor = new UltraFacePredictor(model);
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 2021.2+
Quick Tips
- Join the NatML community on Discord.
- Discover more ML models on NatML Hub.
- See the NatML documentation.
- Discuss NatML on Unity Forums.
- Contact us at [email protected].
Thank you very much!