Traffic light detection and classification for self-driving car
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Fazil Altinel 1e161f6dbb
6 years ago
model Rename test to .gitignore 6 years ago
out Add files via upload 6 years ago
LICENSE Initial commit 6 years ago Update 6 years ago Update 6 years ago

Self-Driving Car Traffic Light Detection and Classification


This repository contains a simple TensorFlow implementation of traffic light detection and classification task for Udacity annotated self-driving dataset.


In order to detect traffic lights, a pre-trained model is used (Single Shot Multibox Detector (SSD) with Inception v2 from the TensorFlow Zoo on MS-COCO dataset). The object detector is lightweight. However, the detection accuracy is not high under some conditions such as occlusion. More complex object detectors can perform better.

After the traffic light is detected in an image, a simple method is exploited to classify the color of the traffic light. To classify the color of the traffic light, brightness feature that uses HSV color space is employed. This method cannot achieve very accurate results. However, it is a fast method for real-time inference. For better accuracy, a deep learning based method could be used.

An output video is generated after detection and classification. Find the output video under out/ directory.


The dataset is taken from


model/ - Model files folder
object-dataset/ - Dataset images folder
out/ - Result folder - Loads the model file and detect and recognize traffic light(s) for given input image(s).


Tests are performed with following version of libraries:

  • Python 3.5
  • Numpy 1.15.2
  • TensorFlow 1.5.0
  • OpenCV-Python
  • Pillow

Ubuntu 14.04 LTS is used for the tests.



The source code is licensed under GNU General Public License v3.0.