This is official code for our BMVC 2022 Oral paper:
Masked Supervised Learning for Semantic Segmentation
This code requires Python 3.8.12. Run the following to install the required packages.
conda update conda
conda env create -f environment.yml
conda activate msl
First, open a folder named
datasets
in the root folder (mkdir datasets
). Then, download GLaS, Kvasir & CVC-ClinicDB and NYUDv2 datasets as well as the sribbles from GitHub Releases. Finally, unzip and move the four folder to datasets
.
To train and evaluate MaskSup on GLaS or Kvasir & CVC-ClinicDB datasets, you need to change the EXPERIMENT_NAME
in trainval_glas_polyp.py
to a name that has glas or polyp. For example to train on GLaS, set EXPERIMENT_NAME = "glas_masksup"
. Then run:
python trainval_glas_polyp.py
To train and evaluate MaskSup on NYUDv2 dataset, run:
python trainval_nyudv2.py
All experiments are conducted on a single NVIDIA 3080Ti GPU. For additional implementation details and results, please refer to the supplementary material here.
We provide pretrained models on GitHub Releases for reproducibility.
Dataset | Backbone | mIoU(%) | Download |
---|---|---|---|
GLaS | LeViT-UNet 384 | 76.06 | download |
Kvasir & CVC-ClinicDB | LeViT-UNet 384 | 84.02 | download |
NYUDv2 | U-Net++ | 39.31 | download |
A HuggingFace Spaces demo of the model trained with MaskSup on NYUDv2 is available at https://huggingface.co/spaces/hasibzunair/masksup-segmentation-demo.
@inproceedings{zunair2022masked,
title={Masked Supervised Learning for Semantic Segmentation},
author={Zunair, Hasib and Hamza, A Ben},
booktitle={Proc. British Machine Vision Conference},
year={2022}
}
This code base is built on top of the following repositories: