Coder Social home page Coder Social logo

dgnet's Introduction

Semi-supervised Meta-learning with Disentanglement for Domain-generalised Medical Image Segmentation

model

This repository contains the official Pytorch implementation of Semi-supervised Meta-learning with Disentanglement for Domain-generalised Medical Image Segmentation(accepted by MICCAI 2021 as Oral). Check the presentation in our official YouTube channel.

The repository is created by Xiao Liu, Spyridon Thermos, Alison O'Neil, and Sotirios A. Tsaftaris, as a result of the collaboration between The University of Edinburgh and Canon Medical Systems Europe. You are welcome to visit our group website: vios.s

System Requirements

  • Pytorch 1.5.1 or higher with GPU support
  • Python 3.7.2 or higher
  • SciPy 1.5.2 or higher
  • CUDA toolkit 10 or newer
  • Nibabel
  • Pillow
  • Scikit-image
  • TensorBoard
  • Tqdm

Datasets

We used two datasets in the paper: Multi-Centre, Multi-Vendor & Multi-Disease Cardiac Image Segmentation Challenge (M&Ms) datast and Spinal cord grey matter segmentation challenge dataset. The dataloader in this repo is only for M&Ms dataset.

Preprocessing

You need to first change the dirs in the scripts of preprocess folder. Download the M&Ms data and run split_MNMS_data.py to split the original dataset into different domains. Then run save_MNMS_2D.py to save the original 4D data as 2D numpy arrays. Finally, run save_MNMS_re.py to save the resolution of each datum.

Training

Note that the hyperparameters in the current version are tuned for BCD to A cases. For other cases, the hyperparameters and few specific layers of the model are slightly different. To train the model with 5% labeled data, run:

python train_meta.py -e 150 -c cp_dgnet_meta_5_tvA/ -t A -w DGNetRE_COM_META_5_tvA -g 0

Here the default learning rate is 4e-5. You can change the learning rate by adding -lr 0.00002 (sometimes this is better).

To train the model with 100% labeled data, try to change the training parameters to:

k_un = 1
k1 = 20
k2 = 2

The first parameter controls how many iterations you want the model to be trained with unlabaled data for every iteration of training. k1 = 20 means the learning rate will start to decay after 20 epochs and k2 = 2 means it will check if decay learning every 2 epochs.

Also, change the ratio k=0.05 (line 221) to k=1 in mms_dataloader_meta_split.py.

Then, run:

python train_meta.py -e 80 -c cp_dgnet_meta_100_tvA/ -t A -w DGNetRE_COM_META_100_tvA -g 0

Finally, when training the model, changing the resampling_rate=1.2 (line 47) in mms_dataloader_meta_split.py to 1.1 - 1.3 may cause better results. This will change the rescale ratio when preprocessing the images, which will affect the size of the anatomy of interest.

Inference

After training, you can test the model:

python inference.py -bs 1 -c cp_dgnet_meta_100_tvA/ -t A -g 0

This will output the DICE and Hausdorff results as well as the standard deviation. Similarly, changing the resampling_rate=1.2 (line 47) in mms_dataloader_meta_split_test.py to 1.1 - 1.3 may cause better results.

Qualitative results

results

Citation

@inproceedings{liu2021semi,
  title={Semi-supervised Meta-learning with Disentanglement for Domain-generalised Medical Image Segmentation},
  author={Liu, Xiao and Thermos, Spyridon and O’Neil, Alison and Tsaftaris, Sotirios A},
  booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention},
  pages={307--317},
  year={2021},
  organization={Springer}
}

Acknowlegement

Part of the code is based on SDNet, MLDG, medical-mldg-seg and Pytorch-UNet.

License

All scripts are released under the MIT License.

dgnet's People

Contributors

xxxliu95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

vios-s mgawali

dgnet's Issues

How to generate the Re directory?

Thanks for sharing and answering my questions.

I have ran the data preprocess code, but I still can not generate the ReA_dir for training. Could you please also share this part of code? Or could you please tell me how to deal with this directory for training?

Thanks in advance.

How do you calculate hausdorff distance?

I noticed that you use the hausdorff distance as one of the metrics. But I could not find your code about calculating this distance. So I tried to use the scipy library to calculate. I found that the results are quite different. I always get larger results than the results given in the paper. So could you show me the code?

How many times an experiment will be repeated?

I noticed that there was always a big deviation in the table. And I could not find how many times an experiment would be repeated in the paper. So I want to ask about this question.

Question on the difference in results after reproduction

Hi Xiao!

Thank you for your sharing.

I have reproduced the results using the code you shared. The environment is as followed:

  • Python 3.7.11
  • Pytorch 1.7.1
  • Scipy 1.7.1
  • Cuda toolkit 10.1.168
    hardware support: NVidia 2080 Ti GPU

I got the Dice results and standard deviations on MNMS dataset, using 100% data from source domain. From my reproduction, however, the scores are consistently lower than the results given in the paper:
B,C,D ---> A: 81.85(7.0) compared to 83.21(7.4) in the paper;
A,C,D ---> B: 81.49(8.2) compared to 86.53(5.3) in the paper;
A,B,D ---> C: 83.37(7.0) compared to 87.22(6.1) in the paper.

Could you possibly know what may be the reason behind the differences? Thanks in advance!

no Unlabeled/vendorC

no Unlabeled/vendorC. should I move the unlabeled dir in Training into this dir?

How to preprocess the data?

Hi!
Thanks for sharing! I have downloaded the datasets but I don't know how to preprocess them. Could you please upload the data preprocess code? Thanks in advance.

backbone

Hello, may I ask if the backbone network of your comparative experiment is Unet, and is it the same as your method.

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.