Taqwa StudiosCase study 02 / 20
Computer Vision
Who came in, and is the room actually being used? Answered on a CPU, from a consumer camera, with nothing sent to the cloud.
Role
Sole designer and engineer
Status
● Running in production
Models
Face detect + embed (CPU) · YOLOX body count · no LLM
Stack
Python + FastAPI · OpenCV · YOLOX · RTSP · SwitchBot · PWA + web push
The short version
- Recognises enrolled members at the door and queues unknown faces for a human to confirm.
- Occupancy is cross-checked three ways: a doorway headcount, a smart-lock sensor and ambient sound.
- Runs on CPU on my own server. Biometric data never leaves the building.
01Why I built it
Taqwa Studios is a coworking space with membership plans: visit windows, weekly day caps, guest caps. I needed to know who came in, when, and whether plans were being used the way they were sold.
Cloud access-control systems cost money every month and send members' faces to someone else's servers. I wanted the answer without either.
02How it works
- CaptureAn RTSP stream from a consumer Tapo camera at the door.
- RecogniseDetect the face, track it across frames, encode the tracked face at full resolution, then classify. Each track votes across its frames, so a person gets one confident decision rather than one per frame.
- DebounceOne event per track, a 60-second cooldown per person, a uniqueness check in the database and a cap on unknown events.
- ReviewUnknown faces are clustered into provisional people, so enrolling someone is one tap. Butler runs a nightly review of the day's unknowns in Discord.
- CountA separate YOLOX body-count pipeline with a line-crossing tripwire at the door gives in-minus-out headcount.
- CorroborateA SwitchBot door sensor (a real entry opens the door), an ambient decibel meter, and a presence sensor in the soundproof pod so someone sitting quietly isn't counted as gone.
- ReportBusiest and quietest hours, per-person patterns, automatic membership-rule checks, a PWA with a live occupancy badge, and ±10-second DVR replays for every event.
03Model choices, and why
Face detection and embedding
Classic CPU models (HOG detector and dlib-style encodings), behind a swappable FaceEmbedder interface
The box has no GPU. These are small, mature and fast on CPU, and the interface means a stronger embedder (YuNet + SFace, or ArcFace) drops in without touching the pipeline.
Who is it?
Nearest distance per enrolled person, with a margin
I started with k-nearest-neighbours and removed it after finding it subtly broken. “Closest person, and clearly closer than the runner-up” is easier to reason about and to tune.
How many people?
YOLOX
Body detection works from any angle, so it doesn't depend on seeing a face.
Language model
None
Nothing here involves language. A generative model would add latency and cost to a real-time loop for no gain.
04Signals: what the system trusts
- No single sensor is trusted. A camera can miss someone, a door can be propped open, a quiet room isn't an empty one. Agreement between signals is what makes the number believable.
- Decisions are per person, not per frame. Voting across a track removes most of the flicker you get from frame-by-frame recognition.
- A human closes the loop. Unknowns land in a review queue with a snapshot. The system suggests, a person confirms.
05Cost
- No per-inference cost. Everything runs on hardware I already own.
- Storage is capped by design: two 60 GB DVR ring buffers on a separate disk, oldest footage deleted first.
- No subscription, no per-seat licence, no cloud video storage.
06Performance
- CPU-only end to end, on the same server as the rest of the fleet.
- Full-resolution encoding happens only on tracked face crops, not on whole frames.
- Honest number: the latest weekly audit shows the camera and dashboard processes using about two cores each. The next optimisation is frame-skipping and a lower capture rate on the occupancy loop, which should give back roughly half the server's steady CPU.
07Trade-offs I made
Chose
CPU models
Over
A GPU box or a cloud vision API
Chose
Three corroborating signals
Over
One clever camera model
Chose
“Member or stranger, a human confirms”
Over
Unattended access control
Chose
Margin classifier
Over
k-nearest-neighbours
08Guardrails
- Biometric data stays on the local network.
- Every unknown is reviewed by a person before it becomes anything.
- Not used to grant or deny entry.
- A DPIA sign-off is the gate before any wider rollout.
09What I'd do next
- Frame-skipping on the occupancy loop to cut CPU use.
- Drop in a stronger face embedder through the existing interface and measure the accuracy gain on real door footage.
10What this shows
Applied AI engineering
Real-time CV on CPU, multi-signal fusion, and knowing when a model is the wrong tool.
Product
Built around a business question (are memberships used as sold?), not around the tech.
Solutions
IoT integration (camera, smart lock, sensors) with privacy and compliance designed in from the start.
Across the fleet: every build runs on one self-hosted Linux server, binds to localhost and is reached only over a private Tailscale network. AI inference runs on a Claude subscription through one in-house router (part of Sentry) rather than per-token API keys, with open-weight models on Ollama as the local layer: on the server, and on a 64 GB MacBook Pro shared over Tailscale for heavier local work. Everything is backed up to GitHub and a separate cold disk, and nothing reaches another person without a human tap.
Hiring for applied AI, product or solutions work? I'd like to hear about it.