Automated-Traffic-Accident-Detection

๐Ÿšง Automated Traffic Accident Detection and Alert System

This project is an AI-powered system for detecting road accidents in real-time and classifying their severity using the YOLOv8 deep learning model. It also integrates risk scoring, insurance policy recommendations, and alert mechanisms (email/SMS), all within a secure web application built using Flask and MongoDB.


๐Ÿ“Œ Features


๐Ÿง  Technologies Used

Technology Purpose
YOLOv8 Real-time object detection
Flask Backend framework
HTML/CSS Frontend interface
Bootstrap Responsive web design
MongoDB NoSQL database for user/detection data
OpenCV Image and video processing
SMTP/Twilio Sending email/SMS alerts

๐Ÿš€ Installation

  1. Clone the repository
    ```bash git clone https://github.com/your-username/accident-detection-system.git cd accident-detection-system

2.Create a virtual environment (recommended) python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate

3.Install dependencies pip install -r requirements.txt

4.Configure MongoDB & Environment Variables

Ensure MongoDB is running locally or use MongoDB Atlas.

Set up .env for sensitive data (API keys, DB URI, email credentials).

5.Train or Load YOLOv8 Model

Download or train a YOLOv8 model on your custom dataset.

Place best.pt in the model/ directory.

โ–ถ๏ธ Running the Application python app.py Then open your browser and go to: http://127.0.0.1:5000/

๐Ÿ“ Project Structure accident-detection/ โ”‚ โ”œโ”€โ”€ static/ โ”‚ โ””โ”€โ”€ uploads/, css/ โ”œโ”€โ”€ templates/ โ”‚ โ””โ”€โ”€ *.html โ”œโ”€โ”€ model/ โ”‚ โ””โ”€โ”€ best.pt โ”œโ”€โ”€ app.py โ”œโ”€โ”€ Main.py โ”œโ”€โ”€ requirements.txt โ””โ”€โ”€ README.md

๐Ÿงช Sample Use-Cases ๐Ÿšจ Detect accidents from uploaded images or live webcam

๐Ÿ“ค Alert admin and users during severe accidents

๐Ÿงพ View detection history and personal risk level

๐Ÿ“‰ Admin assigns insurance policies based on risk

๐Ÿ“ท Screenshots

๐Ÿ  Home Page

Home Page

๐Ÿ‘ค User Dashboard

Dashboard

โš™๏ธ Admin Dashboard

Dashboard

๐Ÿ“ Detection History

Detection History

๐Ÿ“Š Detection Statistics

Detection Statistics

๐Ÿ“ง Email Notification

Output

โœ… Future Enhancements ๐ŸŒ GPS-based geolocation tracking

๐Ÿ“ฑ Android/iOS mobile app

๐ŸŽฅ Multi-camera integration

๐Ÿ”— Integration with police/emergency services API

๐Ÿ‘ฉโ€๐Ÿ’ป Author JerishRaj โ€“ GitHub Feel free to contribute, raise issues, or suggest improvements!