Face detection — finding where a face is in a frame — is one of the few computer vision tasks that genuinely benefits from running right on the device instead of a server somewhere. It’s fast, it’s cheap, and most importantly, the raw camera feed never has to leave the hardware it was captured on.
Why Run It On-Device
-
Latency: detection happens in milliseconds, with no network round-trip in the loop
-
Privacy: raw video frames stay local; nothing has to be streamed out to be processed
-
Reliability: keeps working even with no network connection at all
-
Cost: no per-frame inference bill, since there’s no cloud compute involved
The Typical Pipeline
-
Capture a frame from the camera sensor
-
Run it through a lightweight detector model (Haar cascades for the cheapest option, or a small CNN like BlazeFace/MediaPipe for far better accuracy at still-real-time speed)
-
Get back bounding boxes for each detected face, typically in under 20ms on modest hardware
-
Optionally crop and pass those regions downstream — to a tracker, an access-control check, or a cloud recognition step, if one is needed
Choosing a Model for Constrained Hardware
| Approach | Speed | Accuracy | Good For |
|---|---|---|---|
| Haar Cascades | Very fast | Low, sensitive to lighting/angle | Microcontrollers, extreme constraints |
| MediaPipe / BlazeFace | Fast | High | Raspberry Pi–class boards, phones |
| Full CNN detectors (e.g. RetinaFace) | Slower | Very high | Devices with a real GPU/NPU |
Detection is deliberately the «dumb» half of the problem — it just answers is there a face here, and where. It doesn’t try to know whose face it is. That’s the harder, heavier task, and it’s exactly where it starts to make sense to hand things off to the cloud — which is what the next post covers.