This project implements a real-time driver assistance system using traffic sign recognition, lane detection, and collision detection.
TrafficVisionAI/
├── data/
│ ├── GTSRB/
│ │ ├── train/
│ │ │ ├── 0/
│ │ │ ├── 1/
│ │ │ └── ...
│ │ ├── Meta.csv
│ │ ├── Test.csv
│ │ └── Train.csv
├── models/
│ └── traffic_sign_model.h5
├── src/
│ ├── __init__.py
│ ├── traffic_sign_recognition.py
│ ├── lane_detection.py
│ ├── collision_detection.py
│ ├── main.py
│ ├── train_model.py
├── utils/
│ ├── __init__.py
│ ├── preprocess_data.py
│ ├── helpers.py
│ └── config.py
├── .gitignore
├── README.md
└── requirements.txt
git clone https://github.com/debjit-mandal/TrafficVisionAI.git
cd TrafficVisionAI
python -m venv env
source env/bin/activate # On Windows use `env\Scripts\activate`
pip install -r requirements.txt
Download the GTSRB dataset and extract it into the data/GTSRB
directory.
Train the model using the GTSRB dataset:
python -m src.train_model
Start the system to recognize traffic signs, detect lanes, and perform collision detection:
python -m src.main
The system will start the webcam feed, process each frame to recognize traffic signs, detect lanes, and perform collision detection. Press q
to quit.
-
Traffic Sign Recognition The traffic sign recognition component uses a convolutional neural network (CNN) trained on the GTSRB dataset. The trained model is used to recognize traffic signs in real-time from a webcam feed.
-
Lane Detection The lane detection component uses OpenCV to detect lane lines in real-time from a webcam feed. It applies Canny edge detection and Hough line transform to identify lane lines.
-
Collision Detection The collision detection component uses a pre-trained object detection model from TensorFlow Hub to detect objects in real-time from a webcam feed. It draws bounding boxes around detected objects and calculates distances.
- TensorFlow
- TensorFlow Hub
- OpenCV
- NumPy
- Pandas
- Scikit-learn
-
src/train_model.py Script to train the traffic sign recognition model using the GTSRB dataset.
-
src/traffic_sign_recognition.py Script to recognize traffic signs in real-time using the trained model.
-
src/lane_detection.py Script to detect lane lines in real-time using OpenCV.
-
src/collision_detection.py Script to detect objects in real-time using a pre-trained model from TensorFlow Hub.
-
src/main.py Main script to integrate all functionalities: traffic sign recognition, lane detection, and collision detection.
-
utils/preprocess_data.py Utility script for preprocessing images and loading the GTSRB dataset.
-
utils/helpers.py Utility script containing helper functions for lane detection.
-
utils/config.py Configuration file containing paths and settings.
Contributions are welcome! Please fork this repository and submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.