VisionX is a next-generation traffic optimization system built for Smart India Hackathon 2026. It replaces inefficient fixed-time traffic lights with a Deep Reinforcement Learning (DQN) agent that dynamically manages intersection phases in real-time, reducing total waiting vehicles by over 85%.
- 🧠 Reinforcement Learning Core: A 64-neuron PyTorch DQN trained via Experience Replay to optimize traffic flow dynamically.
- ⏱️ Dynamic Green Timing: Automatically calculates optimal phase durations (10s – 45s) based on live queue lengths.
- 🚨 Emergency Overrides: Manual UI triggers to instantly clear routes for Ambulances or enforce "Police All-Stop" red lights.
- 🌐 Full-Stack Dashboard: A live React.js dashboard communicating with the AI via a Node.js synchronization bridge.
This project uses a hybrid OS architecture. The graphical interface and server run on Windows, while the AI training and simulation physics run on WSL (Ubuntu/Linux) for maximum GPU efficiency.
VisionX-Smart-Traffic/
├── ai_agent/ # PyTorch Model & SUMO Simulation (Run in WSL)
│ ├── rl_agent.py # Training script
│ └── run_demo.py # Production script (Used for Pitch)
├── backend/ # Node.js Data Bridge (Run in Windows PowerShell)
│ └── server.js
└── frontend/ # React Dashboard (Run in Windows PowerShell)
└── src/App.jsx
Before running the system, ensure you have the following installed:
| Environment | Requirement |
|---|---|
| Windows | Node.js (v16+) |
| WSL / Linux | Python 3.10+, PyTorch, NumPy, Requests |
| WSL / Linux | Eclipse SUMO (Simulation of Urban MObility) |
Note: Ensure
SUMO_HOMEis added to your WSL environment variables after installing SUMO.
Open a Windows PowerShell or Command Prompt terminal.
cd backend
npm install express corsOpen a second Windows PowerShell terminal.
cd frontend
npm install
npm install -D tailwindcss postcss autoprefixerOpen your WSL / Ubuntu terminal.
cd ai_agent
pip install torch numpy requests traci
⚠️ IMPORTANT: Because the AI agent runs inside WSL and the backend server runs on Windows, you must manually link their IP addresses before running the demo.
- Run
ipconfigin Windows PowerShell and copy your IPv4 Address (e.g.,192.168.1.15). - Open
ai_agent/run_demo.pyand replace theBACKEND_URLvariable with your actual IP address:
BACKEND_URL = "http://192.X.X.X:3000" # Replace with your IPv4Launch the three components in this exact order to ensure the backend is ready before the AI begins sending data.
cd backend
node server.js
# Expected Output: 🚀 Pro Bridge Active on Port 3000cd frontend
npm run dev
# Then open http://localhost:5173 in your browsercd ai_agent
python3 run_demo.py
# Expected Output: 🚦 Production Agent Live. Listening for React Overrides...The SUMO GUI will open automatically. The React Dashboard will instantly sync and begin displaying live traffic data.
Our rigorous TraCI simulation tests prove the superiority of the DQN model:
| Metric | Baseline (30s Fixed Cycle) | VisionX AI |
|---|---|---|
| Max queue per lane | 10+ vehicles | 2–3 vehicles |
| Cumulative wait time | High (cascading jams) | ~85% reduction |
| Adaptability | None | Real-time dynamic |
📈 See
real_ai_comparison.pngin the repository for the full benchmark data plot.
| Layer | Technology |
|---|---|
| AI / ML | PyTorch (DQN), TraCI |
| Simulation | Eclipse SUMO |
| Backend | Node.js, Express |
| Frontend | React.js, Tailwind CSS |
| OS Bridge | WSL2 (Ubuntu) + Windows |
