Face Detection and Estimates using Onnx Models
This is an UWP demo for face detection, generating faical landmarks and camera distance estimation.
The Onnx model processing for face detection, faical landmarks is based on the python implementation of cunjian/pytorch_face_landmark.
- Windows x64
- Download
FaceRecognitionUWP/AppPackages.zip
. - Unzip the file and navigate to
AppPackages/FaceRecognitionUWP_1.0.2.0_Test/
. - Right click the file
Add-AppDevPackage.ps1
and select "Run with powershell". - You will need to use "Run as administrator" option.
- Agree (type "Y") to all the requests and the app should be installed on your windows.
- Find and open the app
FaceRecognitionUWP
.
- Windows x64
- Visual Studio 2019
- Open
FaceRecognitionUWP/FaceRecognitionUWP.sln
- Add packages to
FaceRecognitionUWP
- Microsoft.AI.DirectML
- Microsoft.AI.MachineLearning
- Add packages to
OpenCVBridge
- MOpenCV.Win.Core
- OpenCV.Win.ImgProc
- Set Solution Configuration to
Debug
and platform tox64
- You can run app in Visual Studio 2019
- Open the app.
- There are 2 modes: Camera and Image. You can click button "Live Camera" to switch between 2 modes.
- Image Mode
- Click "Select image" to load a local image
- Click "Recognize" to detect face and display a rectangle for detected faces
- Toggle "Distance" to activate facial landmarks
- Camera Mode
- Click "Live Camera" to activate Camera Mode
- Toggle "Distance" to activate camera distance estimation
- There are some face images in
FaceRecognitionUWP/Assets/Images
for testing face detection.
Distributed under the MIT License
Jedy Chen - Portfolio Site - jedy829@gmail.com
- UWP Tutorial: Create a Windows Machine Learning UWP application (C#)
- UWP Tutorial: Detect objects using ONNX in ML.NET
- UWP Tutorial: Create or edit a SoftwareBitmap programmatically
- UWP Tutorial: Process media frames with MediaFrameReader - UWP applications
- UWP Tutorial: Integrate OpenCV with UWP
- Github: cunjian/pytorch_face_landmark
- Github: takuya-takeuchi/UltraFaceDotNet
- Github: Downscale the pixel values in UWP App
- Pinhole Camera Model