Skip to content

bk1210/Football-Player-Fatigue-Prediction-Wearable-IoT-Sensors-ML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿƒ Football Player Fatigue Prediction โ€” Wearable IoT Sensors & ML

Python scikit-learn TensorFlow Kaggle License

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


๐Ÿ“Œ Overview

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

โœจ Features

๐Ÿท๏ธ Karvonen Fatigue Labeling

  • 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

๐Ÿ“Š Sliding Window Feature Extraction

  • 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

โš–๏ธ SMOTE Class Balancing

  • 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)

๐ŸŒฒ Four Models Evaluated

  • 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

๐Ÿ” LOSO Cross-Validation

  • LeaveOneGroupOut with subject IDs as groups
  • Subject-independent generalization evaluation
  • Exceeds original PAMAP2 benchmark (97.96% vs ~88%)

โšฝ Coach Decision Support Dashboard

  • 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

๐Ÿ–ฅ๏ธ Demo

Fatigue Prediction

Window  โ†’ HR: 158bpm | Accel norm: 8.2 | Over 70 mins played
Output  โ†’ ๐Ÿ”ด HIGH Fatigue โ€” Substitution Recommended

Personalized vs Global (Subject 3)

Global RF (LOSO) โ†’ F1: 48.3%
Personalized RF  โ†’ F1: 100.0%   (+51.7 pp improvement)

๐Ÿš€ Installation

Prerequisites

  • Python 3.8 or higher
  • GPU recommended (Kaggle P100)

Step 1 โ€” Clone the Repository

git clone https://github.com/bk1210/football-fatigue-prediction.git
cd football-fatigue-prediction

Step 2 โ€” Install Dependencies

pip install -r requirements.txt

Step 3 โ€” Download the Dataset

Get 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.

Step 4 โ€” Run the Notebook

jupyter notebook iot_fatigue.ipynb

Or upload directly to Kaggle and run with P100 GPU.


๐Ÿ“– Usage

Running the Full Pipeline

Open iot_fatigue.ipynb and run all cells โ€” the notebook handles:

  1. Data loading from PAMAP2 .dat files (9 subjects, 100 Hz)
  2. Preprocessing โ€” remove transitional segments, interpolate missing values, clip HR to [30, 220]
  3. Karvonen-based three-class fatigue labeling (leakage-free)
  4. Sliding window feature extraction (88 features per window)
  5. SMOTE balancing on training set
  6. Training and evaluating all four models (RF, SVM, LSTM, Personalized RF)
  7. LOSO cross-validation across all 9 subjects
  8. Feature importance analysis
  9. 90-minute football match simulation + coach dashboard

๐Ÿ”„ Pipeline

Pipeline

๐Ÿ—๏ธ Architecture

End-to-End Pipeline

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

Project Structure

football-fatigue-prediction/
โ”‚
โ”œโ”€โ”€ iot_fatigue.ipynb                    # Full pipeline โ€” labeling, training, LOSO, dashboard
โ”œโ”€โ”€ requirements.txt                     # Python dependencies
โ””โ”€โ”€ README.md                            # Project documentation

๐Ÿ“Š Results

Model Comparison โ€” 70/30 Test Split

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%

LOSO Cross-Validation vs Baseline

Method LOSO Accuracy LOSO F1-Macro
Reiss & Stricker (PAMAP2 Benchmark) ~88.0% โ€”
This Work (RF) 97.96% ยฑ 2.57% 87.55% ยฑ 18.69%

Comparison with Base Papers

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

๐Ÿ› ๏ธ Tech Stack

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

๐Ÿ“ฆ Dependencies

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.0

Install with:

pip install -r requirements.txt

๐Ÿ”ฎ Future Improvements

  • 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

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.


๐Ÿ‘ค Contact

Bharath Kesav R


๐Ÿ™ Acknowledgements


โญ If you found this project useful, please give it a star on GitHub! โญ

*Built with โค๏ธ for football/sports analystics and data analytics *

About

Three-class football player fatigue prediction from PAMAP2 wearable IoT data. Karvonen heart rate labeling, SMOTE balancing, LOSO cross-validation, personalized Random Forest. 97.96% LOSO accuracy + coach substitution-alert dashboard.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages