Instructions to use litert-community/MediaPipe-FaceDetector-BlazeFace-Short-Range with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/MediaPipe-FaceDetector-BlazeFace-Short-Range with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
MediaPipe BlazeFace (Short-Range)
Lightweight single-shot face detector (blaze_face_short_range.tflite, 230 KB, FP16 weights) optimized for selfie and front-facing smartphone camera or webcam images at short range (within ≈2 meters), packaged for the MediaPipe Face Detector (FaceDetector) task and LiteRT.
Documentation: MediaPipe Face Detector Docs
Samples: Android · iOS · Python Colab · Web · Flutter
Try live: Web Demo
BlazeFace (short-range) uses a Single Shot MultiBox Detector (SSD) architecture with a lightweight MobileNetV1/V2-inspired feature extractor tailored for mobile GPU and CPU (XNNPACK) execution.
For each detected face, the MediaPipe FaceDetector task decodes the raw anchor predictions and applies Non-Maximum Suppression (NMS) to return:
- Axis-aligned bounding box (
origin_x,origin_y,width,heightin pixels) - 6 approximate 2D facial keypoints normalized to
[0.0, 1.0](left_eye,right_eye,nose_tip,mouth,left_eye_tragion,right_eye_tragionfrom the observer's perspective) - Detection confidence score in
[0.0, 1.0]
Files
| File | Precision | Size | SHA-256 |
|---|---|---|---|
blaze_face_short_range.tflite |
float16 |
229.7 KB (229,746 B) | b4578f35940bf5a1a655214a1cce5cab13eba73c1297cd78e1a04c2380b0152f |
Companion Files in Repo Root
| File | Role | Size | SHA-256 |
|---|---|---|---|
MediaPipe BlazeFace Model Card (Short Range).pdf |
Upstream Google model card (PDF) | 434.4 KB (434,425 B) | cd335c06fc0de7807cd815a0777a697932598bcdb28fa98adaaabf847485f758 |
Download
pip install -U huggingface_hub
hf download litert-community/MediaPipe-FaceDetector-BlazeFace-Short-Range blaze_face_short_range.tflite --local-dir .
Inputs, Outputs, and Model Specifications
blaze_face_short_range.tflite
- Embedded
TFLITE_METADATA: nameShort Range Face Detection· version1· authorMediaPipe
| Direction | Tensor | Shape | Type | Notes |
|---|---|---|---|---|
| Input | input |
[1, 128, 128, 3] |
float32 |
image — Input image to be detected — Normalization: mean=[127.5], std=[127.5] |
| Output | regressors |
[1, 896, 16] |
float32 |
raw boxes/keypoints — Undecoded face bboxes location and keypoints |
| Output | classificators |
[1, 896, 1] |
float32 |
scores — Scores of the detected bboxes. |
Use with MediaPipe Tasks
Python Quickstart
pip install -U mediapipe huggingface_hub
import mediapipe as mp
from huggingface_hub import hf_hub_download
model_path = hf_hub_download(
repo_id="litert-community/MediaPipe-FaceDetector-BlazeFace-Short-Range",
filename="blaze_face_short_range.tflite",
)
BaseOptions = mp.tasks.BaseOptions
FaceDetector = mp.tasks.vision.FaceDetector
FaceDetectorOptions = mp.tasks.vision.FaceDetectorOptions
VisionRunningMode = mp.tasks.vision.RunningMode
options = FaceDetectorOptions(
base_options=BaseOptions(model_asset_path=model_path),
running_mode=VisionRunningMode.IMAGE,
min_detection_confidence=0.5,
)
with FaceDetector.create_from_options(options) as runner:
mp_image = mp.Image.create_from_file("input.jpg")
result = runner.detect(mp_image)
for detection in result.detections:
bbox = detection.bounding_box
score = detection.categories[0].score
print(f"Face score={score:.3f} box=({bbox.origin_x}, {bbox.origin_y}, {bbox.width}, {bbox.height})")
Cross-Platform Guides & Samples
- Task overview & options: Face Detector documentation
- Platform setup guides: Python · Web / JavaScript · Android (Kotlin / Java) · iOS (Swift) · Flutter (Dart)
- Runnable sample apps: Web Demo · Web Source · Android · iOS · Python Notebook · Flutter
Latency Benchmarks
End-to-end MediaPipe Task pipeline average latency reported by the Face Detector documentation:
| Model Variant | Device | CPU Latency | GPU Latency |
|---|---|---|---|
| BlazeFace (short-range) | Pixel 6 | 2.94 ms | 7.41 ms |
Intended Use, Limitations, and Fairness
Summarized from the bundled MediaPipe BlazeFace Model Card (Short Range).pdf (Google, June 9, 2021):
- Intended applications: Detecting prominently displayed faces in smartphone camera or webcam images and video frames for live perception pipelines, mobile augmented reality (AR), entertainment, and assistive experiences.
- Operating envelope: Designed for faces within ≈2 meters of the camera, where face bounding box sides are at least 20% of the corresponding image dimensions, at least 70% of the face lies within the frame, roll/pitch angles are within ±45°, and yaw is within ±90°.
- Out-of-scope uses:
- Any form of surveillance or identity recognition is explicitly out of scope and not enabled by this technology.
- Human life-critical decisions.
- Counting people in crowds, detecting faces > 2 meters from the camera, or detecting faces turned away from the camera.
- Known limitations: Outputs up to a fixed cap of detections even when more people are in view; extreme lighting, motion blur, sensor noise, or face occlusion can degrade accuracy and increase inter-frame jitter.
- Fairness evaluation (summary): Evaluated on consented in-the-wild smartphone AR images across 17 UN geographic subregions (global average recall 99.1%, range 92.5%–100%; global average precision 95.1%, range 94.9%–95.2%), annotator-perceived gender presentation (average recall 98.4%, precision 99.9%), and 5 Fitzpatrick-aligned skin-tone groups (average recall 98.1%, range 94.7%–100%; average precision 99.7%, range 98.6%–100%). Refer to the bundled PDF model card for full methodology and definitions.
Provenance
Every model binary in this repository is byte-identical (unmodified FlatBuffer weights and embedded TFLITE_METADATA bytes) to the official artifact served by Google from storage.googleapis.com/mediapipe-models.
| Repo File | Upstream URL | GCS Generation | Upstream Last-Modified |
Pinned Bucket Version |
|---|---|---|---|---|
blaze_face_short_range.tflite |
blaze_face_short_range.tflite |
1682480001393569 |
Wed, 26 Apr 2023 03:33:21 GMT | /1/ |
License and Citation
- License:
apache-2.0— Stated as Apache License, Version 2.0 in the bundled upstream Google model-card PDF.
Citation
@inproceedings{bazarevsky2019blazeface,
title = {BlazeFace: Sub-millisecond Neural Face Detection on Mobile GPUs},
author = {Bazarevsky, Valentin and Kartynnik, Yury and Vakunov, Andrey and Raveendran, Karthik and Grundmann, Matthias},
booktitle = {CVPR Workshop on Computer Vision for Augmented and Virtual Reality},
year = {2019},
url = {https://arxiv.org/abs/1907.05047}
}
- Downloads last month
- -