This project is from Udacity's 'Intro to Self Driving Car' Nanodegree Program - Computer Vision Class. Traditional Computer Vision technique of feature extraction from Image is used to build the classifier.
The goal of this project is to classify the state of Traffic Light as either Red, Yellow or Green based upon the light which is illuminated.
- Load and Visualize data
- Pre-process the data for Standardized Input
- Feature Extraction
- Classification & Accuracy Calculation over Validation Set
Please refer Traffic_Light_Classifier.ipynb for Detailed Steps and Code.
Two kinds of feature were extracted
- Positional Brightness
- Background from the image is cropped to focus only on traffic light area.
- Image is converted to HSV colorspace so that brightness can be extracted.
- Three areas are defined for each Color class with sum of brightness of defined area as feature value to classify.
- Positional Color
- Color masks are applied to extract required color classes using HSV Color Space.
- Three areas are defined for each Color class with sum of brightness of defined area for respective color masked image as feature value to classify.
-
Feature 1 - Athough feature 1 was able to achieve >95% Accuracy, In some cases background is not fully cropped and position of brightness value is not correct indication of the state of Traffic Light. Due to this 2nd feature is implemented.
-
Feature 2 - In some cases it was not possible to extract indicated color from HSV colorspace due to reflection/shadow on the original color. Thus, brightness feature helps in such cases.
Thus, features are designed in such a way that they complement each other's drawbacks and help in right classification of the Traffic Light State.
- Classifier Function compares addition of both the feature values for all three classes.
- With the features defined it is able to achieve 100% Accuracy
- Traffic lights are oriented vertically with little deviation in angles.
- Order of lights is Red, Yellow & Green from Top to Bottom.
Please feel free to comment for any thoughts, suggestions or improvements on the project.