How dharanishvijayakumar7-lgtm/ai_driving_assistant works
AI Driving Assistant processes webcam or video frames into tracked objects, lane geometry, estimated distances, collision risk, and debounced alerts. Its main result path runs through the staged vision pipeline; users can view annotated output locally or receive frames and metadata in a React dashboard over WebSocket. The README documents the stage sequence and dashboard flow; source excerpts and the SOURCE INDEX support component ownership, but not every internal call is shown.
Main entry points: frame_processor.py Frame Processor · websocket_handler.py WebSocket Stream · App.jsx Dashboard App · video_source.py Video Source
Components 30
Entry and API
- Local Runner
src/main.py - FastAPI App
src/api/app.py - WebSocket Stream
src/api/websocket_handler.py - Frame Payload
src/api/schemas.py
Frame Pipeline
- Video Source
src/pipeline/video_source.py - Frame Processor
src/pipeline/frame_processor.py - Frame Resize
src/pipeline/resize_stage.py
Road Perception
- Object Detection
src/detection/stage.py - YOLO Detector
src/detection/detector.py - Object Tracker
src/detection/tracker.py - Lane Detection
src/lanes/stage.py - Lane Detector
src/lanes/lane_detector.py - Depth Estimation
src/depth/stage.py - MiDaS Estimator
src/depth/depth_estimator.py - Depth Utilities
src/depth/depth_utils.py
Risk and Alerts
- Collision Fusion
src/fusion/stage.py - TTC Estimator
src/fusion/collision_estimator.py - Distance History
src/fusion/object_history.py - Alert Stage
src/alerts/stage.py - Alert Manager
src/alerts/alert_manager.py - Sound Alert
src/alerts/sound_alert.py
Display Clients
- Frame Renderer
src/visualization/display.py - WebSocket Hook
frontend/src/hooks/useWebSocketStream.js - Dashboard App
frontend/src/App.jsx - Video Feed
frontend/src/components/VideoFeed.jsx - Alert Banner
frontend/src/components/AlertBanner.jsx - Object Panel
frontend/src/components/ObjectPanel.jsx - Stats Bar
frontend/src/components/StatsBar.jsx
Other components
- Driver
- Dashboard User
Connections 34
- Driver → Video Source: provides video
- Video Source → Frame Processor: supplies frames
- Frame Processor → Frame Resize: runs stages
- Frame Processor → Object Detection: runs stages
- Frame Processor → Lane Detection: runs stages
- Frame Processor → Depth Estimation: runs stages
- Frame Processor → Collision Fusion: runs stages
- Frame Processor → Alert Stage: runs stages
- Object Detection → YOLO Detector: uses
src/detection/stage.py - Object Detection → Object Tracker: uses
src/detection/stage.py - Lane Detection → Lane Detector: uses
src/lanes/stage.py - Depth Estimation → MiDaS Estimator: estimates depth
src/depth/stage.py - Depth Estimation → Depth Utilities: extracts distances
src/depth/stage.py - Collision Fusion → TTC Estimator: computes TTC
src/fusion/stage.py - TTC Estimator → Distance History: uses history
src/fusion/collision_estimator.py - Alert Stage → Alert Manager: manages alerts
src/alerts/stage.py - Alert Manager → Sound Alert: plays optional beep
src/alerts/alert_manager.py - Local Runner → Video Source: opens source
src/main.py - Local Runner → Frame Processor: builds pipeline
src/main.py - Local Runner → Frame Renderer: shows frames
src/main.py - Driver → FastAPI App: opens dashboard stream
- FastAPI App → WebSocket Stream: routes stream
src/api/app.py - WebSocket Stream → Video Source: opens source
src/api/websocket_handler.py - WebSocket Stream → Frame Processor: builds pipeline
src/api/websocket_handler.py - WebSocket Stream → Frame Payload: packs metadata
src/api/websocket_handler.py - WebSocket Stream → Dashboard User: streams frames and JSON
- Dashboard User → WebSocket Hook: connects stream
- WebSocket Hook → Dashboard App: provides stream state
frontend/src/App.jsx - Dashboard App → Video Feed: renders frames
frontend/src/App.jsx - Dashboard App → Alert Banner: renders alerts
frontend/src/App.jsx - Dashboard App → Object Panel: renders objects
frontend/src/App.jsx - Dashboard App → Stats Bar: renders stats
frontend/src/App.jsx - Alert Stage → Frame Renderer: annotates frames
- Frame Renderer → WebSocket Stream: provides annotated frames
src/api/websocket_handler.py