How sakshamsk2409-sys/road-risk-detection works
This repository is a Streamlit ADAS prototype that turns uploaded or sample dashcam video into annotated playback, telemetry, and advisory risk alerts. The primary runtime path is dashboard → video processor → perception, motion/spatial analysis, risk assessment, and rendered output. README capabilities preserve the rider filter, metric distance estimation, cut-in/blind-spot reasoning, and safety guardrails. Training and model evaluation are supporting product capabilities. Some detailed wiring is documented only in the README or SOURCE INDEX; unverified connections are omitted.
Main entry points: video_processor.py Video processor and HUD · app.py Streamlit dashboard · train_risk_model.py Risk model training · detector.py YOLO detection and rider filter
Components 18
Dashboard
- Streamlit dashboard
app.py
Video processing
- Sample video source
src/pipeline/sample_data.py - Video processor and HUD
src/pipeline/video_processor.py - Annotated video and safety telemetry
Road perception
- YOLO detection and rider filter
src/perception/detector.py - Tracking and TTC
src/perception/tracker.py - Monocular distance
src/perception/depth_estimator.py - Lane and cut-in analysis
src/perception/lane_detector.py
Risk intelligence
- Risk feature extraction
src/risk_engine/feature_extractor.py - ML risk and guardrails
src/risk_engine/classifier.py - Risk model training
src/risk_engine/train_risk_model.py - Model evaluation analytics
src/evaluation/evaluator.py
Model assets
- Camera and risk configuration
config/config.py - YOLO weights
yolo11n.pt - Trained risk model
data/models/best_risk_model.joblib - Driving risk dataset
data/training_data/driving_risk_dataset.csv - Model comparison metrics
data/models/model_comparison.json
Other components
- Driver
Connections 22
- Driver → Streamlit dashboard: selects video
README.md - Streamlit dashboard → Sample video source: offers samples
app.py - Streamlit dashboard → Video processor and HUD: starts analysis
README.md - Video processor and HUD → YOLO detection and rider filter: detects objects
README.md - Video processor and HUD → Tracking and TTC: tracks detections
README.md - Video processor and HUD → Monocular distance: estimates range
README.md - Video processor and HUD → Lane and cut-in analysis: analyzes zones
README.md - Video processor and HUD → ML risk and guardrails: evaluates risk
src/pipeline/video_processor.py - ML risk and guardrails → Risk feature extraction: extracts features
src/risk_engine/classifier.py - Video processor and HUD → Annotated video and safety telemetry: renders HUD
README.md - Streamlit dashboard → Annotated video and safety telemetry: presents playback
README.md - Streamlit dashboard → Model evaluation analytics: shows metrics
app.py - YOLO detection and rider filter → YOLO weights: loads weights
README.md - YOLO detection and rider filter → Camera and risk configuration: uses thresholds
src/perception/detector.py - Monocular distance → Camera and risk configuration: uses calibration
src/perception/depth_estimator.py - Lane and cut-in analysis → Camera and risk configuration: uses boundaries
src/perception/lane_detector.py - ML risk and guardrails → Trained risk model: loads model
src/risk_engine/classifier.py - Risk model training → Driving risk dataset: trains on scenes
README.md - Risk model training → Risk feature extraction: uses feature vector
src/risk_engine/train_risk_model.py - Risk model training → Trained risk model: saves selected model
README.md - Risk model training → Model comparison metrics: records benchmarks
README.md - Model evaluation analytics → Model comparison metrics: loads comparisons
src/evaluation/evaluator.py