Git Product home page Git Product logo

yogeshgajjar / bosch-traffic-sign-detection-yolov3 Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 3.07 MB

Traffic Sign Detection using the state-of-the-art YOLOv3 object detection algorithm on Bosch Small Traffic Sign Dataset.

Home Page: https://www.youtube.com/watch?v=EjTc_iV5x2A&t=97s

License: GNU General Public License v3.0

Python 100.00%
deep-learning deep-neural-networks computer-vision cnn-keras traffic-sign-classification traffic-sign-detection

bosch-traffic-sign-detection-yolov3's Introduction

BOSCH Traffic Sign Detection using YOLOv3

Traffic Sign Detection on Bosch Small Traffic Sign Detection dataset using Yolov3-tiny trained on Jetson TX2

Link to the video

Original

Bosch Small Traffic Sign Dataset

This dataset contains 13427 camera images at a resolution of 1280x720 pixels and contains about 24000 annotated traffic lights. The annotations include bounding boxes of traffic lights as well as the current state (active light) of each traffic light. The camera images are provided as raw 12bit HDR images taken with a red-clear-clear-blue filter and as reconstructed 8-bit RGB color images. The RGB images are provided for debugging and can also be used for training. However, the RGB conversion process has some drawbacks. Some of the converted images may contain artifacts and the color distribution may seem unusual.

Dataset specifications:

Training set:

  • 5093 images
  • Annotated about every 2 seconds
  • 10756 annotated traffic lights
  • Median traffic lights width: ~8.6 pixels
  • 15 different labels
  • 170 lights are partially occluded

Test set:

  • 8334 consecutive images
  • Annotated at about 15 fps
  • 13486 annotated traffic lights
  • Median traffic light width: 8.5 pixels
  • 4 labels (red, yellow, green, off)
  • 2088 lights are partially occluded

Reference from Bosch Small Traffic Light Dataset

Dependencies and Dataset

This repository requires the following dependencies and dataset

  • Python3
  • Bosch Small Traffic Light Dataset - Download all the training .rgb files. Use 7-zip to extract. Make sure you download all the training files before extracting. Details for extracting is given here.
  • Yolov3

Understanding the dataset

After being unzipped, all the image files will reside in multiple folders. Copy or move all the images from different folders to one single folder as it get's easy to manipulate. The images contains the frame at 10th second in the corresponding video.

Create a new folder under rgb/train and rename it as rgb/train/traffic_light_images.

Steps to build

  1. Download the dataset and unzip the image. Create a new folder and copy all the images there as mentioned above.
  2. Clone the Yolov3 darknet repository. Configure the Makefile to enable training it on GPU.
git clone https://github.com/pjreddie/darknet.git
cd darknet
make
  1. We need to convert the train.yaml to VOC format because we have a script which will convert the VOC format to YOLO format. Create another folder traffic_light_xmls in the main directory and use the python script present in the utils/bosch_to_pascal.py.
  • python bosch_to_pascal.py ../train.yaml ../rgb/train/traffic_light_xmls/
  1. Now, we need a .txt file which will contain all the path of the .xmls generated. We need this to convert the labels from VOC pascal format to YOLO format.
  2. Use the python script utils/xml_list_generator, which will generate an output .txt file. Run the following command
  • python xml_list_generator.py PATH_TO_DATASET/rgb/train/traffic_light_xmls/
  1. Now, create a folder to store the YOLO labels. Use the script utils/voc_to_yolo_bosch.py which will generate labels in the YOLO format.
  • python voc_to_yolo_bosch.py PATH_TO_DATASET/rgb/train/traffic_light_labels ../<xml_list generated> PATH_TO_DATASET/rgb/train/traffic_light_images
  1. We need two files "train.txt" and "test.txt" which are basically the image's path. Use the script utils/image_list_generator.py to convert the image into a single .txt file.
  • python image_list_generator.py PATH_TO_DATASET/rgb/train/traffic_light_images/
  1. Split of the image .txt file into test and train needs to be done. Use the script utils/train_test_split.py to convert it into two seperate .txt file based on the percentage.
  • python train_test_split.py <name of image_txt file> 0.2
  1. It's time to copy everything into darknet folder we cloned earlier. First copy the bosch.data and bosch.names from the \data folder to a new folder (traffic_lights) in the darknet yolov3 main folder.
cd darknet
mkdir traffic_lights
  1. Copy the yolov3-tiny-bosch.cfg from the \config folder to the same (traffic_lights) folder. Finally make sure you have the following files in the traffic_lights folder.
  • train.txt
  • test.txt
  • bosch.data
  • bosch.names
  • yolov3-tiny-bosch.cfg
  • backup folder which stores the weights
  1. Download the yolov3 imagenet darknet53 weights
  2. Run the following on terminal for training the model
cd darknet
./darknet detector train traffic_lights/bosch.data traffic_lights/yolov3-tiny-bosch.cfg darknet53.conv.74

Test the model performance

The yolov3 trained weights can be used to see the performance by running the following command on terminal.

cd darknet
./darknet detector demo traffic_lights/bosch.data traffic_lights/yolov3-tiny-bosch.cfg traffic_lights/backup/<weight_file> <video file>

Final Output

Original

bosch-traffic-sign-detection-yolov3's People

Contributors

yogeshgajjar avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

tonmoy-ts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.