A system that uses computer vision to alert the driver when it detects traffic lights or road signs, helping them stay attentive and drive safely.
I wanted to create something with machine learning that would be genuinely useful in my day-to-day life. One of my relatives, who always recommends good project ideas to me, suggested that I build a system that alerts the driver when it detects road signs. I loved this idea and expanded upon it by also including traffic lights.
I will continue expanding on this project by adding support for new types of road signs in the future.
- YOLO model for detecting traffic lights and road signs
- EasyOCR integration to extract speed values from speed limit signs
- Flexible input options: supports images, video file, and live camera feed
- Pygame integration for real-time audio output
- Custom logic for reducing false positive predictions from the model
Languages: Python
Libraries & Tools: Ultralytics (YOLO), EasyOCR, OpenCV, Pygame, NumPy
https://drive.google.com/file/d/1akh2-6TfXNgXhZpitiBZOvNwW9qbtRs7/view?usp=drive_link
-
Download the trained model:
https://drive.google.com/file/d/1O77gxL7PurmNavvM7wI9FtN3UyhwLdOh/view?usp=drive_link
-
Fork this repository.
-
Clone the repository:
git clone https://github.com/<your_username>/DriveAssist
-
Navigate to the directory:
cd DriveAssist -
Create a virtual environment:
python -m venv <env_name>
-
Activate the virtual environment:
Linux and macOS:
source <env_name>/bin/activate
Windows:
<env_name>\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Run inference:
-
Single Image:
python main.py --model <path/to/model> --source <path/to/image>
-
Image Folder:
python main.py --model <path/to/model> --source <path/to/folder>
-
Video File:
python main.py --model <path/to/model> --source <path/to/video/file>
-
Camera Feed:
You need the index of the connected USB camera (e.g.
usb0).python main.py --model <path/to/model> --source <index_of_usb_camera>
-
To train your own model, you can use the following notebook: https://colab.research.google.com/drive/1lJACvS_HwbCpCmPS5d_K2_c1bcA_c3JR?usp=drive_link
To train the YOLO model, I created my own dataset, consisting of 370 dashcam images, and annotated it using the Roboflow platform. The dataset can be found here: https://drive.google.com/drive/folders/1fBAwNc9KgO--8yRwXxo6NV8RZowYXSSc?usp=sharing