← All models

face-detection Β· vision Β· MediaPipe Β· ~230 KB

FaceDetector β€” box every face

MediaPipe's FaceDetector (BlazeFace short-range) finds faces in an image or video and returns, for each one, a bounding box, 6 keypoints (eyes, nose tip, mouth, ears) and a confidence score. It's a tiny .tflite model β€” about 230 KB β€” that runs on-device via WebAssembly (with a GPU delegate when available). Drop a photo or turn on your webcam.

At a glance

ModelMediaPipe FaceDetector β€” BlazeFace short-range (Google)
RuntimeMediaPipe Tasks Vision (@mediapipe/tasks-vision) β€” .task bundle
OutputPer face: bounding box (pixels), 6 keypoints (normalized), confidence score
RangeShort-range β€” best for faces within ~2 m of the camera; many faces at once
DelegateGPU when a WebGPU/WebGL adapter exists, otherwise CPU (XNNPACK)
Download~230 KB .tflite file, cached by the browser after first load
LicenseApache-2.0 (Google MediaPipe)
Web APIsWebAssembly, Canvas, getUserMedia β€” all Baseline widely available

Run it

Pick a sample, drop your own photo, or use your webcam. Every detected face is boxed with its 6 keypoints and confidence drawn straight on the canvas.

Drop a photo here, or click to choose
A group of eight faces A smiling face A neutral face

See inside

Each detection is a pixel-space bounding box (originX, originY, width, height), six normalized keypoints, and a confidence score. Below is the raw box + score for every face found β€” exactly what the model returned.

Detect faces to see their boxes and scores.

Why it matters

A face box is the first step in almost every camera feature. FaceDetector is small and fast enough to run every frame on a phone, so "is there a face, and where?" becomes a free local primitive β€” no cloud vision API, no per-call cost, nothing leaving the device.

Use cases

Basics

Box the faces in a sample photo and read every bounding box and score β€” feel what the model returns.

Practical

A privacy blur: redact every face in a photo on-device, then export the anonymised image.

Wild

A face counter / photobooth β€” count how many faces are in a crowd, live.

Multi-model

Detect then mesh: FaceDetector boxes the faces, FaceLandmarker adds the 478-point mesh.

How the API works

MediaPipe Tasks loads the model asset (a .tflite bundle for this detector) and gives you a detector you call per image or per video frame:

import { FilesetResolver, FaceDetector } from "@mediapipe/tasks-vision";

const vision = await FilesetResolver.forVisionTasks(".../wasm");
const detector = await FaceDetector.createFromOptions(vision, {
  baseOptions: {
    modelAssetPath: ".../blaze_face_short_range.tflite", // ~230 KB
    delegate: "GPU",                                     // or "CPU"
  },
  runningMode: "IMAGE",                                  // or "VIDEO"
});

const result = detector.detect(imageElement);
// result.detections β†’ [ {
//   boundingBox: { originX, originY, width, height },   // pixels
//   keypoints:   [ {x, y} Γ— 6 ],                        // normalized 0–1
//   categories:  [ { score } ],
// }, … ]

This page loads the model through the showcase's shared auto-init loader and draws the boxes on a canvas at the image's natural resolution; for the webcam it switches the task to VIDEO mode and calls detectForVideo each frame.

References