This is the code for the paper
Deep neural network for traffic sign recognition systems: An analysis of spatial transformers and stochastic optimisation methods
Álvaro Arcos-García,
Juan Antonio Álvarez-García,
Luis M. Soria-Morillo
The paper addresses the problem of traffic sign classification using a Deep Neural Network which comprises Convolutional layers and Spatial Transfomer Networks. The model reports an accuracy of 99.71% in the German Traffic Sign Recognition Benchmark.
We provide:
- A pretrained model.
- Test code to run the model on new images.
- Instructions for training the model.
If you find this code useful in your research, please cite:
"Deep neural network for traffic sign recognition systems: An analysis of spatial transformers and stochastic optimisation methods."
Álvaro Arcos-García, Juan A. Álvarez-García, Luis M. Soria-Morillo. Neural Networks 99 (2018) 158-165.
This project is implemented in Torch, and depends on the following packages: torch/torch7, torch/nn, torch/image, qassemoquab/stnbhwd, torch/cutorch, torch/cunn, cuDNN bindings for Torch and nninit.
After installing torch, you can install / update these dependencies by running the following:
luarocks install torch
luarocks install nn
luarocks install image
luarocks install cutorch
luarocks install cunn
luarocks install cudnn
luarocks install https://raw.githubusercontent.com/qassemoquab/stnbhwd/master/stnbhwd-scm-1.rockspec
luarocks install https://raw.githubusercontent.com/Kaixhin/nninit/master/rocks/nninit-scm-1.rockspec
You can download a pretrained model from Google Drive.
Unzip the file gtsrb_cnn3st_pretrained.zip
and move its content to the folder pretrained
of this project. It contains the pretrained model that obtains an accuracy of 99.71% in the German Traffic Sign Recognition Benchmark (GTSRB) and a second file with the mean and standard deviation values computed during the training process.
To run the model on new images, use the script run_model.lua
. It will run the pretrained model on the images provided in the sample_images
folder:
th run_model.lua
To train and experiment with new traffic sign classification models, please follow the following steps:
- Use the script
download_gtsrb_dataset.lua
which will create a new folder calledGTSRB
that will include two folders:train
andval
.th download_gtsrb_dataset.lua
- Use the script
main.lua
setting the training parameters described in the fileopts.lua
. For example, the following options will generate the files needed to train a model with just one spatial transformer network localized at the beginning of the main network:The next example, will create a model with three spatial transformer networks:th main.lua -data GTSRB -save GTSRB/checkpoints -dataset gtsrb -nClasses 43 -optimizer adam -LR 1e-4 -momentum 0 -weightDecay 0 -batchSize 50 -nEpochs 15 -weightInit default -netType cnn3st -globalNorm -localNorm -cNormConv -locnet2 '' -locnet3 '' -showFullOutput
th main.lua -data GTSRB -save GTSRB/checkpoints -dataset gtsrb -nClasses 43 -optimizer rmsprop -LR 1e-5 -momentum 0 -weightDecay 0 -batchSize 50 -nEpochs 15 -weightInit default -netType cnn3st -globalNorm -localNorm -cNormConv -showFullOutput
The source code of this project is mainly based on fb.resnet.torch and gtsrb.torch.