Skip to content

Test & measure accuracy of face count detection #1222

Description

@MeenakshiArunsankar

Description

Establish ground-truth accuracy metrics for the face count detection system used in proctoring.

The frontend currently uses @tensorflow-models/face-detection (MediaPipe face detector) to flag NO_FACE (0 faces) and MULTIPLE_FACES (>1 face) anomalies. However, no accuracy evaluation exists — the model's confidence scores are discarded, and no test set validates behavior across real exam conditions.

Current Implementation

  • Detection: frontend/src/components/ai/FaceDetectorWorker.ts runs MediaPipe face detector with maxFaces: 10
  • Anomaly mapping: frontend/src/components/floating-video.tsx lines 599-619 — captures screenshot and POSTs to backend
  • Backend logging: backend/src/modules/anomalies/controllers/AnomalyController.ts stores evidence but no confidence scores

Work Required

  1. Build a labeled test set (~200–300 frames) covering:

    • 0 faces (empty desk, user moved away)
    • 1 face (normal exam position)
    • 2+ faces (peer present, multiple people in frame)
    • Edge cases: masks, partial occlusion, side angles, poor lighting, virtual camera detection
  2. Persist confidence scores — modify anomaly endpoints to include per-face detection confidence from the model

  3. Run offline evaluation against the test set:

    • Compute precision/recall/F1 for NO_FACE and MULTIPLE_FACES flags
    • Confusion matrix by face count bucket
    • Break down performance by condition (lighting, angle, etc.)
  4. Document results in a test report with:

    • Accuracy metrics by condition
    • False positive/negative rates by scenario
    • Recommendations for threshold tuning (if needed)
    • Decision: is current accuracy acceptable for proctoring, or does model need retraining/replacement?

Acceptance Criteria

  • Labeled ground-truth test set (CSV: frame_id, ground_truth_face_count, condition_tags)
  • Confidence scores logged in anomaly records
  • Offline eval script (Python/Node) computing precision/recall/F1/confusion matrix
  • Test report with results, broken down by condition
  • Documented decision on accuracy adequacy (with evidence)

Related

  • Frontend: frontend/src/components/ai/FaceDetectorWorker.ts
  • Frontend: frontend/src/components/floating-video.tsx
  • Backend: backend/src/modules/anomalies/controllers/AnomalyController.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions