Oct 3, 2024
Introduction
Face Landmark is a well-known task in computer vision, and Mediapipe is at the forefront of this technology. In this blog post, we'll explore how to implement Mediapipe face landmark on various mobile devices using ZETIC.MLange, a powerful framework for on-device AI applications. After this post you can make your own on-device face landmark app utilizing Mobile NPUs.
What is Face Landmark?
The Face Landmark model in Google’s MediaPipe is a highly efficient machine learning model used for real-time face detection and landmark extraction.
What is ZETIC.MLange?: Bringing AI to Mobile devices
ZETIC.MLange is a On-device AI framework that enables developers to deploy complex AI models, like Face Landmark, on mobile devices with target hardware utilizations. It leverages on-device NPU (Neural Processing Unit) capabilities for efficient inference.
Github Repository
We provide Face Landmark demo application source code for both Android and iOS. repository
Model pipelining
For accurate use of the face landmark model, it is necessary to pass an image of the correct facial area to the model. To accomplish this, we construct a pipeline with the Face Detection Model.
Face Detection: we use the Face Detection Model to accurately detect the face regions in the image. Using the information from the detected face region, we extract that part of the original image.
Face Landmark: Input the extracted face image into the Face Landmark model to analyze facial landmarks.
Implementation Guide
0. Prerequisites
Prepare the model and input sample of Face Landmark
and Face Detection
from hugging face.
Face Detection model
Face Landmark model
ZETIC.MLange module file
Step 1. Generate ZETIC.MLange Model Key
Generate MLange Model Key with mlange_gen
Expected output
Step 2. Implement ZeticMLangeModel with your model key
Anroid (Kotlin):
For the detailed application setup, please follow deploy to Android Studio
page
iOS (Swift):
For the detailed application setup, please follow deploy to XCode
page
Step 3. Prepare Face Landmark image feature extractor for Android and iOS
Android (Kotlin)
iOS (Swift)
Step 4. Putting It All Together
Android (Kotlin)
Face Detection Model
Face Landmark Model: Pass the result of face detection model as a input.
iOS (Swift)
Face Detection Model
Face Landmark Model: Pass the result of face detection model as a input.
Conclusion: Face Landmark and On-Device AI - Innovation at the Edge and Limitless Potential
Face landmark detection, empowered by On-Device AI, represents a key innovation at the intersection of computer vision and edge computing. By leveraging the capabilities of neural processing units (NPUs) embedded within mobile and edge devices, we enable fast, efficient, and accurate facial analysis in real time, without the need for cloud resources. This technology promises to significantly enhance a wide array of applications, from augmented reality (AR) and virtual reality (VR) experiences to biometric authentication, and personalized content delivery.
The primary benefit of On-Device AI lies in its ability to process and analyze data locally, ensuring rapid response times and preserving user privacy by avoiding the need for cloud data transfers. This decentralized approach not only minimizes latency but also reduces bandwidth and operational costs, making advanced face landmark detection more accessible and scalable across various industries.
Do you have more questions? We welcome your thoughts and inquiries!
For More Information: If you need further details, please don't hesitate to reach out through ZETIC.ai's Contact Us.
Join Our Community: Want to share ideas with other developers? Join our Discord community and feel free to leave your comments!
Your participation can help shape the future of on-device AI. We look forward to meeting you in the exciting world of AI!