Giter Club home page Giter Club logo

bayeseg's Introduction

BayeSeg

The official implementation of "Joint Modeling of Image and Label Statistics for Enhancing Model Generalizability of Medical Image Segmentation", which has been accepted by MICCAI 2022.

Content

Dependencies

BayeSeg was implemented on Ubuntu 16.04 with Python 3.6. Before training and test, please create an environment via Anaconda (suppose it has been installed on your computer), and install pytorch 1.10.2, as follows,

conda create -n BayeSeg python=3.6
source activate BayeSeg
conda install torch==1.10.2

Besides, please install other packages using pip install -r requirements.txt.

Quick test

BayeSeg was tested on the public datasets from MICCAI 2017 ACDC and MICCAI 2019 MS-CMRSeg. For ACDC, all training cases were used for test. For MS-CMRSeg, 15 cases were randomly selected for test.

Datasets/Models Parameters BaiduPan OneDrive
ACDC - link link
MS-CMRSeg - link s4t8 link
Unet 25.8M link 1zgr link
PUnet 5.0M link 07rm link
Baseline 26.9M link 1i7y link
BayeSeg 26.9M link 0an5 link
  • ACDC comes from MICCAI 2017 ACDC, one needs to download it from its official homepage.
  • MS-CMRSeg.zip contains three folders, i.e., train, val, and test.
    • train contains 25 subjects randomly selected from LGE CMR of MS-CMRSeg
    • val contains 5 subjects randomly selected from LGE CMR of MS-CMRSeg
    • test contains three sequences, i.e., C0 (bSSFP CMR), LGR (LGE CMR), and T2 (T2-weighted CMR), and each sequence consists of 15 subjects randomly selected from MS-CMRSeg.
  • Unet.zip contains the checkpoint of U-Net model, which was trained on LGE CMR using cross-entropy.
  • PUnet.zip contains the checkpoint of PU-Net model, which was trained on LGE CMR using its default loss.
  • Baseline.zip contains the checkpoint of Baseline model, which was trained on LGE CMR only using cross-entropy.
  • BayeSeg.zip contains the checkpoint of BayeSeg model, which was trained on LGE CMR using an additional variational loss.

We have provided the script of testing U-Net, PU-Net, Baseline, and BayeSeg in demo.sh. Please start testing these models as follows.

The setting of test directory is defined in inference.py as follows,

if dataset in ['MSCMR', 'ACDC']:
    test_folder = "../Datasets/{}/test/{}/images/".format(dataset, sequence)
    label_folder = "../Datasets/{}/test/{}/labels/".format(dataset, sequence)
else:
    raise ValueError('Invalid dataset: {}'.format(dataset))

For ACDC, one need to download this dataset from its homepage, and then prepare test data as above.

To test the performance of U-Net, PU-Net, Baseline, and BayeSeg on the LGE CMR of MS-CMRSeg, please uncomment the corresponding line in demo.sh, and then run sh demo.sh.

# test Unet
# CUDA_VISIBLE_DEVICES=0 python -u main.py --model Unet --eval --dataset MSCMR --sequence LGR --resume logs/Unet/checkpoint.pth --output_dir results --device cuda

# test PUnet
# CUDA_VISIBLE_DEVICES=0 python -u main.py --model PUnet --eval --dataset MSCMR --sequence LGR --resume logs/PUnet/checkpoint.pth --output_dir results --device cuda

# test baseline
# CUDA_VISIBLE_DEVICES=0 python -u main.py --model Baseline --eval --dataset MSCMR --sequence LGR --resume logs/Baseline/checkpoint.pth --output_dir results --device cuda

# test BayeSeg
# CUDA_VISIBLE_DEVICES=0 python -u main.py --model BayeSeg --eval --dataset MSCMR --sequence LGR --resume logs/BayeSeg/checkpoint.pth --output_dir results --device cuda

Here, --sequence can be set to C0, LGR, or T2 for MS-CMRSeg, and C0 for ACDC. For example, to test the cross-sequence segmentation performance of U-Net, PU-Net, Baseline, and BayeSeg on the T2-weighted CMR of MS-CMRSeg, please set --sequence LGR to --sequence T2.

How to train

All models were trained using LGE CMR of MS-CMRSeg, and the root of training data is defined in data/mscmr.py as follows,

root = Path('your/dataset/directory' + args.dataset)

Please replace your/dataset/directory with your own directory.

To train U-Net, PU-Net, Baseline, and BayeSeg, please uncomment the corresponding line in demo.sh, and run sh demo.sh.

# train Unet
# CUDA_VISIBLE_DEVICES=0 python -u main.py --model Unet --batch_size 8 --output_dir logs/Unet --device cuda

# train PUnet
# CUDA_VISIBLE_DEVICES=0 python -u main.py --model PUnet --batch_size 8 --output_dir logs/PUnet --device cuda

# train Baseline
# CUDA_VISIBLE_DEVICES=0 python -u main.py --model Baseline --batch_size 8 --output_dir logs/Baseline --device cuda

# train BayeSeg
# CUDA_VISIBLE_DEVICES=0 python -u main.py --model BayeSeg --batch_size 8 --output_dir logs/BayeSeg --device cuda

Citation

If our work is helpful in your research, please cite this as follows.

[1] S. Gao, H. Zhou, Y. Gao, and X. Zhuang, "Joint Modeling of Image and Label Statistics for Enhancing Model Generalizability of Medical Image Segmentation," arXiv e-print, arXiv:2206.04336, 2022. [arXiv] [MICCAI]

@Article{Gao/BayeSeg/2022,
	title =	 {Joint Modeling of Image and Label Statistics for Enhancing Model Generalizability of Medical Image Segmentation},
	author = {Gao, Shangqi and Zhou, Hangqi and Gao, Yibo and Zhuang, Xiahai},
  journal = {	arXiv e-print, arXiv:2206.04336},
  year = 2022
}

Don't hesitate to contact us via [email protected] or [email protected], if you have any questions.

bayeseg's People

Contributors

shangqigao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.