A real-time car accident detection system leveraging YOLOv11 for fast and accurate identification of traffic incidents using advanced deep learning techniques.
outputsample1-ezgif.com-video-to-gif-converter.mp4
Train = 75%
Validation = 15%
Test = 10%
!curl -L "https://universe.roboflow.com/ds/PkTjo0rocb?key=cfsz0255qM" > roboflow.zip; unzip roboflow.zip; rm roboflow.zip
!pip install ultralytics
Verifying PyTorch and CUDA ensures GPU support for faster training and inference of deep learning models like YOLO.
import torch
print("Torch version:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
DOWNLOAD AND ACCESS THE MODEL https://drive.google.com/file/d/1OWXwoMoyhyrDcBqYxayWb-TR6gjcFCMq/view?usp=sharing
Load the pre-trained YOLO model to initialize it for inference or fine-tuning.
from ultralytics import YOLO
model = YOLO('yolo11n.pt')
Train the YOLO model on labeled data to adapt its weights for task-specific performance.
train_results = model.train(data = '/content/data.yaml', epochs=100 , imgsz=640 , device = 0)
Evaluate the trained model on test data to assess detection performance and generalization.
from ultralytics import YOLO
model = YOLO('runs/detect/train/weights/best.pt')
results = model('/content/test/images/Accident-390_jpg.rf.f704a92d23db7a2f0f9e6aa17db370bc.jpg')
results[0].show()
$ Clone the GitHub repository and the VS Code using Git(Which need to be installed)
Installs all required libraries for building a real-time car accident detection system using Flask for the web interface, OpenCV for video processing, YOLOv11 via Ultralytics for object detection, and supporting deep learning and image handling libraries.
pip install flask opencv-python ultralytics torch torchvision pillow numpy
Start the application by executing the main script:
python app.py


