/German-Traffic-Sign-Recognition-with-Deep-Learning

Recognizing traffic signs with deep learning and PyTorch using Spatial Transformer Convolutional Neural Networks.

Primary LanguageJupyter NotebookMIT LicenseMIT

German Traffic Sign Recognition

xs:code

About the Project

This project is an implementation of recognition of traffic signs using deep learning. We are using the German Traffic Sign Recognition Benchmark dataset along with the Spatial Transformer Network that is proposed in Deep neural network for traffic sign recognition systems: An analysis of spatial transformers and stochastic optimisation methods..

Feel free to use, modify, distribute, and build upon the project in whatever way you feel it will be useful and better.

Download the trained weights file from here.

Contents

Dependencies and Frameworks

Now, just to give an idea of what to results expect from this project:

In my opinion, it would have been pretty difficult for a human to tell what the sign is.

Project Structure

  • Note: The input folder in this repo will be empty. I have included all the sub-folders without any files so that you can easily set-up the project directory as I have. But you are free to setup your input data directory as you like it. You just have to change the paths in the python programs.

  • LINK TO DOWNLOAD ALL THE TRAINING AND TEST DATA => https://sid.erda.dk/public/archives/daaeac0d7ce1152aea9b61d9f1e19370/published-archive.html

  • The following is the structure that I have used.

    ├───input
    │   └───german_traffic_sign
    │       └───GTSRB
    │           ├───Final_Test
    │           │   └───Images
    │           └───Final_Training
    │               └───Images
    ├───notebooks
    │   └───...
    ├───outputs
    └───src
        └───*.py files
    

Important Note About the Paths in the Python Scripts

  • In the python scripts, you may find that the paths to files and images may be in the following structure:
    • ../../input/path/to/files/and/images
  • The extra ../ is because of how I arrange my vision datasets globally You can easily omit the first ../ So, for you, the path will become:
    • ../input/path/to/files/and/images
  • That's it. You are good to go.

Steps to Train and Test

  • If you have the compute power and want to train your own network, then execute the files in the following order:
    • Execute preprocess.py just one.
      • python preprocess.py
    • Then execute train.py.
      • python train.py
  • Now, if you just want to test the network by loading the trained weights, then:
    • Download the weights from here.
    • Then just execute test.py.
      • python test.py

Results

After 20 epochs Accuracy Loss
Training 99.63% 0.0001
Validation 98.72% 0.0002

Some Results on the Test Data

References