RobustNet (CVPR 2021 Oral): Official Project Webpage

This repository provides the official PyTorch implementation of the following paper:

RobustNet: Improving Domain Generalization in Urban-Scene Segmentationvia Instance Selective Whitening
Sungha Choi* (LG AI Research), Sanghun Jung* (KAIST AI), Huiwon Yun (Sogang Univ.)
Joanne T. Kim (Korea Univ.), Seungryong Kim (Korea Univ.), Jaegul Choo (KAIST AI) (*: equal contribution)
CVPR 2021, Accepted as Oral Presentation

Paper: arxiv

Slide: slideshare

Youtube Video (English): Youtube / 5min

Short Seminar (Korean): LG AI Day / 12min, AIIS Spring Retreat / 7min

Enhancing the generalization performance of deep neural networks in the real world (i.e., unseen domains) is crucial for safety-critical applications such as autonomous driving.
To address this issue, this paper proposes a novel instance selective whitening loss to improve the robustness of the segmentation networks for unseen domains.
Our approach disentangles the domain-specific style and domain-invariant content encoded in higher-order statistics (i.e., feature covariance) of the feature representations and selectively removes only the style information causing domain shift.
As shown in the below figure, our method provides reasonable predictions for (a) low-illuminated, (b) rainy, and (c) unexpected new scene images.
These types of images are not included in the training dataset that the baseline shows a significant performance drop, contrary to ours.
Being simple but effective, our approach improves the robustness of various backbone networks without additional computational cost.
We conduct extensive experiments in urban-scene segmentation and show the superiority of our approach over existing work.


Code Contributors

Sungha Choi (LG AI Research), Sanghun Jung (KAIST AI)

Concept Video

Click the figure to watch the youtube video of our paper!

Pytorch Implementation


Clone this repository.

git clone
cd RobustNet

Install following packages.

conda create --name robustnet python=3.7
conda activate robustnet
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
conda install scipy==1.1.0
conda install tqdm==4.46.0
conda install scikit-image==0.16.2
pip install tensorboardX
pip install thop
pip install kmeans1d
imageio_download_bin freeimage

How to Run RobustNet

We evaludated RobustNet on Cityscapes, BDD-100K,Synthia (SYNTHIA-RAND-CITYSCAPES), GTAV and Mapillary Vistas.

We adopt Class uniform sampling proposed in this paper to handle class imbalance problems. GTAVUniform and CityscapesUniform are the datasets to which Class Uniform Sampling is applied.

  1. For Cityscapes dataset, download "" and "" from

    Unzip the files and make the directory structures as follows.
 └ leftImg8bit_trainvaltest
   └ leftImg8bit
     └ train
     └ val
     └ test
 └ gtFine_trainvaltest
   └ gtFine
     └ train
     └ val
     └ test
 └ images
   └ train
   └ val
   └ test
 └ labels
   └ train
   └ val
 └ training
   └ images
   └ labels
 └ validation
   └ images
   └ labels
 └ test
   └ images
   └ labels

We used GTAV_Split to split GTAV dataset into training/validation/test set. Please refer the txt files in split_data.

 └ images
   └ train
     └ folder
   └ valid
     └ folder
   └ test   
     └ folder
 └ labels
   └ train
     └ folder
   └ valid
     └ folder
   └ test   
     └ folder

We randomly splitted Synthia dataset into train/val set. Please refer the txt files in split_data.

 └ RGB
   └ train
   └ val
 └ GT
   └ COLOR
     └ train
     └ val
     └ train
     └ val
  1. You should modify the path in "<path_to_robustnet>/" according to your dataset path.
#Cityscapes Dir Location
#Mapillary Dataset Dir Location
#GTAV Dataset Dir Location
#BDD-100K Dataset Dir Location
#Synthia Dataset Dir Location
  1. You can train RobustNet with following commands.
<path_to_robustnet>$ CUDA_VISIBLE_DEVICES=0,1,2,3 ./scripts/ # Train: GTAV, Test: BDD100K, Cityscapes, Synthia, Mapillary / ResNet50, Ours (ISW)
<path_to_robustnet>$ CUDA_VISIBLE_DEVICES=0,1,2,3 ./scripts/ # Train: GTAV, Test: BDD100K, Cityscapes, Synthia, Mapillary / ResNet50, IBN-Net
<path_to_robustnet>$ CUDA_VISIBLE_DEVICES=0,1,2,3 ./scripts/ # Train: GTAV, Test: BDD100K, Cityscapes, Synthia, Mapillary / ResNet50, Baseline (DeepLabV3+)
<path_to_robustnet>$ CUDA_VISIBLE_DEVICES=0,1 ./scripts/ # Train: Cityscapes, Test: BDD100K, GTAV, Synthia, Mapillary / ResNet50, Ours(ISW)
<path_to_robustnet>$ CUDA_VISIBLE_DEVICES=0,1 ./scripts/ # Train: Cityscapes, / ResNet50, IBN-Net
<path_to_robustnet>$ CUDA_VISIBLE_DEVICES=0,1 ./scripts/ # Train: Cityscapes, / ResNet50, Baseline (DeepLabV3+)

Pretrained Models

All models trained for our paper

You can download all models evaluated in our paper at Google Drive

  1. You can validate pretrained model with following commands.
<path_to_robustnet>$ CUDA_VISIBLE_DEVICES=0,1 ./scripts/ <weight_file_location>
  1. You can infer the segmentation results from images through pretrained model using a sliding window or a pooling method.
<path_to_robustnet>$ CUDA_VISIBLE_DEVICES=0,1 ./scripts/ <weight_file_location> <result_save_location>

ImageNet pretrained ResNet-101 which has three 3×3 convolutions in the first layer

To train ResNet-101 based RobustNetNet, you should download ImageNet pretrained ResNet-101 from this link. Put it into following directory.


This pretrained model is from MIT CSAIL Computer Vision Group


Our pytorch implementation is heavily derived from NVIDIA segmentation and HANet.
Thanks to the NVIDIA implementations.