mbradiant's picture
Add R(2+1)D-18 exam behavior classifier + model card
c4e545e verified
|
Raw
History Blame Contribute Delete
1.83 kB
---
license: mit
pipeline_tag: video-classification
tags:
- video
- action-recognition
- r2plus1d
- pytorch
library_name: pytorch
---
# Exam Behavior Classifier — R(2+1)D-18
Classifies a short clip of a single student into one of five exam behaviors:
**normal, copying, gesture, mobile, notes**.
- **Architecture:** torchvision `r2plus1d_18`, Kinetics-400 pretrained, 5-way head.
- **Input:** 16 uniformly-sampled frames, center-cropped to 112×112, Kinetics normalization.
- **Training data:** 251 clips from the Kaggle *ExamCheating_MultiV* dataset (V1 prefix-labeled
+ 30 hand-labeled V2 clips).
- **Test (n=38, leakage-free group split):** accuracy **71.1%**, macro-F1 **0.680**.
On the original clean distribution: 78.8%; on out-of-distribution phone footage: 20% —
see the repo for the full distribution-gap analysis.
⚠️ **Research & education only — not a proctoring system.** Outputs are suggestions for a
human to review, never evidence of cheating. Full limitations and ethics discussion in the
[model card](https://github.com/MunkhbayarA/exam-cheating-detection/blob/main/model_card.md).
**Code, training pipeline, and demo app:**
[github.com/MunkhbayarA/exam-cheating-detection](https://github.com/MunkhbayarA/exam-cheating-detection)
## Usage
```python
import torch, torch.nn as nn
from torchvision.models.video import r2plus1d_18
from huggingface_hub import hf_hub_download
CLASSES = ["normal", "copying", "gesture", "mobile", "notes"]
ckpt_path = hf_hub_download("mbradiant/exam-behavior-classifier", "best_model.pt")
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=True)
model = r2plus1d_18()
model.fc = nn.Linear(model.fc.in_features, len(CLASSES))
model.load_state_dict(ckpt["model"])
model.eval()
# input: float tensor (B, 3, 16, 112, 112), Kinetics-normalized
```