GithubHelp home page GithubHelp logo

segmentation-renormalized-harmonization's Introduction

Segmentation-Renormalized Unpaired Image Harmonization

Reference implementation of "Segmentation-Renormalized Deep Feature Modulation for Unpaired Image Harmonization" by M. Ren, et al. to appear in IEEE Transactions on Medical Imaging, 2021.

By incorporating semantic masks (e.g., dense segmentation, anomaly masks, etc.) into image translation via conditional renormalization, improved translation performance and perturbation robustness is achieved.

This repository is built upon the original CycleGAN implementation available here.

harmonization example on OCT

Dependencies

This implementation requires a Linux OS with all python dependencies available in environment.yml. To install all dependencies,

conda env create -f environment.yml

Prepare the data

To speed up data loading for medical images which are typically 3D in Nifti/Nrrd/mhd format, h5 files are recommended for PyTorch dataloader. After train/test split, merge all 2D slices of subjects from each set to form a [N,w,h,1] array, where N is the number of total slices, (w,h) is the image size. Save arrays from source and target domains as a group 'src' (for source domain) and 'trg' (for target domain) in the h5 file.

Training

Use the script below to start training a translation model, where the naming convention of parameters follows the original CycleGAN implementation. See 'configs/' for parameters definition.

Of note, "--joint_seg | --srenorm | --sem_dropout" are used to specify different models compared in the paper:

  • If none of them is specified, CycleGAN is used;
  • Specify --joint_seg to use S-CycleGAN (2D version) ;
  • Specify --joint_seg and --sem_dropout to use SemGAN;
  • Specify --joint_seg and --srenorm to use proposed model.
python mains/train.py --name 'seg_renorm_cyclegan'\
      --model 'cycle_gan_2d'\
      --checkpoints_dir '../ckpts' \
      --crop_size 128 \
      --batch_size 4 \
      --lr_g 0.0002 \
      --lr_d 0.0001 \
      --gpu_id 0\
      --ngf 64 \
      --ndf 64 \
      --typeG 'resunet'\
      --netD 'n_layers'\
      --n_layers_D 2 \
      --dim 2\
      --save_epoch_freq 100\
      --save_latest_freq 2  \
      --input_nc 1\
      --output_nc 1\
      --dataset 'ixi'\
      --lambda_identity 0\
      --lambda_cc 0\
      --lambda_tv 0\
      --lambda_A 10\
      --lambda_B 10\
      --gan_mode 'lsgan'\
      --init_type 'normal'\
      --seg_nc 4\
      --niter 20\
      --niter_decay 300 \
      --joint_seg\
      --srenorm\

Citation

If you use this code, please consider citing our work:

@article{ren2021segmentation,
  title={Segmentation-Renormalized Deep Feature Modulation for Unpaired Image Harmonization},
  author={Ren, Mengwei and Dey, Neel and Fishbaugh, James and Gerig, Guido},
  journal={IEEE Transactions on Medical Imaging},
  year={2021},
  publisher={IEEE}
}

segmentation-renormalized-harmonization's People

Contributors

mengweiren 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.