Skip to content

Repository files navigation

🚗 RoadGuard AI- AI-Powered Real-Time Road Hazard Detection for Indian Roads

Transforming vehicles into collaborative smart-city sensors that detect, verify, and share road hazards in real time.


🌍 Overview

RoadGuard AI is an intelligent road safety system designed to detect road hazards in real time, specifically optimized for Indian road conditions.

The system combines:

Computer Vision

  • Sensor Fusion (Accelerometer + Gyroscope)
  • Cloud-Based Hazard Intelligence
  • Navigation Integration

Vehicles act as mobile sensing nodes that detect hazards and share them with nearby drivers through a real-time alert network. This enables the creation of a collaborative road hazard intelligence system for smart cities.

image
Figure: Overview of the proposed system

🚦 Motivation

India reports over 150,000 road accident fatalities annually, many caused by poor road infrastructure such as:

  • Unmarked speed breakers
  • Potholes
  • Uneven road surfaces
  • Poor visibility during rain or night

Traditional navigation systems do not detect temporary road hazards.

RoadGuard AI aims to improve driver awareness and reduce accidents using real-time hazard intelligence.

🎯 Problem Statement

Drivers frequently encounter unexpected hazards due to:

  • Faded or unmarked speed breakers
  • Potholes and damaged road surfaces
  • Low visibility at night
  • Rain, fog, or flooded roads

These hazards often remain undetected by existing navigation systems, leading to:

  • Vehicle damage
  • Sudden braking accidents
  • Unsafe driving conditions

⚖️ Comparison With Existing Approaches

System Vision Only Sensor Only RoadGuard AI
Hazard Detection
Works in Low Visibility
False Positive Reduction
Early Hazard Prediction

RoadGuard AI combines both approaches to increase reliability.


💡 Our Solution

RoadGuard AI uses a hybrid AI + sensor fusion approach to detect and verify road hazards.

The system combines:

  • 1️⃣ Computer Vision Detection
  • 2️⃣ Sensor Fusion Verification
  • 3️⃣ Cloud-Based Hazard Intelligence
  • 4️⃣ Real-Time Navigation Alerts

This improves reliability compared to vision-only systems.


📷 Computer Vision Hazard Detection

A vehicle-mounted camera captures road frames continuously.

The AI model analyzes frames using the ** yolov8+cbam ** model trained to detect:

  • Speed breakers
  • Potholes
  • Road bumps

This allows the system to predict hazards before the vehicle reaches them.


📊 Sensor Fusion Verification

Computer vision may fail under certain conditions:

  • Poor lighting
  • Rain or fog
  • Water-covered roads
  • Camera occlusion

To improve reliability, RoadGuard AI integrates accelerometer and gyroscope sensors.

These sensors detect:

  • Vertical acceleration spikes
  • Sudden tilt changes
  • Road bump patterns

If a bump pattern matches a pothole or speed breaker, the system confirms the hazard.

This reduces false positives and missed detections.

RoadGuard AI uses IMU sensor data (accelerometer + gyroscope) to verify hazards detected by the computer vision model. This helps reduce false positives and detect hazards when visual detection fails.

flowchart TD
   B[IMU Data Acquisition]
    B --> C[Low Pass Filtering]
    C --> D[Delta Acceleration Calculation]
    D --> E[Gyroscope Motion Rejection]
    E --> F[Event Duration Validation]
    F --> G[Hazard Confirmation]
    G --> H[Cloud Storage]
Loading

Sensor Fusion Verification Algorithm

Algorithm Steps

  1. Read accelerometer and gyroscope data from the MPU6050 sensor.

  2. Apply calibration offsets to remove sensor bias.

  3. Apply a low-pass filter to the vertical acceleration (Az) to remove vibration noise.

  4. Compute vertical acceleration change:

    delta_g = 1 - Az_filtered

  5. If delta_g exceeds the threshold, a potential bump event is detected.

  6. Compute gyroscope magnitude:

    gyro_mag = sqrt(Gx² + Gy² + Gz²)

  7. If gyroscope magnitude exceeds the rotation threshold, reject the event.

  8. Measure event duration.

  9. If duration is within the valid range, confirm the bump event.

  10. Send the hazard location to the cloud database.

Pseudocode

Read IMU data
Apply calibration offsets
Filter vertical acceleration

delta_g = 1 - Az_filtered

IF delta_g > threshold
    compute gyro magnitude

    IF gyro < rotation_threshold
        measure event duration

        IF duration valid
            confirm road hazard
            send GPS location to cloud

Table 2 : Sensor parameters used

Parameter Value Purpose
Sampling Rate 200 Hz Sensor data acquisition
Delta G Threshold 0.20 g Detect vertical drop
Gyro Threshold 10 deg/s Reject turns
Min Duration 0.08 s Remove noise
Max Duration 1.2 s Reject long events
Debounce 1000 ms Avoid duplicates

Case 1: Vision detects hazard → warning issued Case 2: IMU confirms → hazard confidence increases Case 3: Both detect → high confidence hazard stored

☁️ Collaborative Hazard Intelligence

image
Figure: Collaborative hazard map generated using Folium showing detected road hazards.

Once a road hazard is detected and verified, the system shares the information through a collaborative hazard intelligence network.

For the MVP implementation, hazard locations are visualized using Folium, a Python open-source library for interactive map generation.

Hazard Reporting Pipeline

1️⃣ Hazard location is stored in the cloud hazard database
2️⃣ The hazard is added to a shared road hazard map
3️⃣ Nearby drivers receive real-time navigation alerts

This enables vehicles to act as mobile sensing nodes, continuously contributing hazard information to improve road safety.


📍 Hazard Confirmation Types

Different marker colors on the map represent the source of hazard verification:

Marker Color Meaning
🔵 Blue Marker Hazard confirmed using YOLOv8 computer vision detection
🟢 Green Marker Hazard detected using IMU sensor module (MPU6050)
🟡 Yellow Marker Hazard confirmed using both YOLOv8 and IMU sensor fusion

This multi-source confirmation improves reliability by combining vision-based detection with sensor-based verification.


🌐 Collaborative Intelligence

By aggregating hazard reports from multiple vehicles:

  • Frequently detected hazards gain higher confidence
  • Municipal authorities can identify damaged road segments
  • Drivers receive early warnings about upcoming road hazards This transforms vehicles into distributed smart-city sensors, enabling real-time road safety intelligence.

🧠 System Architecture

systemarchhietecture
Figure: System Architecture

System Pipeline

Camera Input
      ↓
Computer Vision Model
      ↓
Hazard Prediction
      ↓
Sensor Fusion Verification
(Accelerometer + Gyroscope)
      ↓
Hazard Confirmation
      ↓
Cloud Hazard Database
      ↓
Navigation Integration
      ↓
Real-Time Driver Alerts

📂 Dataset Used

The dataset used for training the road hazard detection model consists of speed breaker images captured from real vehicle-mounted cameras.

Dataset Details

  • Class: Speed Breakers
  • Source: Images captured using a vehicle mirror-mounted camera during real driving conditions
  • Total Images Collected: 300 images
  • Sample images

    image
    Figure: Sample annotated image of speed breaker

image
Figure: Sample annotated image of pothole

Data Augmentation

To improve model robustness across different environmental conditions, the dataset was augmented to simulate multiple road scenarios:

  • 🌧️ Rain conditions
  • 🌫️ Fog conditions
  • ☀️ Sunny daylight conditions
  • 🌙 Night-time driving conditions

Data augmentation techniques help the model generalize better for real-world deployment on Indian roads, where lighting and weather conditions vary significantly.

Final Dataset

The augmented dataset was used to train the YOLOv8 + CBAM based road hazard detection model, enabling reliable detection of speed breakers, potholes under diverse environmental conditions.

📈 Performance Metrics

Model Performance Comparison

Model Accuracy Inference Time Notes
YOLOv8 Baseline 92% 1–2 sec / image Initial training evaluation
YOLOv8 + CBAM 93% 8.8 ms / image Optimized real-time inference

Performance Insights

  • CBAM attention mechanism improves feature representation by helping the model focus on important spatial and channel features.
  • This results in a slight accuracy improvement (~1%) in detecting road hazards.
  • After optimization, the model achieves real-time inference performance (~8.8 ms per frame), making it suitable for edge deployment in vehicles.

Key Observations

  • Attention mechanisms improve feature extraction and robustness
  • The optimized model supports real-time deployment for autonomous systems
  • Suitable for vehicles, robotics, and smart-city sensing applications CBAM improved feature attention, allowing better detection and reduced inference latency.

✨ Key Features

  • 🚗 Real-time road hazard detection
  • 📷 AI-based computer vision model
  • 📊 Accelerometer + gyroscope verification
  • ☁️ Cloud hazard intelligence network
  • 📡 Real-time driver alerts
  • 🗺️ Navigation integration
  • 🌧️ Works in poor visibility and flooded roads
  • 🇮🇳 Designed for Indian road infrastructure

⚙️ Technology Stack

AI / Machine Learning

  • Python
  • OpenCV
  • PyTorch
  • CNN-based object detection models

Edge Hardware

  • Jetson Nano
  • Camera module
  • Accelerometer
  • Gyroscope

Backend

  • FastAPI
  • Node.js

Cloud

  • AWS / Firebase / Supabase

Navigation Integration

  • Python-based map system
  • Real-time alert interface

🔍 How the System Works

process_flow
Figure: How the System Works

1️⃣ Camera captures road frames continuously 2️⃣ AI model detects potential hazards 3️⃣ Sensor fusion verifies physical bumps
4️⃣ Confirmed hazards are stored in the cloud 5️⃣ Drivers approaching the location receive alerts


🧠 AI Model Architecture

RoadGuard AI uses a lightweight object detection model optimized for edge deployment. Model: YOLOv8 Attention Mechanism used: CBAM Framework: PyTorch
Input Resolution: 640×640
Classes:

  • pothole
  • speed breaker
  • road bump Edge Optimisation:
  • Quantised inference for Jetson Nano

image
AI model architecture of the system with Yolov8+CBAM

# 🧠 Model Training Configuration

The YOLOv8 + CBAM model was trained using the following parameters.

Parameter Value
Epochs 100
Batch Size 16
Image Size 640 × 640
Learning Rate 0.001
Optimizer Adam
Device GPU (NVIDIA RTX 4060)
Workers 8
Classes 2 (Speed Breaker, pothole)

⚙️ Installation Guide

1️⃣ Hardware Requirements

RoadGuard AI requires the following hardware components:

Component Purpose
Jetson Nano / Raspberry Pi Edge AI inference
Camera Module Road image capture
Accelerometer (IMU) Detect bumps
Gyroscope Motion verification
Power Supply Vehicle power source

Optional:

  • GPS module for precise hazard location
  • 4G/LTE module for cloud communication

2️⃣ Software Requirements

Make sure the following are installed:

  • Python 3.10+
  • PyTorch
  • OpenCV
  • FastAPI
  • NumPy
  • Ultralytics YOLOv8

3️⃣ Installation Steps

Install dependencies

pip install -r requirements.txt

4️⃣ Running the System

Start the hazard detection pipeline:

python main.py

The pipeline will:

  • Capture frames from the camera
  • Detect hazards using YOLOv8 + CBAM
  • Store hazards in the cloud database
  • Send alerts to the navigation interface

6️⃣ Map Visualization

Run the map interface:

cd navigation
python map_display.py

This will display hazards using Folium maps.

📸 Demo

Demo Video

https://www.youtube.com/playlist?list=PLwEJWj5T2m4wNl4kYch85MUhYL58WsrF_


Screenshots

Road Hazard Detection Output
Figure: Road Hazard Detection using YOLOv8 + CBAM
image
Figure: Speed breaker and pothole detection using IMU module
image
Map integration of the road hazards found

🚀 Future Improvements

  • Integration with Google Maps API
  • City-scale hazard analytics dashboard
  • Large crowdsourced road dataset
  • Mobile app for drivers
  • Smart city infrastructure integration

🌎 Real-World Impact

If deployed at scale, RoadGuard AI could:

• Detect road hazards across entire cities in real time
• Reduce accident risks caused by unmarked speed breakers
• Help municipalities identify damaged roads faster
• Enable collaborative smart-city infrastructure

Even if only 1% of vehicles contribute data, thousands of hazards could be mapped daily.

Target users:

  • Uber / Ola fleets
  • Logistics companies
  • Smart city municipalities

🛣 Roadmap

Phase 1 🚀— Prototype (MVP)

  • Real-time hazard detection using computer vision
  • Sensor fusion verification using accelerometer + gyroscope
  • Cloud-based hazard storage and mapping
  • Edge deployment on Jetson Nano / Raspberry Pi

Phase 2 🌐— Data Network Expansion

  • Deploy the system in logistics vehicles and cab fleets
  • Vehicles act as mobile sensing nodes across the city
  • Even with 10–20 drivers, coverage expands to most urban routes
  • Continuous data collection improves hazard detection reliability

Why this works

Logistics drivers and cab drivers travel across different parts of the city daily, creating a natural distributed sensing network.

This enables large-scale hazard data collection without installing infrastructure everywhere.


Phase 3 📡— Navigation & Driver Alerts

  • Integration with Folium maps
  • Real-time alerts for upcoming hazards
  • Mobile dashboard for drivers
  • Hazard confidence scoring using crowdsourced data

Phase 4 🏙️— Smart City Integration

  • Municipal road monitoring dashboard
  • City-wide road quality analytics
  • Automatic identification of high-risk road segments
  • Data insights for infrastructure planning and maintenance

Real Deployment Architecture

Vehicle Edge Device
      ↓
Camera + Sensors
      ↓
Jetson Nano (AI Inference)
      ↓
FastAPI Backend
      ↓
Cloud Hazard Database
      ↓
Navigation Alert System (Folium Maps)

👥 Team

Team Name

  • Member 1 — Vishal Hariharan K K
  • Member 2 — Sreyas Sanil Kumar
  • Member 3 — Shriyaa S K

🏆 Built For

Hackathon Track: Smart Cities & Urban Innovation


⭐ If you found this project useful, please star the repository

About

Unmarked speed breakers on Indian roads cause frequent accidents and vehicle damage, especially under low visibility. This project presents a real-time speed breaker detection and mapping system using edge AI, IoT sensor fusion, and cloud integration to reliably detect both marked and unmarked breakers under diverse road conditions.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages