description
Staffing-ratio compliance for supervised rooms. Counts teachers (adults) vs students (children) per frame — persons are reclassified to adult/child via detector classes or SGIE age scores — estimates a robust per-second count by reliability-weighted mode (tolerates flickering detections), maps the student count to a required number of teachers via a configurable ratio table, and fires when the requirement is violated for >= violation_rate_threshold of a sliding window (default 10 minutes). CNT08 = too few teachers present (OVERRATIO, the safety violation); CNT09 = too many (UNDERRATIO, staffing efficiency). Accumulator rule: needs no tracker, works on raw per-frame detections + video clock, so it is robust to ID switches in crowded rooms. Fires per camera (room), not per person.
use cases
- kindergarten / childcare licensing compliance (minimum caregiver-to-child ratio)
- classroom supervision monitoring over long windows rather than instant snapshots
- any "count class A vs class B and enforce a ratio over time" requirement (adaptable via config)
limitations
- needs a detector (or SGIE) that separates the two counted classes (adult/child)
- room-level signal only — does not identify WHICH teacher left or track individuals
- sliding-window design means intentionally slow alerts (minutes, not seconds)
config parameters
general
| Parameter | Type | Default | Notes |
|---|---|---|---|
| window_duration_seconds | integer | 600 | (min 60) |
| violation_rate_threshold | number | 0.6 | (min 0.01, max 1.0) |
| min_observation_seconds | integer | 600 | (min 1) |
| confidence_threshold | number | 0.5 | (min 0.0, max 0.99) |
| teacher_labels | array of string | ["teacher", "giao_vien", "co_giao", "adult"] | |
| student_labels | array of string | ["student", "hoc_sinh", "tre_em", "child"] | |
| age_classification_threshold | number | 0.3 | (min 0.0, max 1.0) |
| default_teacher_count | integer | 1 | (min 0) |
| default_student_count | integer | 10 | (min 1) |
| time_periods | array of object | — |
advanced
| Parameter | Type | Default | Notes |
|---|---|---|---|
| utc_offset | integer | -5 | |
| reliability_weights | array of number | [0.4, 0.3, 0.3] | (min items 3, max items 3) |
| entropy_window_frames | integer | 10 | (min 2) |
| buffer_duration | integer | 600 | (min 60) |
| camera_fps | integer | 4 | |
| cam_resolution | array of integer | — | (min items 2, max items 2) |
golden replay cases
| Case | Frames | Expected events |
|---|---|---|
| overratio | 14 | 1 |
| underratio | 14 | 1 |