Back to Projects
Sanchalan AI - Traffic Management System
CompletedPythonYOLOv8OpenCV+5 more

Sanchalan AI - Traffic Management System

Smart India Hackathon 2025 project with AI-powered traffic management and Green Corridor for emergency vehicles

Timeline

Completed

Role

Full Stack AI Engineer

Status
Completed

Technology Stack

Python
YOLOv8
OpenCV
FastAPI
React
TypeScript
MySQL
TailwindCSS

Sanchalan AI - Traffic Management System

Smart India Hackathon 2025 (Problem ID: 25050) - An AI-powered traffic management system with Green Corridor for emergency vehicles, real-time detection, and intelligent signal control.

Project Overview

Sanchalan AI is a comprehensive traffic management solution that leverages computer vision and machine learning to optimize traffic flow while prioritizing emergency vehicle response.

Key Features

  • Automatic Ambulance Detection: Real-time detection and identification of emergency vehicles
  • Smart Signal Control: AI-powered signal management with manual override capability
  • Real-time Web Dashboard: Live traffic monitoring and analytics visualization
  • Traffic Analytics: Comprehensive vehicle analytics and corridor performance metrics
  • Green Corridor: Automatic lane clearance for emergency vehicles

How It Works

Green Corridor Flow

  1. CCTV detects ambulance
  2. AI identifies optimal lane
  3. Signal turns green automatically
  4. Dashboard alerts operators in real-time

Technical Architecture

Backend

  • Detection Engine: Enhanced YOLO-based detection with color analysis
  • Vehicle Analysis: Attribute extraction and real-time analytics
  • Emergency Override: Green corridor logic for priority vehicles
  • Video Streaming: Multi-feed MJPEG streaming capability

Frontend

  • Dashboard: Real-time traffic visualization and monitoring
  • Live Feeds: Multiple camera feed display
  • Analytics: Vehicle statistics and corridor performance metrics

Database

  • MySQL 8.0: Persistent data storage
  • Drizzle ORM: Type-safe database operations

Tech Stack

Tech Stack

Model Performance

  • Dataset: 13,986 images (car, bus, bike, person, ambulance)
  • Performance: 30 FPS (CPU), 60+ FPS (GPU)
  • Model Path: backend/models/detect/train3/weights/best.pt

Project Structure

backend/
├── caa/
│   ├── yolo_detector/
│   │   ├── __init__.py
│   │   └── yolo_detector.py
│   ├── attribute_analysis_detector/
│   │   ├── __init__.py
│   │   ├── color_detector.py
│   │   └── vehicle_attribute.py
│   ├── config.py
│   ├── enhanced_detector.py
│   ├── enhanced_green_corridor.py
│   └── enhanced_video_stream_server.py
│
frontend/SanchalanAI/
├── client/src/components/
│   └── Dashboard.tsx
└── setup_mysql.sql

Quick Start

Setup Backend

cd backend
python green_corridor.py --setup

Run Detection Demo

python green_corridor.py --video ambulance_video.mp4

Setup Database

mysql -u root -p < frontend/SanchalanAI/setup_mysql.sql

Or manually create database sanchalan_ai in MySQL and update credentials in .env.

Start Video Server

cd backend
python enhanced_video_stream_server.py

Server runs on http://127.0.0.1:5001

Start Dashboard

cd frontend/SanchalanAI
npm install
npm run dev

Dashboard: http://localhost:5000

Note: MySQL and Backend must be running first!

API Endpoints

  • GET /video_feed/{feed_id} - MJPEG stream per feed
  • GET /api/feeds/status - Feed statuses and corridor state
  • GET /api/feeds/detections - Current detections summary
  • GET /api/feeds/analytics - Vehicle analytics data

Configuration

  • Lane Polygons: Edit backend/lanes.json to customize detection zones
  • Model Paths: Update backend/config.py for model paths and CORS settings

Key Achievements

  • Real-time multi-feed video processing
  • Accurate emergency vehicle detection
  • Intelligent signal control logic
  • Comprehensive traffic analytics
  • Production-ready dashboard interface

Repository: github.com/SHREY275/sanchalan_ai

Competition: Smart India Hackathon 2025 - Problem ID: 25050

Design & Developed by Shrey Mishra
© 2026. All rights reserved.