How mandar885/traffic_vision works
TrafficVision accepts a traffic video, creates an asynchronous job, analyzes frames for vehicle detections and tracks, updates job analytics, and serves the annotated video and results to a polling React dashboard. The backend separates job/API handling, video processing, and analytics; the frontend separates upload, job polling, and presentation. The job store is in-memory, while uploaded and generated videos use filesystem storage. Unsampled UI and deployment details are omitted; documented capabilities are retained where their implementation is not shown.
Main entry points: jobs.py Job endpoints · video_processor.py Video processing · main.py FastAPI application · Dashboard.tsx Dashboard and results
Components 16
Web interface
- Application shell
frontend/src/App.tsx - Dashboard and results
frontend/src/pages/Dashboard.tsx - Video upload panel
frontend/src/components/UploadPanel.tsx - Job polling hook
frontend/src/hooks/useJob.ts
Job API
- FastAPI application
backend/app/main.py - Job endpoints
backend/app/api/jobs.py - Job response schema
backend/app/schemas/jobs.py
Video analysis
- Video processing
backend/app/services/video_processor.py - YOLO detection and ByteTrack
backend/app/services/video_processor.py - Traffic analytics
backend/app/services/analytics.py
Runtime state
- Model and service settings
backend/app/core/config.py - Filename safety
backend/app/core/security.py - Structured logging
backend/app/core/logging.py - In-memory job store
backend/app/services/job_store.py - Uploaded and result videos
backend/storage
Other components
- Video analyst
Connections 20
- Video analyst → Video upload panel: selects video
frontend/src/components/UploadPanel.tsx - Application shell → Dashboard and results: renders
frontend/src/App.tsx - Dashboard and results → Video upload panel: renders
frontend/src/pages/Dashboard.tsx - Dashboard and results → Job polling hook: uses job state
frontend/src/pages/Dashboard.tsx - Dashboard and results → FastAPI application: requests results
README.md - Job polling hook → FastAPI application: calls job endpoints
frontend/src/hooks/useJob.ts - FastAPI application → Job endpoints: routes jobs
backend/app/main.py - FastAPI application → Model and service settings: loads settings
backend/app/main.py - FastAPI application → Structured logging: configures logging
backend/app/main.py - Job endpoints → Model and service settings: loads settings
backend/app/api/jobs.py - Job endpoints → Filename safety: sanitizes filename
backend/app/api/jobs.py - Job endpoints → Job response schema: serializes response
backend/app/api/jobs.py - Job endpoints → In-memory job store: creates and updates jobs
backend/app/api/jobs.py - Job endpoints → Video processing: dispatches processing
backend/app/api/jobs.py - Job endpoints → Uploaded and result videos: writes and serves videos
backend/app/api/jobs.py - Video processing → In-memory job store: reads and updates jobs
backend/app/services/video_processor.py - Video processing → Model and service settings: loads analysis settings
backend/app/services/video_processor.py - Video processing → YOLO detection and ByteTrack: runs detection and tracking
backend/app/services/video_processor.py - Video processing → Traffic analytics: updates frame analytics
backend/app/services/video_processor.py - Video processing → Uploaded and result videos: reads and writes videos
backend/app/services/video_processor.py