Git Product home page Git Product logo

mrsrl / complex-networks-release Goto Github PK

View Code? Open in Web Editor NEW
107.0 7.0 24.0 8.12 MB

Implementation related to the paper "Analysis of deep complex-valued convolutional neural networks for MRI reconstruction and phase-focused applications" by Elizabeth K. Cole et. al; Toolbox for complex-valued convolution and activation functions using an unrolled architecture.

Home Page: https://onlinelibrary.wiley.com/doi/full/10.1002/mrm.28733

Python 98.44% Shell 1.56%

complex-networks-release's Introduction

Implementation related to the paper "Complex-Valued Convolutional Neural Networks for MRI Reconstruction" by Elizabeth K. Cole et. al: https://arxiv.org/abs/2004.01738

Complex-Valued MRI Reconstruction - Unrolled Architecture

Image Reconstruction using an Unrolled DL Architecture including Complex-Valued Convolution and Activation Functions

  • 2018 Elizabeth Cole, Stanford University ([email protected])
  • 2018 Joseph Y. Cheng, Stanford University
  • 2018 Feiyu Chen, Stanford University
  • 2018 Chris Sandino, Stanford University

Complex-Valued Utilities

If you are only interested in the complex-valued utilities, they are located in complex_utils.py. This includes complex-valued convolution, complex-valued transposed convolution, and the CReLU, modReLU, zReLU, and cardioid activation functions.

Setup

Make sure the python requirements are installed

pip3 install -r requirements.txt

The setup assumes that the latest Berkeley Advanced Reconstruction Toolbox is installed [1]. The scripts have all been tested with v0.4.01.

Data preparation

We will first download data, generate sampling masks, and generate TFRecords for training. The datasets downloaded are fully sampled volumetric knee scans from mridata [2]. The setup script uses the BART binary. In a new folder, run the follwing script:

python3 setup_mri.py -v

Training

The training can be ran using the following script in the same folder as the prepared data.

TYPE=complex
ITERATIONS=4
FEAT=256
ACTIVATION=cardioid
LOG_DIR="f"$FEAT"_g"$ITERATIONS
python3 train_loop.py \
    --train_dir $TYPE"_"$ACTIVATION \
    --mask_path masks \
    --dataset_dir data \
    --log_root $LOG_DIR \
    --shape_z 256 --shape_y 320 \
    --num_channels 8 \
    --batch_size 2 \
    --device 0 \
    --max_steps 50000 \
    --feat_map $FEAT \
    --num_grad_steps $ITERATIONS \
    --activation $ACTIVATION \
    --conv $TYPE

TYPE denotes the type of convolution; options include "real" or "complex".

ITERATIONS denotes the number of iterations in the unrolled architecture.

FEAT denotes the number of feature maps in each convolution layer.

ACTIVATION denotes the activation function used after each convolution layer; options include "relu", "crelu", "zrelu", "modrelu", and "cardioid" [3]. If running real convolution, the activation must be relu.

LOG_DIR indicates the directory checkpoints and training logs are saved to. You can view a tensorboard summary for this training run by running:

tensorboard --logdir=./

in this directory.

Various complex-valued utility functions are in complex_utils.py. This includes complex-valued convolution, complex-valued transposed convolution, and various complex-valeud activation functions such as CReLU, zReLU, modReLU, and cardioid.

Testing

Testing can be run using a similar script to training, found in test_script. One such example is:

TYPE=complex
ITERATIONS=4
FEAT=256
ACTIVATION=cardioid
LOG_DIR="f"$FEAT"_g"$ITERATIONS
python3 test_images.py \
    --train_dir $TYPE"_"$ACTIVATION \
    --mask_path masks \
    --dataset_dir data \
    --log_root $LOG_DIR \
    --shape_z 256 --shape_y 320 \
    --num_channels 8 \
    --batch_size 2 \
    --device 0 \
    --max_steps 50000 \
    --feat_map $FEAT \
    --num_grad_steps $ITERATIONS \
    --activation $ACTIVATION \
    --conv $TYPE

This script will run a deep learning reconstruction on a trained model with the specified parameters. It will also perform CS reconstructions using BART, and compute aggregate image metrics PSNR, SSIM, and NRMSE for each test image. Test images will be saved in a folder entitled "images" in the model directory.

References

  1. https://github.com/mrirecon/bart
  2. http://mridata.org
  3. https://arxiv.org/pdf/1705.09792.pdf

complex-networks-release's People

Contributors

ekcole 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

complex-networks-release's Issues

Regarding the complex U-Net code

Thanks for your impressive work! Currently I also want to reproduce the complex unet in my dataset. But according to my reproduce results, I find the complex unet performance worse than real Unet. the best performance complex unet is same with input undersampled image. That's the problem. Would please share your reproduced complex Unet ? Thanks !

Output of Network is NaN

Hi,

I am trying to reproduce your results using the code and data provided.
The code runs without errors, however the output is NAN values. Loss function stays constant instead of decreasing.
Bart reconstruction seems to work fine.
Could it by a version issue? I am using Python 3.7, in combination with your requirements file. Hardware: nvidia rtx 3090, 24gb ram. Some packages were not listed in the requirements so I tried to find one that works. E.g. "gast" (version 2.2), skiimage. I have attached the requirements that I am using, maybe you can comment if that is correct.
Do you have any idea where to look for the error?

I would like to use the code later for preclinical MRI data (single coil). Could you comment on the following

  • Do I need to normalize the data or do any other preprocessing (right now it is complex k-space data)
  • Should I train each region and image type separately (e.g. head T1, abdomen T2) or can I train them together?
  • In case image size is different can I zerofill the images to have the same matrix size or does the original MR data need to be the same matrix size.

Thanks!

requirements.txt
complex
graph

Output model .pb

Is there a way to output the .pb file while training the model or if I use the freeze graph method what is the name of the input node and output node? May you please help me with this. I have tried to freeze the model but I do not know the name of the node I need to output which will be needed for inference.

Thank you.

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.