Skip to content
All posts

February 18, 2026 · 6 min

A Face Detector in a Weekend (and Why It's Still FastAPI)

Face-Detection is one of my smallest projects: OpenCV with a Haar Cascade for detection, wrapped in a FastAPI endpoint. Deliberately small — and a good reminder that the boring tool is often the right one.

Start with the classical baseline

A Haar Cascade is old, cheap and happy on a CPU. It's a 2001-era detector running at frame rate on a laptop, with zero model download and zero GPU requirement. For a lot of real workloads — presence checks, photo culling, counting heads in a frame — it is accurate enough. If it clears the bar, you don't owe anyone a deep model.

There's a discipline in starting classical: the baseline defines what "good enough" means before you've invested anything in the fancy version. Most projects never write that definition down, which is how they end up with a YOLO where a threshold would do.

The service is the product

The detection itself is maybe thirty lines. Everything that makes it usable is the rest: an upload endpoint, image validation, a response shape that says where each face is, and a clear error for the file that isn't a photo. That is why FastAPI — the contract is the deliverable.

The interesting design question wasn't detection at all; it was what the response should look like. Bounding boxes in what coordinate system? Confidence scores or just a list? What does the client do when zero faces are found — an error or an empty array? Those decisions shape the consumer's experience far more than the choice of detector.

When to graduate

Cascades fail on profiles, low light and occlusion. When they start failing often, that's the signal to move to a modern detector — not a moment earlier. The baseline earns its keep by telling you exactly when it's no longer enough: you get a measured, specific failure mode instead of a vague feeling that the model "isn't great".

The meta-lesson

Small projects are where you practice the contract skills that big ones demand, at a cost you can afford. A weekend project with an honest API surface beats a heavyweight model behind a sloppy endpoint.

thanks for reading — more soon ✦

keep reading

M

drawing ideas into systems...