- Burst sampling — every 30 seconds of video, the pipeline grabs a 24-frame burst rather than analysing every frame, keeping a long lecture affordable to process.
- Detection & tracking — YOLOv8-pose finds each student's body and keypoints, InsightFace (SCRFD) finds faces and 106-point landmarks, and boxes are linked across the burst by IoU overlap into one track per student.
- Re-identification — each track is embedded with AdaFace IR-101 (the same backbone as Attendance) and resolved against students seen in earlier windows as a one-to-one assignment per burst (≥ 0.35 similarity) — so two different people visible in the same burst can never both be assigned to the same identity, which a simpler one-at-a-time match used to allow.
- Roster recognition — the same embedding is also checked, read-only, against the enrolled Attendance roster (≥ 0.35 similarity, with a margin over the runner-up candidate). A confident match shows the real name instead of an anonymous "student_00N" label, and two anonymous IDs that both match the same enrolled student get merged into one timeline.
- Signal extraction — per window: 106-point facial landmarks (InsightFace) drive mouth open/closed tracking and head yaw/pitch; YOLO for phone detection; optical flow for motion; DeepFace for dominant emotion.
- Action classification — a priority ruleset turns those signals into one label per window: On Phone → Sleeping → Writing → Talking → Attentive → otherwise Distracted. "Attentive" is driven by mouth-closed percentage (≥ 80%) — a calibration pass against a labeled reference dataset found eye-openness (EAR) had no measurable correlation with attentiveness, while mouth state separated attentive from non-attentive clips much more cleanly.
- Engagement rollup — the fraction of attentive windows becomes an overall attention level per student: High (≥ 70%), Medium (≥ 40%), or Low, alongside a short saved clip per window.
Known limitations: phone detection currently finds close to none of the real phones in testing —
it's a generic, un-fine-tuned COCO model and needs replacing rather than re-tuning. Attentive/not-
attentive classification runs at roughly 67–70% accuracy against a 156-clip labeled reference
set — a real improvement over the previous EAR-based approach (which had no discriminative power
at all), but not a solved problem.