Skip to content

ShantanuGame/Yolo_for_Emergency_vehicle_classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚨 YOLOv5 Custom Emergency Vehicle Detection Model

Intelligent Vision for Priority-Driven Traffic Systems

⚠️ Restricted Deployment Notice
This project is NOT publicly deployable.
The complete system is accessible only to authorized Government officials and agencies.
However, the primary detection model is available for research, academic contribution, and controlled collaboration.


🧠 Project Overview

This repository presents a custom-trained YOLOv5-based emergency vehicle detection model, developed as a core vision module for an AI-powered Smart Traffic Management System. The model operates in real time, identifying emergency vehicles in live traffic feeds and enabling intelligent traffic signal prioritization.

The objective is simple but critical:
detect emergency vehicles instantly, clear their path dynamically, and reduce response time where every second matters.

This model is engineered for urban intersections, highway junctions, and smart city deployments, forming the perception layer of a larger government-grade traffic control infrastructure.


🚑 Detected Vehicle Classes

The model is trained to detect five vehicle categories, with emphasis on emergency response units:

Class ID Vehicle Type
0 Ambulance
1 Fire Truck
2 Police Car
3 Bus
4 Van

Emergency vehicles are given priority inference handling in downstream systems.


🔍 Model Specifications

  • Model Architecture: YOLOv5s (Small Variant)
  • Framework: PyTorch
  • Inference Type: Real-time object detection
  • Optimization Target: Low latency + high recall for emergency vehicles
  • Training Platform: Google Colab (GPU: NVIDIA T4)

📂 Dataset Details

  • Source: Custom dataset curated and annotated using Roboflow

  • Annotation Format: YOLOv5-compatible

  • data.yaml includes class names and dataset paths

  • Balanced samples with targeted augmentation for emergency vehicles


📊 Model Performance

Metric Value
mAP@0.5 53.5%
mAP@0.5:0.95 37.0%
Ambulance Precision 64%
Ambulance Recall 84%

🧪 Trained for 100 epochs, optimized for maximum recall to avoid missed emergency detections.


⚙️ How It Works (Pipeline)

  1. Live Traffic Feed Input
  2. YOLOv5 Inference Engine
  3. Emergency Vehicle Classification
  4. Confidence Threshold Filtering
  5. Trigger-Based Signal Logic
  6. Traffic Signal Override

This modular pipeline allows easy integration with:

  • Traffic controllers
  • Edge devices
  • City-wide monitoring systems

🚦 Smart Signal Integration Logic

When an emergency vehicle is detected:

  • 🔊 Audio alert is triggered
  • 🚥 Traffic signal override is activated
  • 🟢 Emergency lane receives green priority
  • ⏱️ Cooldown timer prevents repeated triggers
  • 🧠 Failsafe logic restores normal flow post-clearance

Designed to prevent signal abuse while guaranteeing emergency clearance.


🔧 Running Detection (Research / Model Testing)

python detect.py \
  --weights path/to/best.pt \
  --source path/to/image_or_video \
  --conf 0.25 \
  --save-txt \
  --save-conf \
  --device 0   # use 'cpu' if GPU unavailable

About

An intelligent traffic control system that uses real-time vehicle detection and adaptive algorithms to dynamically adjust signal timings, reduce congestion, and provide priority passage to emergency vehicles for faster and safer traffic flow.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors