Region Impurity and Prediction Uncertainty (CVPR Oral)
Binhui Xie, Longhui Yuan, Shuang Li, Chi Harold Liu and Xinjing Cheng
This repository provides the official code for the paper Towards Fewer Annotations: Active Learning via Region Impurity and Prediction Uncertainty for Domain Adaptive Semantic Segmentation.
π₯³ We are happy to announce that RIPU was accepted at CVPR 2022 Oral Presentation.
Overview
We propose a simple region-based active learning approach for semantic segmentation under a domain shift, aiming to automatically query a small partition of image regions to be labeled while maximizing segmentation performance. Our algorithm, RIPU, introduces a new acquisition strategy characterizing the spatial adjacency of image regions along with the prediction confidence. The proposed region-based selection strategy makes more efficient use of a limited budget than image-based or point-based counterparts.
We show some qualitative examples from the Cityscapes validation set,
and also visualize the queried regions to annotate.
For more information on RIPU, please check our Paper.
Usage
Prerequisites
- Python 3.7
- Pytorch 1.7.1
- torchvision 0.8.2
Step-by-step installation
conda create --name ADASeg -y python=3.7
conda activate ADASeg
# this installs the right pip and dependencies for the fresh python
conda install -y ipython pip
# this installs required packages
pip install -r requirements.txt
Data Preparation
- Download The Cityscapes Dataset, The GTAV Dataset, and The SYNTHIA Dataset
Symlink the required dataset
ln -s /path_to_cityscapes_dataset datasets/cityscapes
ln -s /path_to_gtav_dataset datasets/gtav
ln -s /path_to_synthia_dataset datasets/synthia
Generate the label static files for GTAV/SYNTHIA Datasets by running
python datasets/generate_gtav_label_info.py -d datasets/gtav -o datasets/gtav/
python datasets/generate_synthia_label_info.py -d datasets/synthia -o datasets/synthia/
The data folder should be structured as follows:
βββ datasets/
β βββ cityscapes/
| | βββ gtFine/
| | βββ leftImg8bit/
β βββ gtav/
| | βββ images/
| | βββ labels/
| | βββ gtav_label_info.p
β βββ synthia
| | βββ RAND_CITYSCAPES/
| | βββ synthia_label_info.p
β βββ
Model Zoo
We have put our model checkpoints here [Google Drive] [ηΎεΊ¦η½η] (ζεη RIPU
).
GTAV to Cityscapes
name | backbone | budget | mIoU | ckpt | where in Our Paper | |
1 | RIPU-PA | V2 | 40 px | 65.5 | Google DriveΒ /Β BaiDuΒ | Table 1 |
2 | RIPU-RA | V2 | 2.2% | 69.6 | Google DriveΒ /Β BaiDuΒ | Table 1 |
3 | RIPU-RA | V3+ | 5.0% | 71.2 | Google DriveΒ /Β BaiDuΒ | Table 1 |
SYNTHIA to Cityscapes
name | backbone | budget | mIoU | ckpt | where in Our Paper | |
1 | RIPU-PA | V2 | 40 px | 66.1 | Google DriveΒ /Β BaiDuΒ | Table 2 |
2 | RIPU-RA | V2 | 2.2% | 70.1 | Google DriveΒ /Β BaiDuΒ | Table 2 |
3 | RIPU-RA | V3+ | 5.0% | 71.4 | Google DriveΒ /Β BaiDuΒ | Table 2 |
Source-free scenarios
task | budget | mIoU | source pre-trained ckpt | adapted ckpt | Where in Our Paper | |
1 | GTAV to Cityscapes | 2.2% | 67.1 | Google DriveΒ /Β BaiDuΒ | Google DriveΒ /Β BaiDuΒ | Table 12 |
2 | SYNTHIA to Cityscapes | 2.2% | 68.7 | Google DriveΒ /Β BaiDuΒ | Google DriveΒ /Β BaiDuΒ | Table 13 |
RIPU Training
We provide the training scripts in scripts/
using a single GPU.
# training for GTAV to Cityscapes
sh gtav_to_cityscapes.sh
# training for SYNTHIA to Cityscapes
sh synthia_to_cityscapes.sh
RIPU Testing
To evaluate RIPU e.g. GTAV to Cityscapes (v3+, 5.0%), use the following command:
python test.py -cfg configs/gtav/deeplabv3plus_r101_RA.yaml resume checkpint/v3plus_gtav_ra_5.0_precent/model_last.pth OUTPUT_DIR checkpint/v3plus_gtav_ra_5.0_precent
Acknowledgements
This project is based on the following open-source projects: FADA and SDCA. We thank their authors for making the source code publically available.
Citation
If you find this project useful in your research, please consider citing:
@InProceedings{xie2022ripu,
author = {Xie, Binhui and Yuan, Longhui and Li, Shuang and Liu, Chi Harold and Cheng, Xinjing},
title = {Towards Fewer Annotations: Active Learning via Region Impurity and Prediction Uncertainty for Domain Adaptive Semantic Segmentation},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2022},
pages = {8068-8078}
}
Contact
If you have any problem about our code, feel free to contact
or describe your problem in Issues.