State-of-the-art human action recognition model trained on Stanford 40 Actions dataset. GitHub project link -> human-action-classification
Demo
Model Description
This model performs real-time human action classification from images, recognizing 40 different human activities. It combines a ResNet34 backbone with optional MediaPipe pose estimation for enhanced accuracy.
Please note that the proposed train-test split is a bit unconventional, which is why I had to create a custom train-test split of 80-20, which is a standard in machine learning practises.
Training Procedure
Preprocessing
python
1# Training augmentation2transforms.Compose([3 transforms.RandomResizedCrop(224),4 transforms.RandomHorizontalFlip(),5 transforms.ColorJitter(brightness=0.2, contrast=0.2),6 transforms.ToTensor(),7 transforms.Normalize(mean=[0.485,0.456,0.406],8 std=[0.229,0.224,0.225])9])
Training Hyperparameters
Backbone: ResNet34 (ImageNet pretrained)
Optimizer: AdamW
Learning rate: 1e-3 → 1e-5 (cosine decay)
Weight decay: 1e-3
Batch size: 32
Epochs: 200
Augmentation: Mixup (α=0.4)
Scheduler: CosineAnnealingLR
Training Hardware
GPU: NVIDIA RTX 4070 Super (12GB)
Training time: ~0.5 hours
Framework: PyTorch 2.0+
This approach reduced overfitting from 99% train / 62% test → 82% train / 86% test.
Evaluation
python
1from hac.evaluation import evaluate_model
23# Evaluate on test set4metrics = evaluate_model(5 checkpoint='resnet34_best.pth',6 data_dir='stanford40/',7 split='test'8)910print(f"Accuracy: {metrics['accuracy']:.2%}")11print(f"F1-Score: {metrics['f1_macro']:.4f}")
Limitations
Trained on Stanford 40 which has limited diversity
Best performance on indoor/outdoor daily activities
May struggle with unusual camera angles or occlusions
Requires clear view of person performing action
Not suitable for fine-grained action recognition (e.g., different sports moves)
Bias and Fairness
The model inherits biases from the Stanford 40 dataset:
Limited demographic diversity
Western-centric activities
Imbalanced class distribution
Users should evaluate performance on their specific use case.
Citation
bibtex
1@software{saksena2025hac,
2 author = {Saksena, Saumya Kumaar},
3 title = {Human Action Classification v2.0},
4 year = {2025},
5 url = {https://github.com/dronefreak/human-action-classification},
6 version = {2.0}
7}