File size: 1,831 Bytes
c4e545e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
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
```