Skip to content

Sarvpreet-Kaur/SmartRoute_DynamicTrafficControl

Repository files navigation

🚦 Dynamic Traffic Control / Smart Route (Real-Time System)

Problem 🚧

Urban traffic management systems predominantly rely on static or preconfigured signal timings, which are unable to adapt to real-time traffic conditions such as congestion surges, accidents, or emergency vehicle movement. This results in inefficient traffic flow, increased waiting times, higher fuel consumption, and delayed emergency response. Existing systems lack robust real-time sensing, analytics, and decision-making capabilities required for modern smart city environments.


Existing Solutions 🕰️

Conventional traffic control systems are primarily based on fixed-time scheduling or limited adaptive strategies derived from historical traffic data. These approaches:

  • React slowly to sudden or unpredictable traffic changes
  • Lack seamless integration between sensing, analytics, and control layers
  • Do not provide reliable prioritization for emergency vehicles
  • Offer limited scalability in dense and highly dynamic urban environments

Our Solution 💡

This project implements a real-time, event-driven traffic control system that dynamically adapts signal timings using live multi-sensor inputs. The system processes traffic video streams, performs vehicle detection and classification, and computes lane-wise congestion metrics. A low-latency control algorithm uses these metrics to optimize traffic signal behavior in real time. Emergency vehicle detection and prioritization are integrated into the control pipeline to ensure faster and safer intersection clearance.


System Architecture 🧩

The system follows a modular, event-driven architecture designed for scalability, low latency, and real-time responsiveness.

Core Components:

  • Video Ingestion & Frame Sampling: Captures live traffic video and extracts frames at fixed intervals for efficient processing 🎥
  • Inference & Analytics Service: Performs real-time vehicle detection and classification to generate lane-wise traffic metrics 🧠
  • Event Management Layer: Aggregates multi-sensor events (vision, audio, RFID) and determines system operational mode ⚙️
  • Control Algorithm Service: Executes adaptive signal timing and emergency override logic based on live events 🚦
  • Visualization Dashboard: Provides real-time monitoring of traffic states, control decisions, and emergency alerts 📊

This decoupled design enables fault isolation, scalability, and easy integration of additional sensing modules.


Data Flow and Algorithm Overview 🔄

Data Flow

  1. Live traffic video streams are ingested and sampled 🎥
  2. Sampled frames are processed by the inference service for vehicle detection and classification
  3. Lane-wise traffic metrics and priority indicators are published as events
  4. The event manager evaluates incoming events and determines normal or emergency operation
  5. The control algorithm computes optimal signal timings or emergency overrides
  6. Decisions and analytics are streamed to the dashboard for real-time visualization 📡

Control Algorithm Overview 🧮

  • Normal Mode:

    • Computes lane-wise congestion using real-time vehicle counts
    • Dynamically allocates green-signal durations to balance traffic flow
  • Emergency Mode:

    • Triggered by verified emergency events
    • Overrides standard scheduling to immediately clear the affected lane 🚑
    • Maintains priority until the emergency vehicle exits the intersection

The algorithm is optimized for deterministic execution and low-latency response.


Performance Metrics 📈

System performance was evaluated using quantitative and qualitative metrics to assess real-time efficiency and reliability:

  • Vehicle Detection Accuracy: Achieved up to 91% accuracy under varying traffic densities
  • End-to-End Decision Latency: Maintained below real-time operational thresholds
  • Emergency Response Time Reduction: Significant reduction in clearance delay for emergency vehicles 🚨
  • Intersection Throughput Improvement: Improved vehicle flow compared to static signal timing
  • System Stability: Reliable operation under continuous real-time sensor input

Evaluation Methodology 🧪

The system was evaluated using controlled traffic video datasets and simulated real-world scenarios:

  1. Scenario-Based Testing:

    • Normal traffic flow
    • High congestion scenarios
    • Emergency vehicle detection and clearance
  2. Comparative Analysis:

    • Adaptive control vs. fixed-time scheduling
    • Latency, throughput, and emergency clearance time measurements
  3. Stress Testing:

    • Continuous real-time data ingestion
    • Validation of event-handling performance under peak load
  4. Visualization-Based Validation:

    • Dashboard-based verification of detection accuracy and control decisions 📊

System Capabilities ✅

  • Real-time vehicle detection and lane-wise traffic analysis
  • Adaptive traffic signal control using live congestion metrics
  • Emergency vehicle detection with priority-based signal override
  • Event-driven decision-making with minimal processing latency
  • Real-time monitoring and operational transparency

Technology Stack 🛠️

  • Programming Language: Python
  • Backend Framework: FastAPI
  • Architecture Pattern: Event-Driven Microservices
  • Inference & Analytics: Real-Time Computer Vision Pipelines
  • Communication: REST APIs and WebSocket streaming
  • Visualization: Interactive Real-Time Dashboard

Key Differentiators ⭐

  • Low-latency, real-time control optimized for dynamic traffic conditions
  • Event-driven backend enabling scalable and reliable sensor data ingestion
  • Integrated emergency vehicle prioritization within the control logic
  • Unified sensing, inference, analytics, and control workflows
  • Designed for smart city and intelligent transportation systems

Future Enhancements 🚀

  • Multi-intersection coordination and green-wave optimization
  • Reinforcement learning–based traffic signal control
  • Vehicle-to-Infrastructure (V2I) communication support
  • Edge deployment for reduced network latency

License 📄

This project is intended for academic, research, and prototyping purposes.
Reuse or extension is permitted with appropriate attribution.


About

Real-time, event-driven traffic signal control system using Python and FastAPI, enabling adaptive signal optimization with 91% detection accuracy.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors