DBFace
DBFace face detection.
Detecting Faces in an Image
First, create the DBFace predictor:
// Fetch the model data from NatML
var modelData = await MLModelData.FromHub("@natsuite/dbface");
// Deserialize the model
var model = modelData.Deserialize();
// Create the DBFace predictor
var predictor = new DBFacePredictor(model);
Then detect faces in the image:
// Create image feature
Texture2D image = ...;
var imageFeature = new MLImageFeature(image);
(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 hi@natml.ai.
Thank you very much!