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.
- Key Features
- Built With
- Getting Started Guide
- Running the Application
- How It Works
- System Architecture
- Methodology
- Performance Highlights
- Repository Structure
- License
- Credits & Acknowledgments
- Support & Contact Information
- 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.
Follow these steps to set up the project on your local machine.
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.
For GPU acceleration, install CUDA on your system. Watch Tutorial for step-by-step guidance.
Ensure your CUDA version matches your PyTorch build.
git clone https://github.com/VishalRMahajan/Nirikshan.git
cd Nirikshan
Navigate to the frontend folder and install the dependencies:
cd frontend
npm install
-
Generate Authentication Secret
Make sure you are in thefrontend
directory before running the following command:npx auth secret
-
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
-
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
-
Database Setup
Make sure you are in thefrontend
directory before running the following commands:cd frontend pnpm exec prisma migrate dev pnpm exec prisma generate
-
Create a Virtual Environment
cd ../backend python -m venv venv # For Windows: venv\Scripts\activate # For macOS/Linux: source venv/bin/activate
-
Install PyTorch in Virtual Environment
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
-
Install Backend Dependencies
pip install -r requirements.txt
cd backend
uvicorn app:app --host 0.0.0.0 --port 8000 --reload
The backend will be available at http://localhost:8000
.
cd ../frontend
npm run dev
The frontend will be available at http://localhost:3000
.
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:
-
Accident Happens
A crash occurs on the highway, captured by CCTV cameras installed at strategic locations. -
CCTV Captures Footage
The video feed is processed using a YOLO-based vehicle collision detection model to identify accidents with high accuracy. -
Instant Alert Sent
Upon detecting an accident, the backend system sends an immediate alert to highway authorities via WebSocket integration. -
Verification and Response
Authorities verify the incident through an intuitive dashboard and dispatch emergency services to the scene.
- 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)
- All classes achieve ~99% mAP@50
- Strongest performance:
car_object_accident
(97.6% mAP@50-95)
The project is divided into two main parts:
-
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.
-
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.
This project is licensed under the MIT License. See the LICENSE file for details.
Special thanks to Roboflow for providing the dataset used for training the model.
For any queries, feedback, or support, feel free to reach out at: vism06@gmail.com