This repository contains a PyTorch implementation of the MICCAI 2021 paper "Superpixel-guided Iterative Learning from Noisy Labels for Medical Image Segmentation". [Video].
If you use our code in your publications, please consider citing our paper:
@inproceedings{li2021superpixel,
title={Superpixel-Guided Iterative Learning from Noisy Labels for Medical Image Segmentation},
author={Li, Shuailin and Gao, Zhitong and He, Xuming},
booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention},
year={2021},
}
Install the necessary requirements on your environment of choice:
Key Requirements
- python==3.6.10
# install other necessary packages
pip install -r requirements.txt
- ISIC 2017 datasets: Download training data and test data at this link.
- JSRT datasets: Download image and segmentation masks.
Note: we suggest you to try the code on ISIC dataset first, then apply on JSRT dataset due to its complicated preprocess procedure.
Material:
- data_process/pipeline.py
- ISIC & JSRT clean data
- paramters: change params to your directory in main()
Function:
- train/val split (here val set is used as test set and remain untouched)
- noisy label generation
- convert .png to .json, used as unified input labels.
# change to your parameters first (Params, roots, save_dir)
python pipeline.py
Generate superpixels for input images.
# change to your parameters first (subdir, Params, ...)
python superpixel_generation.py
**We assume noise ratios are given following previous works, thus obtain them here.
# change to your parameters first (subdir, cls, Params, ...)
python stat_noise_ratio.py
Please replace the <data_dir>, <em_save_pseudo_dir> and <sp_name> in the experiment config files.
<data_dir> is the root dir for the dataset. Make sure it looks like:
- data_dir
- train
- image
- label
- label_noise_xx_xx
- <sp_name> # superpixel dir
- val
- ...
- train
For the detailed information of directory settings, please refer to lib/datasets/batch_dataset.py.
After that, start training with following codes.
python main.py --cfg 'exp/proposed/skin_a3b5_spemj01.yaml' --id skin_a3b5_spemj01 --parallel
python main.py --cfg 'exp/proposed/skin_a3b5_spemj01.yaml' --id skin_a3b5_spemj01 --demo 'val' \
--weight_path './checkpoints/skin_a3b5_spemj01/model_epoch_200.pth' --parallel --save_preds True
** Feel free to contact us if confused with above pipeline, and we will make "readme" more clear.
**Clavicles are particularly small, to facilitate fine-grained segmentation and reduce consuming time, we crop their region of interest by statistics on the training set.
**After 2. Simulate Noise Patterns
# change to your parameters first (Params, roots, rois)
python crop_pipeline.py
- Upload JSRT Superpixels & Datasets packages.