A machine learning–driven Formula 1 telemetry analysis platform that breaks down driver performance at a segment level — using braking zones, throttle traces, and speed data to reveal exactly where time is lost and won on track.
- Pulls real session data via the FastF1 API with local caching
- Supports any circuit, season, and session type (Race, Qualifying, Practice)
- Configurable driver comparison — just change three lines
- Automatically detects braking zones as natural segment boundaries
- Filters out micro-segments with too few data points
- Each segment becomes one row of ML-ready features
- Random Forest Classifier predicts the faster driver per track segment
- Trained on all quick laps — not just a single lap
- Features engineered from raw telemetry: speed, throttle, brake ratio, segment length
| Visualization | What it shows |
|---|---|
| Braking Zone Map | Where each driver initiates braking on track |
| Speed Heatmap | Racing line colored by speed — red = slow, green = fast |
| Time Loss Map | Exactly where on track each driver gains or loses time |
| Braking Distance Markers | Who brakes later, and by how many metres, at each corner |
| Synchronized Telemetry | Speed + throttle + brake traces overlaid, aligned by distance |
| Corner Cards | Per-corner breakdown: braking point, min speed, exit throttle |
| Consistency Dashboard | Lap-over-lap variation across all quick laps with tire deg correction |
FastF1 API
│
▼
Session Load (Race / Qualifying / Practice)
│
▼
Lap Filtering (pick_quicklaps)
│
├──► Segmentation by Braking Zones
│ │
│ ▼
│ Feature Extraction per Segment
│ │
│ ▼
│ Random Forest Classifier
│ │
│ ▼
│ Model Verdict + Visualizations
│
└──► Fastest Lap Telemetry
│
▼
Speed Heatmap / Time Loss Map /
Braking Markers / Corner Cards /
Synchronized Traces
F1-Telemetry/
│
├── F1_main.py # Entry point — session config, ML pipeline, visualization calls
├── F1_segmentation.py # Braking zone detection and lap segmentation
├── F1_features.py # Feature engineering — converts segments to ML rows
├── F1_visualization.py # All plotting functions
├── F1_telemetry.py # Standalone qualifying telemetry comparison tool
│
├── segments_dataset.csv # Auto-generated ML dataset
├── cache/ # FastF1 session cache (auto-created)
└── assets/ # Output screenshots for README
pip install fastf1 pandas matplotlib scikit-learn scipy seabornRequires Python 3.9+. FastF1 will auto-download session data on first run and cache it locally.
- Open
F1_main.pyand set your session at the top:
circuit = "Suzuka"
season = 2025
session_type = "R" # R = Race, Q = Qualifying, FP1/FP2/FP3
driver1 = "VER"
driver2 = "NOR"- Run:
python F1_main.pyAll plots will render sequentially. The dataset is saved automatically as segments_dataset.csv.
| Feature | Description |
|---|---|
avg_speed |
Mean speed through the segment |
min_speed |
Minimum speed (corner apex proxy) |
max_speed |
Maximum speed through the segment |
avg_throttle |
Mean throttle application |
brake_ratio |
Fraction of segment spent braking |
segment_length |
Distance covered in the segment (metres) |
- Binary: which driver is faster through this segment (
0= driver1,1= driver2)
RandomForestClassifier— 200 estimators, max depth 6- 80/20 train/test split, stratified
- Evaluated with accuracy score + classification report
- Driver Fingerprinting — unsupervised clustering to identify driving style signatures
- Anomaly Detection — automatically flag unusual laps (lock-ups, traffic, mistakes)
- SHAP Explainability — show why the model picked a winner per segment
- Tire Degradation Modelling — predict pace drop-off curves per driver
- Overtaking Opportunity Heatmap — score each track section for attack likelihood
- Optimal Lap Reconstruction — simulate a theoretical best lap from race data
- Web Dashboard — interactive Plotly/Dash interface
- Multi-driver comparison — extend beyond two drivers
Open to improvements, bug fixes, and feature additions. Feel free to fork and open a PR.
MIT









