Skip to main content

MERLIN - Machine Enhanced Reconstruction Learning and Interpretation Networks

MERLIN logo

This repository contains machine learning (ML) tools for PyTorch, TensorFlow and Python in three modules:

  • merlinth: ML extensions to PyTorch
  • merlintf: ML extensions to TensorFlow
  • merlinpy: ML extensions to Python

If you use this code, please cite

@inproceedings{HammernikKuestner2022,
  title={Machine Enhanced Reconstruction Learning and Interpretation Networks (MERLIN)},
  author={Hammernik, K. and K{\"u}stner, T.},
  booktitle={Proceedings of the International Society for Magnetic Resonance in Medicine (ISMRM)},
  year={2022}
}

Requirements

git clone https://github.com/midas-tum/optox.git
cd optox
python3 install.py

follow build instructions on the github.

Installation

PyPi

pip3 install merlinpy-mri merlinth-mri merlintf-mri

In case you want to use the sampling codes (C++), please use the direct way installation below for direct compilation according to your system setup.

Direct way

git clone https://github.com/midas-tum/merlin.git
python3 install.py

Verification

Run unittests to ensure proper working of sub-modules

python3 -m unittest discover -s merlinpy.test
python3 -m unittest discover -s merlinth.test
python3 -m unittest discover -s merlintf.test

Contents

!!! Attention !!! This package is work in progress and still under construction. Major changes in structure will appear. If you experience any issues, if you have any feature requests or if you found any bugs, please let us know and raise an issue and/or pull request in github :)

Please watch the Issues space and look for the latest updates regularly! :)

merlinth

merlinth
    |--- layers     # Data-driven regularizer following (https://github.com/VLOGroup/tdv), extended to complex-valued layers and similar setup as layers in `merlintf.keras`
        |-- Complex-valued convolutions
        |-- Complex-valued activations
        |-- Complex-valued pooling
        |-- Complex-valued normalization
        |-- FFT operations
        |-- Data consistency
        |-- ...
    |-- losses     # Common and custom loss functions
    |-- models     # Model zoo
        |-- Fields-of-Experts (FOE) regularizer
        |-- Total deep variation (TDV) regularizer
        |-- UNet
    |-- optim      # Custom optimizers such as BlockAdam

merlintf

merlintf
    |-- keras
        |-- layers      # basic building blocks, focusing on complex valued operations
            |-- Complex-valued convolutions
            |-- Complex-valued activations
            |-- Complex-valued pooling
            |-- Complex-valued normalization
            |-- FFT operations
            |-- Data consistency
            |-- ...
        |-- models      # several layers are put together into networks for complex-valued processing (2-channel-real networks, complex networks)
            |-- Convolutional Neural Network
            |-- Fields-of-Experts (FOE) regularizer
            |-- Total deep variation (TDV) regularizer
            |-- UNet
        |-- optimizers       # custom optimizers    
    |-- optim                # custom optimizers

merlinpy

merlinpy
    |-- datapipeline        # collection of datapipelines and transform functions
        |-- sampling        # subsampling codes and sampling trajectories
    |-- fastmri             # dataloader and processing related to fastMRI database
    |-- losses              # losses/metrics
    |-- recon               # conventional reconstructions
    |-- wandb               # logging via wandb.ai

Common mistakes and best practices

writing own keras modules and layers

  • tf.keras.Model cannot hold any trainable parameters. All trainable weights have to be defined in tf.keras.layers.Layers. Wrong implementation will cause weird behaviour when saving and re-loading the model weights!
  • Do not define weights in the __init__ function. Weights should be only created and initialized in the def build(self, input_shape) function of the Layer. Wrong implementation will cause weird behaviour when saving and re-loading the model weights!
  • The online documentation is a good orientation point to write own modules. Make use of keras Constraints and Initializers.

Metadata

Release files for merlinpy-mri 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for merlinpy-mri 0.4.0
File Size Uploaded
merlinpy-mri-0.4.0.tar.gz 29.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for merlinpy-mri 0.4.0
File Interpreter ABI Platform
merlinpy_mri-0.4.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 63.0 kB

Release files / merlinpy-mri-0.4.0.tar.gz

Download URL merlinpy-mri-0.4.0.tar.gz
Size 29.8 kB
Tags Source
SHA-256 checksum
How to use checksums
161b77599abd61db9d8903e37b9857348b11893e926fe46a2e26d81a714222d2
BLAKE2b-256 checksum
How to use checksums
db94e7cd041aa8404f04cf54aa15fb1107df6756277d02eabd3942a08597db9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.11

Release files / merlinpy_mri-0.4.0-py2.py3-none-any.whl

Download URL merlinpy_mri-0.4.0-py2.py3-none-any.whl
Size 33.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7c74c0b2e8d589ad0127184f3003419a9188bed6dc13298515a9573fb4367a80
BLAKE2b-256 checksum
How to use checksums
a811f61b8c89e00b453b9821547de71b493f8d1f9f7506322ac8693142caf4a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.11

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page