A real-time exam malpractice detection system using a deep learning model deployed on a Raspberry Pi with a webcam for live monitoring.
The system captures live video from a USB webcam, analyzes 16-frame clips using a lightweight MobileNetV2-based model, and flags suspicious behavior when malpractice is detected for more than 8 consecutive seconds. When triggered, it saves a video clip (5 seconds before + 5 seconds after the alert) to the evidence/videos/ folder and plays an audio alert.
├── model.ipynb # Model training notebook
├── inference.py # Live detection script (runs on Raspberry Pi)
├── best_model_v4.pth # Trained model weights
└── requirements.txt # Python dependencies
- Device: Raspberry Pi (any model with USB support)
- Camera: USB Webcam connected to the Pi
- Audio (optional): Place an
alert.wavfile in the project root for sound alerts
git clone https://github.com/ThangakumarC/malpractice-detection-system.git
cd malpractice-detection-system
pip install -r requirements.txtpython inference.pyPress Q to quit the detection window.
| Parameter | Value | Description |
|---|---|---|
| Confidence threshold | 0.6 | Minimum score to flag as suspicious |
| Min duration | 8 seconds | Time before raising an alert |
| Cooldown | 60 seconds | Gap between consecutive alerts |
| Pre/Post buffer | 5 seconds each | Context saved around alert |
Flagged incidents are saved automatically as .avi video files under evidence/videos/ with a timestamp filename (e.g., 20250429_143022.avi).
- PyTorch & TorchVision
- OpenCV
- FastAPI + Uvicorn
- NumPy, Pillow