Last Updated:
Using ML to detect Traffic signs

CNN for detecting traffic signs

Recognition of Traffic signs is one of the most crucial tasks while driving on the roads. This post provides an overview of the pipeline built by me to train a Convolutional Neural Net built by me to recognise traffic signs.

Dataset summary & distribution

Bar chart showing number of samples in training set for each label
Bar chart shows number of samples in training data per label

I used the GTSRB dataset to train my network. It had almost 35000 images divided into 42 classes. As shown in the bar chart on the right, the number of datapoints for each class was highly skewed. To improve classification accuracy, I generated extra datapoints such that all labels had atleast 800 data points. To generate the extra datapoints, I scaled and warped the images with their parameters being sampled from a uniform distribution. A few examples of these generated datapoints is shown below.

Examples of generated images

Pre-processing the data

To keep the size of the network in check, I decided to use grayscale images instead of colour ones.  On observing the results, I realised that some images were simply too dark. I found it difficult to myself classify these traffic signs! Thus, to further enhace the contrast of these images, I used Contrast Limiting Adaptive Histogram Equalizer (CLAHE) on each image. This produced fantastic results as shown below.

Particularly impressive is the "Men at Work" sign (row 3, col 5) which was not comprehensible before the CLAHE filter was applied. Finally the images were standardized to between 0 and 1.

Results

I was able to sucessfully train the model to deliver an accuracy of over 98% on the testing data.

Shantnav Agarwal

Shantnav Agarwal

I am a senior year student at the Indian Institute of Technology. I am interested in following a career in fields related to Machine Learning and Robotics. I am a huge Formula 1 fan, always rooting for Ferrari. In my spare time, you can usually see me play football and badminton. I am also an avid reader and have read novels from Agatha Christie, Isaac Asimov, and Dan Brown, amongst many others.