This repo illustrates how to use Torch to train a convolutional neural network on the GTSRB dataset (German Traffic Sign Recognition Benchmark) and how to improve the state-of-the-art with a Spatial Transformer layer.
- install Torch (see this guide)
- (optional) install the Spatial Transformer module:
git clone https://github.com/qassemoquab/stnbhwd.git
cd stnbhwd && luarocks make stnbhwd-scm-1.rockspec
CUDA is not mandatory unless you use the Spatial Transformer (see below).
To train a network with all default options:
luajit main.lua
Use luajit main.lua --help
to see all the available options.
In particular use the --no_cuda
option to work in CPU mode.
Method | Accuracy |
---|---|
two spatial transformers with idsia-like network (1) | 99.67 |
single spatial transformer with idsia-like network (2) | 99.46 |
winner of original contest: idsia network | 99.46 |
single idsia-like network (3) | 98.85 |
human performances (corresponding paper) | 98.84 |
(1) luajit main.lua -n -1 --st --net idsia_net.lua --cnn 150,200,300,350 --locnet 200,300,200 --locnet3 150,150,150 -e 26
(2) luajit main.lua -n -1 --net idsia_net.lua --cnn 200,250,350,400 --st --locnet 200,300,200
(3) luajit main.lua -n -1 --net idsia_net.lua --cnn 150,200,300,350
The gtsrb
module is a wrapper around all other modules.
It contains:
gtsrb.dataset
the data loader.gtsrb.networks
the network builder.gtsrb.trainer
the trainer.
To be able to test as much configurations as possible, we use some automatic benchmarking scripts.
See here for details.
This script allows to have an idea of the visual impact of the spatial transformer when it is placed at the input of the network.
Use qlua plot.lua --help
to see the available options.
This script is meant to be used with networks generated by the main.lua
script.