Skip to content
 
 

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FaceONNX 👤

Lightweight .NET 10 face detection library based on ONNX Runtime and SkiaSharp.

Projects 📦

  • FaceONNX: core library
  • FaceONNX.Samples: console sample app (images/ -> results/)

Quick start 🚀

cd FaceONNX.Samples
dotnet run

Installation 📥

From NuGet Package

dotnet add package pock-programming.FaceONNXSkiasharp

Or via Package Manager:

Install-Package pock-programming.FaceONNXSkiasharp

Model Deployment

When you install this package via NuGet:

  1. ONNX models are automatically included in the package as content files
  2. Models are automatically copied to your project's output directory (bin\Debug\net10.0\Models\ or equivalent)
  3. Model resolution is handled automatically by the FaceDetector class

Supported frameworks: .NET 10+

Usage 🧩

using FaceONNX;
using SkiaSharp;

using var detector = new FaceDetector(model: FaceDetectorModel.Yolov5);
using var bitmap = SKBitmap.Decode("images/group.jpg");

FaceDetectionResult[] detections = detector.ForwardDetection(bitmap);
SKRectI[] boxes = detector.Forward(bitmap);

var roi = new SKRectI(100, 80, 500, 420);
FaceDetectionResult[] roiDetections = detector.ForwardDetection(bitmap, roi, clamp: true);

Model selection 🧠

// Default
using var yolov5Detector = new FaceDetector(model: FaceDetectorModel.Yolov5);

using var yolo26Detector = new FaceDetector(model: FaceDetectorModel.Yolo26);
using var faceOnnxDetector = new FaceDetector(model: FaceDetectorModel.FaceOnnx);
Model enum ONNX file Model size Output Landmarks
FaceDetectorModel.Yolov5 yolov5s-face.onnx 29.3 MB Single YOLOv5-style tensor Yes (5-point)
FaceDetectorModel.Yolo26 yolo26_face_fp16.onnx 18.3 MB Single YOLO tensor (xyxy + confidence + class) No
FaceDetectorModel.FaceOnnx face_detector_640.onnx 1.5 MB Split outputs (confidences + boxes) No

API summary 🛠️

  • Forward(...) returns SKRectI[]
  • ForwardDetection(...) returns FaceDetectionResult[]
  • ROI overloads: Forward(image, rectangle, clamp) and ForwardDetection(image, rectangle, clamp)
  • Raw float-channel overloads: Forward(float[][,]) and ForwardDetection(float[][,]) (CHW, 0–255 range)
  • Thresholds: detectionThreshold, confidenceThreshold, nmsThreshold
  • Default model: FaceDetectorModel.Yolov5

Attribution and licenses 🙏

FaceONNX model (face_detector_640.onnx) 🧾

Source:

Thanks to arieffauzi-st for maintaining and sharing this FaceONNX fork.

License status in source repo:

  • no root LICENSE file
  • no model-specific license/notice file in FaceONNX/Models

Reference:

YOLOv5 model and related integration code 🤖

Source:

Thanks to the FaceONNX maintainers and contributors for publishing the models and implementation details used by this project.

License:

  • MIT
  • Copyright (c) 2020-2025 Valery Asiryan
  • base models: Ultralytics YOLOv5 (AGPL-3.0, or Ultralytics Enterprise License)

Reference:

YOLO26 model (yolo26_face_fp16.onnx) 🆕

Source:

License details from source repo:

  • training code: MIT
  • base models: Ultralytics YOLO26 (AGPL-3.0, or Ultralytics Enterprise License)
  • dataset terms: WiderFace terms

Reference:

About

Library for face detection using FaceONNX or Yolo Model and SkiaSharp for Picture manipulations

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages