This project is a real-time accident and speed detection system using computer vision and deep learning. The system detects accidents in video footage and sends an email alert with an attached image of the detected accident.
-
Clone the repository:
git clone /~https://github.com/Ammar-Ali234/Car-Accident-Detection.git cd Car_Accident
-
Install the required packages (paste the following into your terminal):
pip install ultralytics google-smtp
-
Place your video file in the project directory and update the
cap = cv2.VideoCapture(r"your_video.mp4")
line in the code with your video file path. -
Update the
sender_email
,receiver_email
, andpassword
variables with your email credentials. -
Run the script:
python final.py
- Real-time accident detection using YOLO model.
- Sends email alerts with an attached image of the detected accident.
- Configurable cooldown period to prevent multiple email alerts for the same accident.
-
Model: The YOLO model is used for object detection. Update the model path if necessary.
model = YOLO(r"best (1).pt")
-
Classes: The classes for detection are read from a text file.
df = open(r"coco1.txt", "r") classes = df.read().split("\n")
-
Email Configuration: Update the email credentials and settings.
sender_email = "your_email@gmail.com" receiver_email = "receiver_email@gmail.com" password = "your_email_password"
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.