Skip to content

๐Ÿš—๐Ÿ’ฅ Real-Time Accident Detection with YOLOv5 & Streamlit A real-time accident detection system using YOLOv5, OpenCV, and Streamlit, enhanced with sound alerts, logging, and live dashboard updates. Designed to detect collisions between vehicles in a video stream and log incidents with frame evidence and timestamps. ๐ŸŒŸ Features ๐Ÿ” YOLOv5 Object Det

Notifications You must be signed in to change notification settings

ComputerVision804/Accident-Detection-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš—๐Ÿ’ฅ Real-Time Accident Detection with YOLOv5 & Streamlit A real-time accident detection system using YOLOv5, OpenCV, and Streamlit, enhanced with sound alerts, logging, and live dashboard updates. Designed to detect collisions between vehicles in a video stream and log incidents with frame evidence and timestamps.

๐ŸŒŸ Features ๐Ÿ” YOLOv5 Object Detection Detects vehicles (cars, trucks, buses, bikes) in real-time using YOLOv5s.

๐Ÿ–ผ๏ธ Live Video Feed with Streamlit Displays a real-time webcam stream with frame counter and collision alerts.

๐Ÿ’ฅ Collision Detection Logic Uses bounding box overlap (IoU) to detect accidents based on object proximity.

๐Ÿ“ Frame Capture & Evidence Logging Saves frames of detected accidents in an evidence/ folder with a CSV log.

๐Ÿ”Š Real-Time Sound Alerts Plays an alert sound (via pygame) when a crash is detected.

๐Ÿง  Tech Stack Tool Purpose YOLOv5 Real-time vehicle detection OpenCV Video stream handling Streamlit Live UI dashboard Pandas Logging accident data to CSV Pygame Playing alert sounds Python Overall integration and logic ๐Ÿ“ฆ Installation

Clone the repository

git clone https://github.com/your-username/accident-detection-yolov5 cd accident-detection-yolov5

Install dependencies

pip install -r requirements.txt

Or install manually:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu pip install opencv-python streamlit pandas pygame Make sure you have a working webcam and Python 3.8+.

โ–ถ๏ธ Run the App streamlit run app.py Once launched:

A live camera feed will start.

When an accident is detected, you'll:

Hear a sound

See an alert in the UI

Get a frame saved in /evidence

See logs in logs.csv

๐Ÿ“ Project Structure โ”œโ”€โ”€ app.py # Main Streamlit App โ”œโ”€โ”€ alert.mp3 # Sound file for alert โ”œโ”€โ”€ logs.csv # Logged accident info โ”œโ”€โ”€ evidence/ # Captured frames โ””โ”€โ”€ requirements.txt # Dependencies ๐Ÿ”ฎ Future Improvements ๐Ÿšฆ Accident type classification (rear-end, side collision, etc.)

๐Ÿง  Integrate with vehicle tracking and motion estimation

๐ŸŒ Dashboard with map integration or multiple cameras

๐Ÿงฉ Deployable version for Raspberry Pi or Jetson Nano

๐Ÿ“ธ Preview

A live dashboard view with real-time accident detection and alerting.

๐Ÿ“œ License This project is licensed under the MIT License.

๐Ÿค Contributing Got ideas or want to improve the logic/model? Pull requests and suggestions are always welcome!

About

๐Ÿš—๐Ÿ’ฅ Real-Time Accident Detection with YOLOv5 & Streamlit A real-time accident detection system using YOLOv5, OpenCV, and Streamlit, enhanced with sound alerts, logging, and live dashboard updates. Designed to detect collisions between vehicles in a video stream and log incidents with frame evidence and timestamps. ๐ŸŒŸ Features ๐Ÿ” YOLOv5 Object Det

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages