This project aims to classify traffic lights coming from a simulator
Author: Marcelo Garcia
Data was taken using CARLA simulator as shown in the GIF image below:
As illustrated above, the end goal of the traffic light classifier is to integrate it into a ROS pipeline that drives a car along a highway.
The dataset was taken frame by frame and labeled manually.
The different classes that were labeled are the following:
The dataset distribution was not balanced though, as shown below:
As the data was not balanced we performed a stratified cross validation to validate the model afterwards.
- Images were standardized and resized
- Images were converted to gray to threshold using Otsu's Binarization. The idea is to get the edges in the image.
- Use the thresholded image as a mask
- Convert image to HSV color space to get the value channel and threshold values in the range of green, red, and yellow.
After the threshold we had something like below:
Not all images were that clean though. Some other examples are shown below:
Even though the images were not completely clear they were still handled pretty good by a CNN. The CNN structure has the following structure:
The model parameters were:
- Loss= categorical_crossentropy
- Optimizer: ADAM with a learning rate decay starting on 1e-3
- Regularization techniques:
- Early stop
- dropout layers
Finally, the model classified correctly the images with an accuracy of 0.91 on validation dataset. Nevertheless, an F1-score would've been more suitable as this dataset was imbalanced. A test in random images of class "green" visually confirmed the performance of the network, as illustrated below: