Awesome
Robust Trust Region for Weakly Supervised Segmentation
This is an implementation for the paper:
- Dmitrii Marin and Yuri Boykov. Robust Trust Region for Weakly Supervised Segmentation. In International Conference on Computer Vision (ICCV), 2021
[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 labeled | Description | Link |
---|---|---|---|
full supervision | ~100% | mobilenet-v2 + deeplab-v3+ | 45MB |
original (full-length scribbles) | ~3% | mobilenet-v2 + deeplab-v3+ | 45MB |
80%-length scribbles | mobilenet-v2 + deeplab-v3+ | 45MB | |
50%-length scribbles | mobilenet-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:
suffix
— one of empty string, 0.8, 0.5, 0.3, 0. Determines the level of supervision, see pre-trained models description.ERROR_PROB
— the robustness parameter ε. Must be between 0 and 1. See paper for details.LR
— the base learning rate (default0.0007
).TR_WEIGHT
— the weight of the unary term in alpha-expansion optimization. See stage-A in the paper.HIDDEN_UPDATE
— the number of iterations of alpha expansion (defualt5
).
Parameter configuration for different levels of supervision
Level of supervision | suffix | ERROR_PROB | TR_WEIGHT |
---|---|---|---|
original (full-length scribbles) | <empty string> | 0.94400 | 0.05 |
80%-length scribbles | 0.8 | 0.94600 | 0.075 |
50%-length scribbles | 0.5 | 0.95140 | 0.1 |
30%-length scribbles (default) | 0.3 | 0.95160 | 0.1 |
clicks (0%-length scribbles) | 0 | 0.95220 | 0.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