Taking attendance by just looking.
Marking attendance by hand is slow, easy to game, and nobody enjoys it. So I built a system that does it by simply looking at who's in the room — real-time face recognition that logs attendance automatically, backed by a deliberately split storage design.
01Why face recognition, and why LBPH
The goal was a system that works on ordinary hardware, in a real classroom, without a GPU or a cloud bill. That constraint shaped the core choice. I used LBPH (Local Binary Patterns Histograms) through OpenCV rather than a heavy deep-learning model.
LBPH is a classic computer-vision technique: it describes a face by the local texture patterns around each pixel rather than trying to learn everything from scratch. That makes it lightweight, fast, and — importantly — reasonably robust to lighting changes, which is exactly the kind of variation a real classroom throws at you. A flashier model would have needed far more compute for a problem that didn't demand it.
Match the tool to the constraint. A deep network might edge out LBPH on a benchmark, but it can't run on the modest hardware this system targets. The best model is the one that actually runs where it needs to.
02The hybrid storage decision
This is the part I find most interesting. I split storage across two databases on purpose, because the two kinds of data have genuinely different shapes:
- MySQL for attendance records. Attendance is structured and relational — who, which class, what time. It needs consistency and clean queries ("show me everyone present on Tuesday"). That's a relational database's home turf.
- MongoDB for user profiles and media. Face data, images, and flexible profile fields don't fit neatly into rigid columns. A document store handles that variability without forcing everything into a fixed schema.
Using one database for both would have meant compromising on one of them. Splitting by data shape let each store do what it's good at.
03How a single attendance mark happens
Capture
OpenCV pulls a frame from the camera and detects any faces in view.
Recognise
Each detected face is matched against enrolled profiles using LBPH.
Resolve identity
A confident match maps the face to a registered user pulled from MongoDB.
Log it
The attendance event is written to MySQL — timestamped and tied to the right session.
04What I took away
Two lessons. First, that not every problem needs deep learning — a well-chosen classic algorithm can be the more engineering-sound answer when constraints are real. Second, that thinking about data by its shape, not by habit, leads to better architecture: structured records and flexible media genuinely belong in different homes. That instinct to question the default is the one I keep sharpening.