VISIONALTRIX is a demo stack that blends a FastAPI backend, an LSTM autoencoder, and a cinematic landing experience to illustrate how Formula 1 crash telemetry can transfer to consumer Advanced Driver Assistance Systems (ADAS). The repository ships with synthetic telemetry generators, trained model weights, and rich front-end storytelling (hero page, model training console, live visual simulator, and impact dashboard).
- Highlights
- Project Layout
- Prerequisites
- Quick Start
- Synthetic Telemetry + Training
- Testing
- 3D Assets
- Troubleshooting
- Immersive hero experience -
index1.htmlcombines a gradient-lit hero, animated stats, and a GLB Formula 1 car rendered with<model-viewer>for the instant "wow". - Interactive AI model console -
ai-model.htmlexposes inference controls, feature insights, and live output cards driven directly by the FastAPI/api/inferendpoint. - WebGL scenario playback -
visual.htmluses Three.js to re-run wet-lane overtakes and show before/after ADAS behaviour. - Results dashboard -
result.htmlsummarises risk deltas, braking improvements, and scenario coverage in an executive-friendly board. - Machine learning backbone -
inference.py,src/model.py, andtrain_anomaly.pyimplement an LSTM autoencoder and calibration pipeline for crash-risk scoring. - Synthetic data tooling -
generate_telemetry.pyand thetelemetry_synth/bundles can be used to quickly regenerate or augment telemetry sequences for experimentation.
project-root/
|-- app.py # FastAPI application serving HTML + inference endpoints
|-- index1.html # Hero landing page (source of truth for nav styling)
|-- ai-model.html # AI training & inference microsite
|-- visual.html # Three.js live scenario demo
|-- result.html # Executive impact summary page
|-- inference.py # Inference orchestration and risk post-processing
|-- src/
| |-- dataset.py # PyTorch dataset + dataloader helpers
| `-- model.py # LSTM autoencoder definition
|-- train_anomaly.py # Training script for the autoencoder
|-- generate_telemetry.py # Synthetic telemetry generator (CSV + JSONL bundles)
|-- telemetry_synth/ # Pre-generated telemetry bundles
|-- models/ # Persisted weights (expects best_model.pth)
|-- tests/test_demo_payload.py # Smoke test for inference calibration
|-- f1_2023_mercedes_*.glb # Blender-exported W14 model rendered on the hero
`-- data*, data_generated/ # Optional raw + processed training data
- Python 3.10+ recommended.
- Python packages (install via
pip install ...):fastapi,uvicorn[standard]pydantictorch,numpy,pandasscikit-learn(for metrics inside training scripts)python-dotenv(optional, if you later externalise config)
- Node.js is not required; the front-end pages are static assets served by the API.
If you are running on CPU-only hardware, ensure you install the CPU build of PyTorch (pip install torch --index-url https://download.pytorch.org/whl/cpu).
From a PowerShell prompt:
cd C:\Users\Urvansh\OneDrive\Desktop\Altrix-1
pip install fastapi "uvicorn[standard]" torch numpy pandas scikit-learn pydantic
uvicorn app:app --reloadThe server now listens on http://127.0.0.1:8000.
Once the server is running, open the following routes in a browser:
http://127.0.0.1:8000/index1.html- hero landing page (root/also falls back here).http://127.0.0.1:8000/ai-model.html- AI model training & inference walkthrough.http://127.0.0.1:8000/visual.html- Live scenario simulator.http://127.0.0.1:8000/result.html- Impact dashboard.
All navigation bars now reference index1.html, so intra-site links resolve without 404s.
| Method | Route | Description |
|---|---|---|
| GET | /api/health |
Simple readiness probe (status, device, model path). |
| GET | /api/model-metadata |
Returns cached calibration metadata and feature hints. |
| POST | /api/infer |
Runs inference on telemetry payloads and returns risk. |
Example inference request:
curl -X POST http://127.0.0.1:8000/api/infer \
-H "Content-Type: application/json" \
-d '{"telemetry": "speed: 214, yaw_rate: 17.6, lateral_g: 3.2, brake_pressure: 0.4"}'The response contains crash_probability, risk_band, recommended safety actions, and feature attributions derived from inference.py.
-
Generate fresh telemetry samples:
python generate_telemetry.py
Outputs land in
telemetry_synth/and mirror the structure expected by the training pipeline. -
Train (or re-train) the LSTM autoencoder:
python train_anomaly.py
The script reads sequences from
data_generated/train/, computes feature statistics, trains for the configured epochs, and writes updated weights + metadata intomodels/. Ensure the resultingbest_model.pthis present soinference.pycan load it. -
Model code lives in
src/model.py; dataset and batching helpers are insrc/dataset.py.
Run the bundled smoke test to make sure inference outputs stay calibrated:
python -m unittest tests/test_demo_payload.pyThe test shields against significant probability drift for the published demo payload. Extend this module with additional regression or integration tests as needed.
f1_2023_mercedes_amg_w14_e_performance_s1.glbis loaded via<model-viewer>on the landing page. Keep it in the repository root so the FastAPI route/f1_2023_mercedes_amg_w14_e_performance_s1.glbcan serve it without extra configuration.- The hero model enters with a GSAP bounce animation defined in
index1.html. Adjustcamera-orbit,camera-target, or the.car-modeltransform to tweak the presentation.
- 404 for static pages/models - ensure you start the FastAPI app from the repo root so relative paths resolve. The app mounts the current directory under
/assetsand exposes explicit routes for each HTML page and the GLB file. - PyTorch GPU warnings - the code automatically falls back to CPU (
torch.cuda.is_available()guard). Install the appropriate torch build for your hardware. - Large telemetry bundles - the synthetic datasets are sizeable (tens of MB each). If disk space is a concern, regenerate smaller bundles via
generate_telemetry.pywith custom parameters. - Navigation bar overlap on mobile - the nav wraps below 720 px width. If you add items, mirror the adjustments in each page's
@media (max-width: 720px)rule.
Enjoy exploring how F1 telemetry can harden road-car safety systems!