8000 GitHub - VishalRMahajan/Nirikshan: Nirikshan: An AI-powered real-time road accident detection system using YOLOv11 and CCTV footage, built with FastAPI & Next.js for instant alerts and emergency response.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Nirikshan: An AI-powered real-time road accident detection system using YOLOv11 and CCTV footage, built with FastAPI & Next.js for instant alerts and emergency response.

License

Notifications You must be signed in to change notification settings

VishalRMahajan/Nirikshan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Food Ordering Website Logo

Nirikshan: Real-Time Road Accident Detection System using YOLOv11 and CCTV Surveillance

Nirikshan is an AI-powered real-time accident detection system designed to revolutionize road safety. By leveraging advanced computer vision technology, Nirikshan detects vehicle collisions through CCTV footage and instantly notifies highway authorities, enabling swift emergency responses.

πŸ“ Table of Contents

  1. Key Features
  2. Built With
  3. Getting Started Guide
  4. Running the Application
  5. How It Works
  6. System Architecture
  7. Methodology
  8. Performance Highlights
  9. Repository Structure
  10. License
  11. Credits & Acknowledgments
  12. Support & Contact Information

Key Features ✨

  • Real-Time Detection: Powered by YOLO-based object detection for accurate identification of vehicle collisions.
  • Instant Alerts: Sends immediate notifications to control centers via WebSocket integration.
  • Verification Workflow: Provides an intuitive dashboard for authorities to review and act on detected incidents.
  • Scalable Design: Seamlessly integrates with existing CCTV infrastructure for widespread deployment.

Built With

Tech Stack

πŸš€ Getting Started Guide

Follow these steps to set up the project on your local machine.

πŸ“¦ Prerequisites

Ensure you have the following tools installed:

  • βœ… Node.js (v14 or later)
  • βœ… npm or yarn
  • βœ… Python (v3.8 or later)
  • ⚑ CUDA Toolkit (for GPU acceleration, optional)

πŸ’‘ Tip: Keep your packages up-to-date for best results.

πŸ”§ Installing CUDA

For GPU acceleration, install CUDA on your system. Watch Tutorial for step-by-step guidance.
Ensure your CUDA version matches your PyTorch build.

πŸ› οΈ Installation Steps

1. πŸ“ Clone the Repository

git clone https://github.com/VishalRMahajan/Nirikshan.git
cd Nirikshan

2. βš™οΈ Set Up the Frontend

Navigate to the frontend folder and install the dependencies:

cd frontend
npm install

3. πŸ” Configure Environment Variables (Frontend Only)

  1. Generate Authentication Secret
    Make sure you are in the frontend directory before running the following command:

    npx auth secret
  2. Set Up Google OAuth

    • Go to the Google Cloud Console.
    • Create a new project and configure OAuth consent.
    • Set the Authorized Redirect URI to:
      http://localhost:3000/api/auth/callback/google
      
  3. Create or Update the Following Files in the frontend Directory:

    .env.local

    AUTH_SECRET= # Automatically added by `npx auth`
    AUTH_GOOGLE_ID= # Your Google Client ID
    AUTH_GOOGLE_SECRET= # Your Google Client Secret
    

    .env

    DATABASE_URL= # Your Postgres database connection string
    
  4. Database Setup
    Make sure you are in the frontend directory before running the following commands:

    cd frontend
    pnpm exec prisma migrate dev
    pnpm exec prisma generate

4. πŸ”Œ Set Up the Backend

  1. Create a Virtual Environment

    cd ../backend
    python -m venv venv
    
    # For Windows:
    venv\Scripts\activate
    
    # For macOS/Linux:
    source venv/bin/activate
  2. Install PyTorch in Virtual Environment

    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
  3. Install Backend Dependencies

    pip install -r requirements.txt

▢️ Running the Application

1. πŸ”™ Start the Backend (FastAPI)

cd backend
uvicorn app:app --host 0.0.0.0 --port 8000 --reload

The backend will be available at http://localhost:8000.

2. 🌐 Start the Frontend (Next.js)

cd ../frontend
npm run dev

The frontend will be available at http://localhost:3000.

How It Works 🚦

Nirikshan is an AI-powered accident detection system that leverages advanced computer vision technology to identify vehicle collisions in real-time and facilitate rapid emergency response. Here's how it works:

Step-by-Step Process

  1. Accident Happens
    A crash occurs on the highway, captured by CCTV cameras installed at strategic locations.

  2. CCTV Captures Footage
    The video feed is processed using a YOLO-based vehicle collision detection model to identify accidents with high accuracy.

  3. Instant Alert Sent
    Upon detecting an accident, the backend system sends an immediate alert to highway authorities via WebSocket integration.

  4. Verification and Response
    Authorities verify the incident through an intuitive dashboard and dispatch emergency services to the scene.

System Architecture

Food Ordering Website Logo

Methodology

Food Ordering Website Logo

Performance Highlights πŸ“Š

YOLOv11 Performance

πŸ” Key Performance Metrics

  • mAP@50: 99% (excellent object detection)
  • mAP@50-95: 89.3% (strong performance at stricter thresholds)
  • Precision: 96.8% (low false positives)
  • Recall: 96.4% (high true positive rate)

πŸ’‘ Class Performance Highlights

  • All classes achieve ~99% mAP@50
  • Strongest performance: car_object_accident (97.6% mAP@50-95)

πŸ—‚οΈ Repository Structure

The project is divided into two main parts:

  1. Frontend (/frontend):

    • Built with Next.js and TypeScript.
    • Handles the user interface, routing, and authentication.
    • Includes Prisma for database interaction.
    • Key files:
      • .env.local: Environment variables for the frontend (Google OAuth, Prisma settings).
      • .env: Additional environment variables for general frontend configuration.
      • pages/: App pages (e.g., index.tsx, login.tsx).
      • components/: Reusable components.
      • prisma/: Prisma schema and migration files.
  2. Backend (/backend):

    • Built with FastAPI.
    • Manages APIs, authentication, and database interaction.
    • Key files:
      • app/: Core app logic (routes, models, and schemas).
      • requirements.txt: Python dependencies.

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ™Œ Credits & Acknowledgments

Special thanks to Roboflow for providing the dataset used for training the model.

πŸ“¬ Support & Contact Information

For any queries, feedback, or support, feel free to reach out at: vism06@gmail.com

About

Nirikshan: An AI-powered real-time road accident detection system using YOLOv11 and CCTV footage, built with FastAPI & Next.js for instant alerts and emergency response.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0