Inspiration

  • Crash claims can take weeks because videos are hard to review and people disagree on what happened.
  • In the U.S., there are over 6 million police‑reported crashes every year (NHTSA). That’s a lot of footage that isn’t analyzed well.
  • Dashcams and traffic cameras are everywhere now. We wanted a tool that could watch a video, tell the story clearly, and point to the exact California Vehicle Code rules.

What it does

AutoVision turns dashcam/traffic footage into clear answers:

  • Detects and tracks vehicles and people (YOLOv8 + tracking).
  • Flags likely violations (red light, speeding, unsafe lane change, failure to yield).
  • Estimates motion/speed with context and confidence.
  • Lets you chat with a legal assistant that cites real CA Vehicle Code rules (84+ rules).
  • Gives you a clean web UI to upload, browse incidents, view timelines, and download the annotated video.

How we built it

  • Frontend: React + Material UI for a simple dashboard (upload, incidents list, timeline, video player, chat).
  • Backend: Flask API for upload, analysis, case data, video streaming, and chat (backend/api/app.py).
  • Computer Vision: YOLOv8 for detection, OpenCV for video processing, tuned tracker settings to keep stable IDs.
  • Legal AI: LLaMA 3.1 (runs locally via Ollama) + RAG (ChromaDB + Sentence Transformers) to pull the most relevant CA rules.
  • Data: Saves analysis as JSON in per‑case folders with thumbnails, visualizations, and an output video.

Challenges we ran into

  • Too many false detections at first:
    • Fix: class‑based thresholds + temporal consistency filters to reduce noise without losing real objects.
  • Keeping IDs stable when things go behind other objects (occlusions):
    • Fix: tuned tracker (age, IOU), kept tracks alive slightly longer, and processed every 2nd frame to stay fast while stable.
  • Estimating speed from 2D video:
    • Fix: optical flow + timing; we show estimates with context and make calibration optional for better accuracy.
  • AI “hallucinations” in legal answers:
    • Fix: moved to RAG so answers are grounded in the 84 rules we store.
  • Performance for longer videos:
    • Fix: background jobs, frame‑skipping (every 2nd frame), mid‑video thumbnails, and a progress stream.

Accomplishments that we’re proud of

  • An end‑to‑end flow: upload -> analyze -> visualize -> chat -> download.
  • A local legal assistant that cites real CA Vehicle Code (84+ rules), no internet or API keys needed.
  • A simple UI that makes analysis results easy to understand (incidents, timeline, people/vehicles, video playback).
  • Better tracking and fewer false positives with practical filters and tuned parameters.
  • Straightforward APIs you can test right away (/api/upload, /api/analyze, /api/cases, /api/legal-chat, /api/chat-enhanced).

What we learned

  • Finishing the full loop matters more than perfect models. UI and reliability make a big difference.
  • Good legal answers depend on good retrieval; prompts alone aren’t enough.
  • Showing “why” (rules cited, confidence, timeline) builds trust in the results.
  • Logs and progress updates save a ton of debugging time.
  • Running locally avoids API costs and keeps footage private.

What’s next for AutoVision

  • Real‑time streaming for live cameras.
  • Quicker analysis by reducing computation time
  • Add more states beyond California.z
  • Mobile upload and on‑scene capture.
  • Built‑in calibration tools for more accurate speeds.
  • Accounts/roles and secure sharing.
  • Exportable, polished PDF reports with visuals and citations.

Built With

Share this project:

Updates