facebookresearch / fastMRI

A large-scale dataset of both raw MRI measurements and clinical MRI images.
https://fastmri.org
MIT License
1.29k stars 370 forks source link

Update for subsample masking API #167

Closed mmuckley closed 2 years ago

mmuckley commented 2 years ago

This update implements a major overhaul of the masking API for the repository. The primary reason for doing this was to implement the magic mask in the core repository. Already, we had repeated code in several sections, and with the new mask this would be duplicated again and be bad for maintenance. With the new code structure, everything is subclassed from a base mask function in a modular way, so for the future we'll hopefully only need to change the base class to make updates.

We also implemented a few other things that came from the internal fastMRI repository (most of which has already been exposed via banding_removal). These include returning the number of low frequency lines (for sensitivity map estimation) and segmenting out the equispaced mask from the pseudo-equispaced mask mentioned in Issue #54.

Note: for the old equispaced mask behavior, you now need to use EquispacedMaskFraction. EquispacedMask now implements exactly an equispaced mask, as its title suggests. The VarNet and U-Net examples should be updated accordingly with this PR.

Lastly, this PR updates the test environment to bring all dependencies up to date for September 2021 for unit testing. It supersedes #166, as it seems the mypy update required changes to several parts of the code, so I thought it was easier to include here.

CC @adefazio @Timsey

mmuckley commented 2 years ago

I'm going to go ahead and merge this - ran some tests on the knee data and it seems SSIM is the same throughout the training process. I'll do a full validation with leaderboard submission prior to the next package release to PyPI.