Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for subsample masking API #167

Merged
merged 1 commit into from
Sep 17, 2021
Merged

Update for subsample masking API #167

merged 1 commit into from
Sep 17, 2021

Conversation

mmuckley
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Sep 14, 2021
@mmuckley mmuckley mentioned this pull request Sep 14, 2021
@mmuckley mmuckley force-pushed the mmuckley/masking_update branch 2 times, most recently from 8451f29 to 18cb8bb Compare September 14, 2021 14:25
Copy link
Contributor

@luisenp luisenp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check the mask logic deeply, but the overall refactor makes sense to me. Left some minor comments.

fastmri/data/transforms.py Outdated Show resolved Hide resolved
@@ -252,6 +253,29 @@ def normalize_instance(
return normalize(data, mean, std, eps), mean, std


class UnetSample(NamedTuple):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly out of curiosity, any reason to prefer this over a dataclass?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make it more like a tuple! Immutability is great.

fastmri/data/subsample.py Outdated Show resolved Hide resolved
fastmri/data/subsample.py Show resolved Hide resolved
@mmuckley
Copy link
Contributor Author

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.

@mmuckley mmuckley merged commit 24baf85 into main Sep 17, 2021
@mmuckley mmuckley deleted the mmuckley/masking_update branch September 17, 2021 18:22
@mmuckley mmuckley mentioned this pull request Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants