Code for GridNet
Switch branches/tags
Nothing to show
Clone or download
Latest commit be065ec Sep 8, 2017
Failed to load latest commit information.
scripts first commit Aug 31, 2017
CityscapesLoader.lua first commit Aug 31, 2017
GridNet.lua first commit Aug 31, 2017
MiniBatch.lua first commit Aug 31, 2017 Update Sep 8, 2017
Trainer.lua first commit Aug 31, 2017
ZeroTarget.lua first commit Aug 31, 2017
evaluation.lua first commit Aug 31, 2017
functions.lua first commit Aug 31, 2017
parameters.lua first commit Aug 31, 2017
train.lua first commit Aug 31, 2017

Residual Conv-Deconv Grid Network for Semantic Segmentation

This work was published at the British Machine Vision Conference (BMVC) 2017.

The paper is available at :

The pretrained model provided is the one used for the paper's evaluation.

The training code is a refactored version of the one that we used for the paper, and has not yet been tested extensively, so feel free to open an issue if you find any problem.


The code is done in Lua using the Torch7 API :

Video results

A video of our results on the Cityscapes datasets demo videos is avalaible there :


Dataset structure

The code is made to train a GridNet with the Cityscapes dataset. If you want to train a new model you need to download the dataset (

Our code use the environment variable CITYSCAPES_DATASET pointing to the root folder of the dataset.

If you want to evaluate the pretrained model you don't need the dataset.

Use a pretrained model

You can download a pretrained model at :

Download the pretrained model and put it in the folder pretrained.

MODEL="pretrained/GridNet.t7" #Pretrained model
FOLDER="$CITYSCAPES_DATASET/leftImg8bit/demoVideo/stuttgart_02/" #Folder containing the images to evaluate

th evaluation.lua -trainLabel -sizeX 400 -sizeY 400 -stepX 300 -stepY 300 -folder $FOLDER -model  $MODEL -rgb -save Test 

Train a model from scratch

You can train a GridNet from scratch using the script train.lua

th train.lua -extraRatio 0 -scaleMin 1 -scaleMax 2.5 -sizeX 400 -sizeY 400 -hflip -model GridNet -batchSize 4 -nbIterationTrain 750 -nbIterationValid 125


Some scripts are given in the folder scripts.

You can plot the current training evolution using the script You need to specified which accuracy you want to plot (pixels, class or iou accuracy). You can plot several accuracy at the same time.

./scripts/ pixels class iou folder_where_the_logs_are


If you use this code or these models in your research, please cite:

  title={Residual Conv-Deconv Grid Network for Semantic Segmentation},
  author={Fourure, Damien and Emonet, R{\'e}mi and Fromont, Elisa and Muselet, Damien and Tr{\'e}meau, Alain and Wolf, Christian},
  booktitle={Proceedings of the British Machine Vision Conference, 2017},


This code is only for academic purpose. For commercial purpose, please contact us.


Authors acknowledge the support from the ANR project SoLStiCe (ANR-13-BS02-0002-01). We also want to thank NVidia for providing two Titan X GPU.