mr2.nn.nets.SNRAware
- class mr2.nn.nets.SNRAware[source]
Bases:
ModuleTwo-resolution HRNet imaging transformer used by released SNRAware models [SNRAWARE].
Inputs contain real image, imaginary image and g-factor map channels in SNR units; no intensity or noise normalization is performed. The output contains the denoised real and imaginary channels. The spatially learned normalization fixes the patch size. Published weights use 64 x 64 patches and 64 heads. Official MIT-licensed checkpoints are available from [WEIGHTS]; use
convert_state_dictto load them into this implementation.References
[XUE25]Xue et al. SNRAware: Improved Deep Learning MRI Denoising with SNR Unit Training and G-factor Map Augmentation. https://arxiv.org/abs/2503.18162
[SNRAWARE]Microsoft SNRAware. https://github.com/microsoft/SNRAware
[WEIGHTS]Microsoft SNRAware checkpoints. https://huggingface.co/microsoft/SNRAware/tree/main
- __init__(variant: Literal['small', 'medium', 'large'] = 'small', n_features: int = 64, n_heads: int = 64, image_size: int = 64, p_dropout: float = 0.1) None[source]
Initialize SNRAware.
- Parameters:
variant (
Literal['small','medium','large'], default:'small') – Released depth configuration: one, two or four TLG repetitions per stage.n_features (
int, default:64) – Feature channels in the full-resolution branch; doubled in the lower branch.n_heads (
int, default:64) – Attention heads at both resolutions.image_size (
int, default:64) – Square spatial patch size. Must be divisible by sixteen.p_dropout (
float, default:0.1) – Stochastic-depth probability. Disabled in evaluation mode.
- __call__(x: Tensor) Tensor[source]
Denoise image patches in SNR units.
- Parameters:
x (
Tensor) – Real image, imaginary image and g-factor map stacked as(batch, 3, frames, image_size, image_size).- Returns:
Denoised real and imaginary channels, with shape
(batch, 2, frames, image_size, image_size).
- forward(x: Tensor) Tensor[source]
Denoise a real tensor with shape
(batch, 3, frames, image_size, image_size).
- convert_state_dict(state_dict: Mapping[str, Tensor]) dict[str, Tensor][source]
Convert an official SNRAware state dictionary to this model’s layout.
Use
model.load_state_dict(model.convert_state_dict(official.state_dict()))whereofficial = torch.jit.load(path, map_location='cpu')for a trusted official .pts artifact. Save the result with ordinarytorch.saveand subsequently load withtorch.load(..., weights_only=True).