Home

Awesome

Robust Trust Region for Weakly Supervised Segmentation

This is an implementation for the paper:

[paper page] [arxiv] [poster] [video]

If you find this code useful in your research, consider citing (bibtex):

@InProceedings{Marin_2021_ICCV,
    author    = {Marin, Dmitrii and Boykov, Yuri},
    title     = {Robust Trust Region for Weakly Supervised Segmentation},
    booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
    month     = {October},
    year      = {2021},
    pages     = {6608-6618}
}
<img src="https://user-images.githubusercontent.com/3115577/136873099-8b708f5f-592c-4c50-b729-f9e52462fd48.png" style="width: 70%;" alt="Results on ScribbleSup dataset. We are the best!">
Results on ScribbleSup dataset using Deeplab-V3+ and MobileNet-V2. Our Robust Trust Region (Grid-TR) outperforms other weakly-supervised methods (gradient descent - Grid-DG) and objectives (Dense-GD, PCE-GD)

Prerequisites

Environment

The code uses the following python packages: pytorch, tqdm, scipy, tensorboardX.

ScribbleSup dataset

Download original PASCAL VOC 2012 dataset: http://host.robots.ox.ac.uk/pascal/VOC/.

Download Scribble annotations: http://cs.uwaterloo.ca/~m62tang/rloss/pascal_2012_scribble.zip, the original dataset can be found here.

Building and installing python extensions

Alpha-expansion code (GCO) for GridCRF regularized loss with Robust Trust Region:

cd wrapper/alpha_expansion
swig -python -c++ alpha_expansion.i
python setup.py install

Bilateral filtering for the DenseCRF regularized loss:

cd wrapper/bilateralfilter
swig -python -c++ bilateralfilter.i
python setup.py install

Loading pre-trained models

All TR models require pretraining with partial cross-entropy. The models can be downloaded using the links:

Level of supervision% of image pixels labeledDescriptionLink
full supervision~100%mobilenet-v2 + deeplab-v3+45MB
original (full-length scribbles)~3%mobilenet-v2 + deeplab-v3+45MB
80%-length scribblesmobilenet-v2 + deeplab-v3+45MB
50%-length scribblesmobilenet-v2 + deeplab-v3+45MB
30%-length scribbles~1%mobilenet-v2 + deeplab-v3+45MB
clicks (0%-length scribbles)mobilenet-v2 + deeplab-v3+45MB

Training with Robust Trust Region

Run the following script:

bash full_tr_error_const.sh 

The script is controlled by the following environmental variables:

Parameter configuration for different levels of supervision

Level of supervisionsuffixERROR_PROBTR_WEIGHT
original (full-length scribbles)<empty string>0.944000.05
80%-length scribbles0.80.946000.075
50%-length scribbles0.50.951400.1
30%-length scribbles (default)0.30.951600.1
clicks (0%-length scribbles)00.952200.1

For example, the following will train a model using fulllength scribbles:

suffix= ERROR_PROB=0.94400 TR_WEIGHT=0.05 bash full_tr_error_const.sh