MPRNet#
- class deepinv.models.MPRNet(in_channels=3, out_channels=3, n_feat=80, scale_unetfeats=48, scale_orsnetfeats=32, num_cab=8, kernel_size=3, reduction=4, bias=False, pretrained=None, device='cpu', dim=2)[source]#
Bases:
Reconstructor,DenoiserMPRNet restoration model.
MPRNet is a blind restoration model that was proposed in Zamir et al.[1].
There are pretrained weights available for two tasks, which can be loaded via
pretrained:Real-world image denoising on SIDD:
pretrained='denoising'with the default architecture.Image deblurring:
pretrained='deblurring'withn_feat=96and default values for the other arguments.
Note
All spatial dimensions of the input (height and width, and depth for 3D networks) must be divisible by 8, otherwise an error is raised.
- Parameters:
in_channels (int) – number of channels in the input image.
out_channels (int) – number of channels in the output image.
n_feat (int) – number of feature maps in the intermediate layers.
scale_unetfeats (int) – number of feature maps added at each level of the U-Net encoder and decoder stages.
scale_orsnetfeats (int) – number of feature maps added to the original resolution stage.
num_cab (int) – number of channel attention blocks in each original resolution block.
kernel_size (int) – kernel size of the convolutional layers.
reduction (int) – reduction factor of the channel attention layers.
bias (bool) – use learnable biases in the convolutional layers.
pretrained (str, None) – use a pretrained network. If
pretrained=None, the weights will be initialized at random using Pytorch’s default initialization. Ifpretrained='denoising'orpretrained='deblurring', the weights will be downloaded from an online repository, which requires the architecture of the original paper (for'deblurring', setn_feat=96). Finally,pretrainedcan also be set as a path to the user’s own pretrained weights. See pretrained-weights for more details.device (torch.device, str) – device to put the model on.
dim (str, int) – whether to build a 2D or 3D network (if str, can be “2”, “2d”, “3D”, etc.).
- References:
- forward(x, physics=None, **kwargs)[source]#
- Parameters:
y (torch.Tensor) – Image to be restored.
physics (deepinv.physics.Physics) – forward operator (not used).
- Returns:
(
torch.Tensor) restored image estimate.- Return type: