An AI-powered F1 damage detection and race strategy platform that analyzes race footage, generates telemetry data, and provides intelligent pit stop recommendations β all visualized in a stunning 3D interactive car model.
Comprehensive Video Analysis with Gemini 2.0 Flash
- Upload race footage β Get complete damage assessment
- AI-generated synthetic telemetry showing crash impact
- Automatic 3D model updates with highlighted damage
- Natural language pit strategy recommendations
- π€ AI-Powered Damage Detection: Uses Google Gemini 2.0 Flash to analyze race footage and detect damage with confidence scores
- π¨ 3D Interactive Car Model: Real-time visualization of damaged parts with severity-based highlighting
- π Synthetic Telemetry Generation: Creates realistic crash event data showing pre/during/post-crash performance
- π‘ Intelligent Decision Engine: Computes lap time loss, cumulative impact, and AI-powered pit stop recommendations
- π° Budget Analysis: Tracks repair costs against F1 budget cap constraints
- π§ Gemini Reasoning: Natural language explanations for strategic recommendations
- π₯ Video Processing: Multi-frame analysis of uploaded race footage (MP4, MOV, AVI)
- Next.js 15 - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling with custom Williams x Atlassian theme
- Three.js / React Three Fiber - 3D car visualization
- Recharts - Telemetry graphs
- Framer Motion - Animations
- FastAPI - Python web framework
- Google Gemini 2.0 Flash - Vision AI and reasoning
- OpenCV - Video frame extraction
- NumPy - Telemetry data generation
- Uvicorn - ASGI server
- Node.js 20+
- Python 3.9+
- Google Gemini API key (Get one here)
# Install dependencies
npm install
# Create environment file
cp .env.example .env.local
# Add your Gemini API key to .env.local
# Run development server
npm run devVisit http://localhost:3000
# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create environment file
cp ../.env.example .env
# Add your Gemini API key to .env
# Run backend server
python main.pyBackend API will be available at http://localhost:8000
- Start the backend server (see Backend Setup above)
- Start the frontend with
npm run dev - Upload race footage using the "Upload Video" button
- View damage detection results in real-time
- Analyze telemetry data in the bottom graph panel
- Review recommendations in the decision card
- Interact with 3D model to inspect damaged parts
- Simulate pit stops to see predicted outcomes
- Primary:
#00205B(Williams Navy Blue) - Secondary:
#00A3E0(Cyan Blue) - Warning:
#FFC300(Medium damage) - Severe:
#FF5733(Critical damage) - Success:
#2ECC71(Fixed/optimized) - Neutral:
#141414(Background)
Comprehensive video analysis - Returns damage detection, telemetry data, and pit strategy in one call.
Request: multipart/form-data with video file
Response:
{
"crash_description": "Contact with barrier in Turn 4 resulted in front wing damage",
"impact_severity": "High",
"damage_detection": {
"timestamp": "2024-01-15T10:30:45",
"car_id": "RB20",
"detected_parts": [
{"part": "front wing", "severity": 0.75, "confidence": 0.90},
{"part": "left front tire", "severity": 0.45, "confidence": 0.85}
]
},
"telemetry_data": [
{"lap": 1, "speed": 310.2, "throttle": 94.5, "temperature": 84.3, "damage_event": false},
{"lap": 12, "speed": 217.1, "throttle": 47.2, "temperature": 93.8, "damage_event": true}
// ... 50 laps total
],
"decision": {
"recommendation": "Pit Now",
"Ξt_lap": 1.215,
"cum_loss": 46.17,
"pit_loss": 22.5,
"budget_impact": 0.00164,
"suggested_fix": "Replace front wing, left front tire",
"reasoning": "With severe front wing damage causing 1.2s/lap loss..."
}
}Legacy endpoint - damage detection only (see comprehensive endpoint above).
Compute pit stop decision based on damage analysis.
Request:
{
"damaged_parts": [...],
"current_lap": 15,
"total_laps": 58
}Response:
{
"Ξt_lap": 0.263,
"cum_loss": 7.36,
"pit_loss": 22.5,
"budget_impact": 0.086,
"recommendation": "Stay Out",
"suggested_fix": "Replace front wing",
"reasoning": "..."
}Upload telemetry CSV data for analysis.
The decision engine calculates:
- Lap Time Loss =
baseline_lap_time Γ damage_coefficient Γ severity - Cumulative Loss =
lap_time_loss Γ remaining_laps - Budget Impact =
(part_cost + pit_procedure_cost) / season_budget
Recommendations:
- Pit Now: Cumulative loss > pit stop duration AND remaining laps > 5
- Monitor: Lap time loss > 0.2s AND remaining laps > 10
- Stay Out: Otherwise
HackTx25/
βββ app/
β βββ globals.css
β βββ layout.tsx
β βββ page.tsx
βββ components/
β βββ CarModel3D.tsx
β βββ CommandBar.tsx
β βββ DecisionCard.tsx
β βββ TelemetryGraph.tsx
β βββ VideoPanel.tsx
βββ lib/
β βββ decision-engine.ts
β βββ types.ts
βββ backend/
β βββ main.py
β βββ requirements.txt
βββ tailwind.config.ts
βββ next.config.ts
βββ package.json
The application includes mock data for demonstration:
- Pre-configured damaged parts (front wing, tire)
- Simulated telemetry with damage events
- Decision engine calculations
- QUICKSTART.md - Quick setup guide (5 minutes)
- API_GUIDE.md - Complete API documentation
- CHANGES_SUMMARY.md - What's new in this version
- QUICK_REFERENCE.md - Command cheat sheet
Test the backend API:
cd backend
python test_api.py # Basic tests
python test_api.py path/to/video.mp4 # Test with video- Real-time live stream ingestion
- Multi-car comparison
- Official F1 telemetry API integration
- Historical race analysis
- Weather impact modeling
- Advanced ML models for damage prediction
- Gemini 2.5 Pro integration when available
MIT
Built for HackTX 2025