Single-Stage Semantic Segmentation from Image Labels
This repository contains the original implementation of our paper:
Single-stage Semantic Segmentation from Image Labels
We attain competitive results by training a single network model
for segmentation in a self-supervised fashion using only
image-level annotations (one run of 20 epochs on Pascal VOC).
Setup
Minimum requirements. This project was originally developed with Python 3.6, PyTorch 1.0 and CUDA 9.0. The training requires at least two Titan X GPUs (12Gb memory each).
Setup your Python environment. Please, clone the repository and install the dependencies. We recommend using Anaconda 3 distribution: conda create -n --file requirements.txt
Download and link to the dataset. We train our model on the original Pascal VOC 2012 augmented with the SBD data (10K images in total). Download the data from:
Link to the data: ln -s /data/voc
ln -s /data/sbd
Make sure that the first directory in data/voc is VOCdevkit; the first directory in data/sbd is benchmark_RELEASE.
Download pre-trained models. Download the initial weights (pre-trained on ImageNet) for the backbones you are planning to use and place them into /models/weights/.
Backbone
Initial Weights
Comment
Training, Inference and Evaluation
The directory launch contains template bash scripts for training, inference and evaluation.
Training. For each run, you need to specify names of two variables, for example
EXP=baselines
RUN_ID=v01
Running bash ./launch/run_voc_resnet38.sh will create a directory ./logs/pascal_voc/baselines/v01 with tensorboard events and will save snapshots into ./snapshots/pascal_voc/baselines/v01.
Inference. To generate final masks, please, use the script ./launch/infer_val.sh. You will need to specify:
EXP and RUN_ID you used for training;
OUTPUT_DIR the path where to save the masks;
FILELIST specifies the file to the data split;
SNAPSHOT specifies the model suffix in the format e000Xs0.000. For example, e020Xs0.928;
(optionally) EXTRA_ARGS specify additional arguments to the inference script.
Evaluation. To compute IoU of the masks, please, run ./launch/eval_seg.sh. You will need to specify SAVE_DIR that contains the masks and FILELIST specifying the split for evaluation.
Pre-trained model
For testing, we provide our pre-trained WideResNet38 model:
Backbone
Val
Val (+ CRF)
Link
The also release the masks predicted by this model:
Split
IoU
IoU (+ CRF)
Link
Comment
The suffix -clean means we used ground-truth image-level labels to remove masks of the categories not present in the image. These masks are commonly used as pseudo ground truth to train another segmentation model in fully supervised regime.
Acknowledgements
We thank PyTorch team, and Jiwoon Ahn for releasing his code that helped in the early stages of this project.
Citation
We hope that you find this work useful. If you would like to acknowledge us, please, use the following citation:
@inproceedings{Araslanov:2020:WSEG,
title = {Single-Stage Semantic Segmentation from Image Labels},
author = {Araslanov, Nikita and and Roth, Stefan},
booktitle = {Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2020}
}