--- license: mit tags: - pytorch - resnet18 - image-classification - reaction-recognition --- # Classroom Reaction Recognition - ResNet18 A ResNet18 classifier trained to recognize facial reactions of students from cropped person bounding boxes in classroom lecture videos. ## Classes | Index | Label | Description | |-------|------------------|------------------------------------| | 0 | `Neutral` | No visible expression | | 1 | `Confused` | Furrowed brow, squinting | | 2 | `Smiling_Amused` | Visible smile, laughter | | 3 | `Surprised` | Raised eyebrows, open mouth | | 4 | `Bored_Tired` | Yawning, blank stare | ## Architecture - **Backbone:** ResNet18 (ImageNet pre-trained, all layers frozen except fc) - **Classifier head:** `nn.Linear(512, 5)` - **Loss:** Weighted `CrossEntropyLoss` to handle class imbalance - **Optimizer:** Adam (lr=0.001) - **Input size:** 224 x 224 RGB, ImageNet-normalized ## Training Trained on manually annotated person crops extracted from classroom lecture videos using YOLOv8-nano detection. 70/10/20 stratified train/val/test split. ## Usage ```python import torch from torchvision import models model = models.resnet18(weights=None) model.fc = torch.nn.Linear(512, 5) model.load_state_dict(torch.load("best_resnet18.pth", map_location="cpu")) model.eval() ```