How bahrombekk/auto-proctoring works
Project type and purpose
• This is an “auto-proctoring” application: it uses live video or image feeds to detect a person, verify their identity, and flag prohibited behaviors (e.g., phone usage) during an exam.
• The codebase is pure Python, organizes ML models (YOLO, ONNX/PyTorch), a local key-value store (LMDB), capture and verification routines, and a small CLI/driver.
File structure
• Top-level scripts:
• main.py: likely the orchestration entry point.
• captury.py: helper for capturing frames (camera or video).
• config.py: global configuration (model paths, thresholds).
• “manitoring/” (sic) directory:
• person_detect.py, phone.py, proctor.py – components that load pre-trained YOLO or ONNX models to detect faces, phones, and perform combined proctoring logic.
• best.pt / best.onnx, yolov8n.pt / .onnx, etc. – ML weight files.
• “src/” directory: face pipeline and DB:
• face_capture.py: extracts face crops from frames.
• face_recognition.py: computes embeddings or classification.
• face_verification.py: verifies current face against stored profile.
• db_management.py: wrappers around LMDB.
• face_database.py: CRUD operations on face records.
• lmdb_data/: the actual LMDB store files.
• saved_images/: sample or captured face images.
• “test/” directory: unit tests for on/off detections and proctor logic.
• requirements.txt: lists Python dependencies (torch, onnxruntime, lmdb, opencv, etc.).
README
• Minimal (“# Auto-proctoring”), so architecture must be inferred from code layout.
Main components
a. Layer
– Captury module (camera/video input)
b. Pre-processing & Detection
– person_detect (YOLO model)
– phone_detect (YOLO or custom)
c. Face Pipeline
– face_capture → face_recognition → face_verification
d. Decision / Proctor Logic
– proctor.py: aggregates detection & verification results, raises alerts
e. Data Storage
– LMDB (via db_management & face_database) for enrolled identities
– saved_images for offline review
f. Model Assets
– ONNX / PyTorch weight files
g. Tests & CI
– test suite
– push_to_github.sh
Relationships and interactions
• Data flow starts at Captury → frame
• Frame is forked to person_detect & phone.py
• Detected face region goes to face_capture → recognition → verification
• All results feed into proctor.py
• proctor.py writes logs or updates LMDB via db_management/face_database
• Main.py ties all modules, loads config, spins up capture loop
• Tests simulate inputs through detection and proctor modules
Architectural patterns / design principles
• Modular pipeline: clear separation between detection, recognition, verification, decision
• Model abstraction: each ML model lives in its own module with a consistent API
• Persistence layer: LMDB encapsulated behind db_management and face_database
• Config-driven: model paths and thresholds in config.py
• Testable units: each component has corresponding tests
3. “face_capture” → “face_recognition” → “face_verification” in a vertical chain.
7. “main.py” wrapper around the entire flow or as a note that it initializes/configures each module.
Detail
• Python modules as distinct components if space allows.
• Config.py feeding parameters into each module.
• Periodic tasks (e.g., database cleanup) if present.