A machine learning framework that predicts three-class fatigue states in football players from wearable IoT sensor data โ with Karvonen heart rate labeling, SMOTE balancing, LOSO validation, and a real-time coach substitution-alert dashboard.
Features โข How It Works โข Results โข Installation โข Usage โข Architecture โข Tech Stack โข Contact
Football Player Fatigue Prediction repurposes the PAMAP2 physical activity dataset for sports-specific fatigue monitoring. Instead of binary high/low labels, this system introduces a three-class Karvonen-based labeling scheme (LOW / MEDIUM / HIGH) grounded in cardiac physiology โ with zero data leakage into model training.
The project offers three core contributions:
- ๐ท๏ธ Karvonen Auto-Labeler โ assigns fatigue states from heart rate reserve % and movement intensity, then discards intermediates before training to prevent leakage
- ๐ฒ Personalized Random Forest โ per-subject model fine-tuning that handles large inter-individual physiological variation
- โฝ Coach Dashboard โ 90-minute match simulation with real-time fatigue phase tracking and substitution alerts
- Heart rate reserve % computed via the Karvonen formula (HRrest=60, HRmax=195)
- Movement intensity as Euclidean norm of chest accelerometer
- Three classes: LOW (light cardiac load + high movement), HIGH (cardiac drift), MEDIUM (otherwise)
- Intermediate features discarded after labeling โ fully leakage-free
- 512-sample windows (~5.12s at 100 Hz), 50% overlap
- 11 statistical descriptors per channel: mean, std, min, max, median, Q1/Q3, RMS, range, MAD, energy
- 8 channels ร 11 features = 88 features per window
- Majority vote label assignment per window
- Original distribution heavily skewed toward MEDIUM (83.4%)
- SMOTE (k=3) applied exclusively on training set
- Balanced to 451 samples per class (1,353 total)
- Random Forest โ 200 trees, max depth 20, balanced class weights
- SVM (RBF kernel) โ C=10, gamma=scale, balanced class weights
- LSTM โ 2-layer (64โ32 units), BatchNorm + Dropout, early stopping
- Personalized RF โ dedicated per-subject model with subject-level SMOTE
- LeaveOneGroupOut with subject IDs as groups
- Subject-independent generalization evaluation
- Exceeds original PAMAP2 benchmark (97.96% vs ~88%)
- 90-minute match simulation with phase-by-phase fatigue profiling
- LOW โ MEDIUM transition through first half, HIGH accumulation in final 20 minutes
- Visual heart rate, movement intensity, and fatigue class timeline
- Substitution alert triggered when HIGH fatigue detected
Window โ HR: 158bpm | Accel norm: 8.2 | Over 70 mins played
Output โ ๐ด HIGH Fatigue โ Substitution Recommended
Global RF (LOSO) โ F1: 48.3%
Personalized RF โ F1: 100.0% (+51.7 pp improvement)
- Python 3.8 or higher
- GPU recommended (Kaggle P100)
git clone https://github.com/bk1210/football-fatigue-prediction.git
cd football-fatigue-predictionpip install -r requirements.txtGet the PAMAP2 dataset from UCI: ๐ PAMAP2 Physical Activity Monitoring Dataset
Place the subject .dat files inside a PAMAP2_Dataset/Protocol/ folder in the project root.
jupyter notebook iot_fatigue.ipynbOr upload directly to Kaggle and run with P100 GPU.
Open iot_fatigue.ipynb and run all cells โ the notebook handles:
- Data loading from PAMAP2
.datfiles (9 subjects, 100 Hz) - Preprocessing โ remove transitional segments, interpolate missing values, clip HR to [30, 220]
- Karvonen-based three-class fatigue labeling (leakage-free)
- Sliding window feature extraction (88 features per window)
- SMOTE balancing on training set
- Training and evaluating all four models (RF, SVM, LSTM, Personalized RF)
- LOSO cross-validation across all 9 subjects
- Feature importance analysis
- 90-minute football match simulation + coach dashboard
PAMAP2 Raw Data (9 subjects, 100 Hz, 54 channels)
โ
โผ
Preprocessing
[Remove activityID=0 | Interpolate NaN | Clip HR to 30-220 bpm]
โ
โผ
Fatigue Label Creation (Karvonen Formula) โ Core Contribution
โโโบ HRR% = (HR - HRrest) / (HRmax - HRrest)
โโโบ Movement Intensity = โ(axยฒ + ayยฒ + azยฒ)
โ
โผ
LOW / MEDIUM / HIGH โ intermediates discarded (leakage-free)
โ
โผ
Sliding Window Feature Extraction
[512 samples | 50% overlap | 8 channels ร 11 stats = 88 features]
โ
โผ
SMOTE Balancing (training set only, k=3)
โ
โโโโบ Random Forest (200 trees, depth 20)
โโโโบ SVM RBF (C=10, gamma=scale)
โโโโบ LSTM (64โ32 units, BatchNorm, Dropout)
โโโโบ Personalized RF (per-subject, 80/20 split)
โ
โผ
Evaluation: 70/30 Test Split + LOSO Cross-Validation
โ
โผ
Coach Dashboard โ 90-min Match Simulation + Substitution Alerts
football-fatigue-prediction/
โ
โโโ iot_fatigue.ipynb # Full pipeline โ labeling, training, LOSO, dashboard
โโโ requirements.txt # Python dependencies
โโโ README.md # Project documentation
| Model | Accuracy | F1-Macro |
|---|---|---|
| Random Forest | 97.56% | 76.23% |
| SVM (RBF) | 94.15% | 63.96% |
| LSTM | 91.22% | 57.85% |
| Personalized RF | 97.87% | 79.93% |
| Method | LOSO Accuracy | LOSO F1-Macro |
|---|---|---|
| Reiss & Stricker (PAMAP2 Benchmark) | ~88.0% | โ |
| This Work (RF) | 97.96% ยฑ 2.57% | 87.55% ยฑ 18.69% |
| Criterion | Krishnaleela & Prakash (2025) | Liu et al. (2023) | This Work |
|---|---|---|---|
| Dataset | PAMAP2 | Own (proprietary) | PAMAP2 |
| Task | HAR (18 classes) | Fatigue (binary) | Fatigue (3-class) |
| SMOTE | No | No | โ Yes |
| LOSO | No | No | โ Yes |
| Personalized | No | No | โ Yes |
| Performance | 99.86% Acc | 94.15% Acc | 97.87% Acc / 79.93% F1 |
| Technology | Purpose |
|---|---|
| Python 3.8+ | Core language |
| scikit-learn | RF, SVM, SMOTE, LOSO, metrics |
| TensorFlow 2.19 | LSTM model training |
| imbalanced-learn | SMOTE oversampling |
| NumPy / Pandas | Feature engineering, sliding window |
| Matplotlib / Seaborn | EDA, training curves, dashboard |
| Kaggle (P100 GPU) | Training environment |
numpy>=1.24.0
pandas>=2.0.0
scikit-learn>=1.3.0
imbalanced-learn>=0.11.0
tensorflow>=2.19.0
matplotlib>=3.7.0
seaborn>=0.12.0Install with:
pip install -r requirements.txt- Collect a football-specific dataset with GPS + continuous HR from professional players
- Raw 100 Hz stream modeling with CNN-BiLSTM on full time-series
- On-device edge inference using optimized BiLSTM
- Multi-task learning โ joint activity type + fatigue state prediction
- Prospective validation linking HIGH-fatigue episodes to injury occurrence
- Real-time MQTT streaming pipeline for live match deployment
This project is licensed under the MIT License โ see the LICENSE file for details.
Bharath Kesav R
- ๐ง Email: bharathkesav1275@gmail.com
- ๐ GitHub: @bk1210
- ๐ Institution: Amrita Vishwa Vidyapeetham, Coimbatore
- Reiss & Stricker (2012) โ for the PAMAP2 dataset
- Liu et al. (2023) โ Base paper on wearable fatigue detection
- Op de Beeck et al. (2018) โ Personalization motivation
โญ If you found this project useful, please give it a star on GitHub! โญ
*Built with โค๏ธ for football/sports analystics and data analytics *
