Face matching on a school bus conductor's phone: the checks before a name appears

2026-12-02来源 dev.toEnglish

At Vainu the school bus conductor's Android phone suggests each child's name when they board, from a quick face check. Getting a model to produce an embedding is the easy part. Most of the work is deciding when the phone should not suggest a name. These are the gates a camera frame goes through, in order, and why each one exists.

1. Is the frame good enough to judge at all?

Before identity comes up, a quality gate rejects frames the matcher should not be trusted with. It measures:

  • One clear face. A second face at least half the width of the main one (a child leaning in behind) makes the frame ambiguous, so it is rejected rather than guessed.
  • Size and detector confidence. Faces narrower than 80 px, or with a detector score below 0.8, are too small or too uncertain.
  • Pose. Yaw is estimated from where the nose sits between the eyes; roll from the eye line. Large turns are rejected.
  • Sharpness. Variance of the Laplacian of the aligned face. Buses move; motion blur is the most common failure.
  • Brightness. Mean luma between 45 and 215. Early-morning pickups are dark, afternoon drop-offs blow out.

Each failure comes back with a reason, so the app can tell the conductor what to fix ("hold still", "more light") instead of just failing.

2. Is it a real face in front of the camera?

A printed photo or a face on another phone should not board the bus. We run a small presentation-attack screen (the open-source MiniFASNet pair, converted to ONNX) on two crops of the face at different scales and average the "real" probability. We are explicit that this screens for photos and screens; it is not a liveness guarantee, and it is never the only safeguard.

3. Search only the children expected on this trip

The phone does not search the school. Before a trip, it downloads the templates of the children on that trip's manifest, usually a few dozen. Matching is a cosine similarity between L2-normalised embeddings, taking each child's best score across their stored poses (frontal, left, right).

Keeping the search to one manifest does three things: it is fast on a cheap phone, it works offline, and the number of possible confusions stays small.

4. Three answers, not two

Each score is classified as match, uncertain or no_match against thresholds that come from the server with the trip package. A match must also beat the second-best child by a margin. Siblings and look-alikes on the same bus are a real case, and when two children score close together, the result is uncertain, never a coin flip.

const margin = second === -Infinity ? 1 : best - second; let result = classify(best); if (result === 'match' && margin < model.searchMargin) result = 'uncertain'; 

5. The model on the phone must be the model the templates came from

Templates are tied to a model id and version. If the phone's engine does not match the trip package exactly, face matching is switched off for that trip and the conductor uses the roster. Comparing embeddings from two different models produces confident nonsense, and an app update rolling out mid-term makes this a real risk, not a theoretical one.

6. A person confirms

Even a clean match is a suggestion. The conductor taps to confirm the name or picks the child from the list. The attendance record stores what the engine observed (score and result), never the camera frame or the template, and face data stays on the trip's phone with a guardian's consent.

What we would tell anyone building this

  • Spend as much effort on rejecting frames as on matching them.
  • Make "I don't know" a first-class answer, and design the UI around it.
  • Pin templates to a model version and refuse to compare across versions.
  • Keep the search space as small as the real-world problem allows.
  • Keep a human in the loop when the cost of a wrong automatic answer is a child recorded on the wrong bus.

Vainu is school bus tracking and attendance for Indian schools: vainu.in.

原文:https://www.a8q9.cn/en/article/face-matching-on-a-school-bus-conductor-s-phone-the-checks-before-a-name-appears-72915d.html

相关文章