Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Train image classification on ImageNet

Use as many default commands as possible:

python3 train <data_folder> -a dla34

With more data settings:

python3 train <data_folder> -a dla34 --data-name imagenet \
    --classes 1000 -j 4 --epochs 120 --start-epoch 0 --batch-size 256 \
    --crop-size 224 --scale-size 256

If you want to train on a dataset that is not already defined in, please specify a new data name and put info.json in the data folder. info.json contains a dictionary with required values mean and std, which are the mean and standard deviation of the images in the new dataset. A full set of options can be found in The other useful fields are eigval and eigvec, which are the eigen values and vectors for the image pixel variations in the dataset. A minimal info.json looks like:

    "mean": [0.485, 0.456, 0.406],
    "std":  [0.229, 0.224, 0.225]

If the new dataset contains 2 classes, the command can start with:

python3 train <data_folder> -a dla34 --data-name new_data \
    --classes 2

If you want to start your training with models pretrained on ImageNet and fine tune the model with learning rate 0.01, you can do

python3 train <data_folder> -a dla34 --data-name new_data \
    --classes 2 --pretrained imagenet --lr 0.01

Segmentation and Boundary Prediction

Segmentation and boundary prediction data format is the same as DRN.

To use --bn-sync, please include lib in PYTHONPATH.


python3 train -d <data_folder> -c 19 -s 832 --arch dla102up \
    --scale 0 --batch-size 16 --lr 0.01 --momentum 0.9 --lr-mode poly \
    --epochs 500 --bn-sync --random-scale 2 --random-rotate 10 \
    --random-color --pretrained-base imagenet

bn-sync is not necessary for CamVid and boundaries with 12GB GPU memory.


python3 train -d <data_folder> -c 11 -s 448 --arch dla102up \
    --scale 0 --batch-size 16 --epochs 1200 --lr 0.01 --momentum 0.9 \
    --step 800 --pretrained-base imagenet --random-scale 2 --random-rotate 10 \
    --random-color --save-feq 50


python3 train -d <data_folder> -c 2 -s 416 --arch dla102up \
    --scale 0 --batch-size 16 --epochs 1200 --lr 0.01 --momentum 0.9 \
    --step 800 --pretrained-base imagenet --random-rotate 180 --random-color \
    --save-freq 50 --edge-weight 10 --bn-sync

PASCAL Boundary

python3 train -d <data_folder> -c 2 -s 480 --arch dla102up \
    --scale 0 --batch-size 32 --epochs 400 --lr 0.01 --momentum 0.9 \
    --step 200 --pretrained-base imagenet --random-rotate 10 --random-color \
    --save-freq 25 --edge-weight 10


How many GPUs does the program require for training?

We tested all the training on GPUs with at least 12 GB memory. We usually tried to use fewest GPUs for the batch sizes. So the actually number of required GPUs is different between models, depending on the model sizes. Some model training may require 8 GPUs, such as training dla102up on Cityscapes dataset.