FaultLens
Inspiration
In Vietnam, over 30,000 traffic accidents occur every year. When a collision happens, determining who is at fault becomes a lengthy, subjective process — involving police reports, insurance adjusters, and weeks of back-and-forth between parties. Dashcam footage exists, but reviewing it frame by frame and mapping violations to specific traffic law articles is slow, inconsistent, and often biased. We asked: what if AI could do this in minutes?
What It Does
FaultLens analyzes dashcam video to determine fault percentage between parties in a traffic accident. Upload an MP4 clip, and the system:
- Extracts frames using FFmpeg
- Sends frame batches to GPT-4o Vision for scene analysis, vehicle detection, and violation identification
- Maps each violation to exact Vietnamese traffic law articles
- Calculates fault percentages using weighted scoring with causation multipliers
- Generates a comprehensive report suitable for insurance use
The result is a detailed fault report with AI confidence scores, violation timelines, scene conditions, and a plain-language verdict — all within minutes of upload.
How We Built It
| Layer | Details |
|---|---|
| Video Processing | Node.js API receives the upload, stores it on AWS S3, and extracts frames with FFmpeg at 8fps/720p |
| AI Analysis | Python FastAPI service sends frame batches to OpenAI GPT-4o Vision with a detailed system prompt covering 20+ violation types, collision detection scenarios, and speed estimation calibration |
| Fault Scoring | Custom scoring engine with weighted violations and causation multipliers (proximate = 1.5×, contributing = 1.0×) |
| Report Generation | GPT-4o generates a structured bilingual incident report covering scene conditions, vehicle details, incident narrative, legal arguments, and fault determination |
| Frontend | React SPA with real-time progress tracking showing each pipeline stage — from upload through batch-level AI analysis to final report |
| Infrastructure | PostgreSQL, AWS S3, Nginx reverse proxy with SSL, PM2, and GitHub webhook for auto-deployment |
Challenges We Ran Into
- Collision detection reliability — Getting GPT-4o Vision to consistently detect subtle impacts like reversing collisions or side-swipes. Solved with a dedicated two-pass approach: a general analysis pass followed by a focused collision detection pass on high-motion segments.
- IPv6/IPv4 mismatch between Node.js fetch and the Python service caused silent connection failures.
- Frame extraction trade-offs — Balancing fps and resolution against API cost and analysis quality.
- Hallucination prevention — Tuned confidence thresholds and added intersection-specific rules to prevent false positive violation detections.
Accomplishments We're Proud Of
- ✅ End-to-end MVP — From raw dashcam upload to a fully structured fault report with legal citations, all in under a few minutes.
- ✅ 20+ violation types mapped to exact Vietnamese traffic law articles with weighted fault scoring — not just detection, but legally grounded fault determination.
- ✅ Two-pass collision detection using motion analysis to catch brief impacts that a single GPT-4o pass would miss, achieving 0.90 confidence on turning collisions.
- ✅ Real-time progress tracking — Users see every stage from frame extraction through individual AI batch progress to final report generation.
What We Learned
- GPT-4o Vision is remarkably capable at understanding traffic scenarios from dashcam frames, but prompt engineering is critical — the difference between a vague prompt and a detailed system prompt (with collision scenarios, speed calibration anchors, and Vietnamese traffic law context) is night and day.
- A multi-pass analysis approach (general + collision-specific) catches events that a single pass misses.
- Real-time progress feedback matters — users need to see that the AI is working through batches, not just a spinning loader.
What's Next for FaultLens
- 📷 Multi-camera support (witness video from other angles)
- 📍 GPS track synchronization for speed verification
- 🔤 Traffic sign OCR for speed limit extraction
- 🔗 Insurance API integration for direct claims filing
- 📱 Mobile app for on-scene upload immediately after an accident
Built With
- express.js
- fastapi
- ffmpeg
- nginx
- node.js
- openai
- pm2
- postgresql
- python
- react
- s3
- vite
Log in or sign up for Devpost to join the conversation.