Traffic Signal Detection System

Using CNN, Python based.

Traffic signs detection and classification in real time

This project is a traffic sign :no_mobile_phones: detection and classification system using OpenCV:round_pushpin:

This project uses the technology Convolution Neural Network(CNN). Because of its high recognition rate and fast execution, CNN is highly preferred in areas where it is required to recognize and classify real world objects.

Pre-requisites :rotating_light:

How to run? :rocket:

pip3 install opencv-contrib-python==3.4.11.43

:warning: Make sure your pip version in in association with python3 and not python2.
:warning: Make sure you install OpenCV v3.x and not OpenCV v4.x to avoid unsupported formats and errors.

  1. Install matplotlib,
pip3 install matplotlib
  1. Install skimage,
pip3 install -U scikit-image
  1. Install imutils,
pip3 install imutils
  1. Run main.py
python main.py

Voila! :clap: You can now check out the output.txt and the output video generated.

Directory structure :open_file_folder:

This project is divided in two phases, namely detection phase and classification phase.

:one: Detection phase

The detection phase uses Image Processing techniques that creates contours on each video frame and finds all ellipses or circles among those contours. They are marked as candidates for traffic signs.

Detection strategy:

:two: Classification phase

In the classification phase, a list of images will be created by cropping from the original frame based on candidates’ coordinate. A pre-trained SVM model classifies these images to find out which type of traffic sign they are.

System architecture: How does this work? :wrench:

For better understanding, flow of the project is as follows:

  1. Determine the data set Understanding
  2. Load the data
  3. Analyse the data
  4. Data pre-processing
  5. Define the Convolution network
  6. Model the data
  7. Compile the model
  8. Train the model
  9. Model evaluation of the test data set
  10. Generating the classification result

If a traffic sign is detected, it will be tracked until it disappears or there is another bigger sign in the frame. The tracking method is Dense Optical Flow.

The main.py trains the dataset every time it executes. But, the data_smv.dat already contains a trained dataset if we want to skip the traning of SMV model every time we execute the detection system.

Thanks for visiting! :cherry_blossom:

Feel free to contact me on socials! @Kashish121