Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- pytorch
|
| 5 |
+
- vgg16
|
| 6 |
+
- image-classification
|
| 7 |
+
- reaction-recognition
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Classroom Reaction Recognition - VGG16
|
| 11 |
+
|
| 12 |
+
A VGG16 classifier trained to recognize facial reactions of students
|
| 13 |
+
from cropped person bounding boxes in classroom lecture videos.
|
| 14 |
+
|
| 15 |
+
## Classes
|
| 16 |
+
|
| 17 |
+
| Index | Label | Description |
|
| 18 |
+
|-------|------------------|------------------------------------|
|
| 19 |
+
| 0 | `Neutral` | No visible expression |
|
| 20 |
+
| 1 | `Confused` | Furrowed brow, squinting |
|
| 21 |
+
| 2 | `Smiling_Amused` | Visible smile, laughter |
|
| 22 |
+
| 3 | `Surprised` | Raised eyebrows, open mouth |
|
| 23 |
+
| 4 | `Bored_Tired` | Yawning, blank stare |
|
| 24 |
+
|
| 25 |
+
## Architecture
|
| 26 |
+
|
| 27 |
+
- **Backbone:** VGG16 (ImageNet pre-trained, feature layers frozen)
|
| 28 |
+
- **Classifier head:** `nn.Linear(4096, 5)`
|
| 29 |
+
- **Loss:** Weighted `CrossEntropyLoss` to handle class imbalance
|
| 30 |
+
- **Optimizer:** Adam (lr=0.001)
|
| 31 |
+
- **Input size:** 224 x 224 RGB, ImageNet-normalized
|
| 32 |
+
|
| 33 |
+
## Training
|
| 34 |
+
|
| 35 |
+
Trained on manually annotated person crops extracted from classroom
|
| 36 |
+
lecture videos using YOLOv8-nano detection. 70/10/20 stratified
|
| 37 |
+
train/val/test split.
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import torch
|
| 43 |
+
from torchvision import models
|
| 44 |
+
|
| 45 |
+
model = models.vgg16(weights=None)
|
| 46 |
+
model.classifier[6] = torch.nn.Linear(4096, 5)
|
| 47 |
+
model.load_state_dict(torch.load("best_vgg16.pth", map_location="cpu"))
|
| 48 |
+
model.eval()
|
| 49 |
+
```
|