Skip to content

[BMVC'2022 Oral] Official code for Masked Supervised Learning for Semantic Segmentation.

Notifications You must be signed in to change notification settings

hasibzunair/masksup-segmentation

Repository files navigation

MaskSup

Hugging Face Spaces

This is official code for our BMVC 2022 Oral paper:
Masked Supervised Learning for Semantic Segmentation

attention

1. Specification of dependencies

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 

2a. Get datasets

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.

2b. Train & Evaluation code

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.

3. Pre-trained models

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

4. Demo

A HuggingFace Spaces demo of the model trained with MaskSup on NYUDv2 is available at https://huggingface.co/spaces/hasibzunair/masksup-segmentation-demo.

5. Citation

 @inproceedings{zunair2022masked,
    title={Masked Supervised Learning for Semantic Segmentation},
    author={Zunair, Hasib and Hamza, A Ben},
    booktitle={Proc. British Machine Vision Conference},
    year={2022}
  }

Acknowledgements

This code base is built on top of the following repositories:

About

[BMVC'2022 Oral] Official code for Masked Supervised Learning for Semantic Segmentation.

Resources

Stars

Watchers

Forks

Packages

No packages published