UNet#
- class deepinv.models.UNet(in_channels=1, out_channels=1, residual=True, circular_padding=False, cat=True, bias=True, batch_norm=True, scales=4)[source]#
Bases:
Denoiser
U-Net convolutional denoiser.
This network is a fully convolutional denoiser based on the U-Net architecture. The number of downsample steps can be controlled with the
scales
parameter. The number of trainable parameters increases with the number of scales.Warning
When using the bias-free batch norm
BFBatchNorm2d
viabatch_norm="biasfree"
, NaNs may be encountered during training, causing the whole training procedure to fail.- Parameters:
in_channels (int) – input image channels
out_channels (int) – output image channels
residual (bool) – use a skip-connection between output and output.
circular_padding (bool) – circular padding for the convolutional layers.
cat (bool) – use skip-connections between intermediate levels.
bias (bool) – use learnable biases.
batch_norm (bool, str) – if False, no batchnorm applied, if
True
, usetorch.nn.BatchNorm2d
, ifbatch_norm="biasfree"
, useBFBatchNorm2d
from “Robust And Interpretable Blind Image Denoising Via Bias-Free Convolutional Neural Networks” by Mohan et al..scales (int) – Number of downsampling steps used in the U-Net. The options are 2,3,4 and 5. The number of trainable parameters increases with the scale.
- forward(x, sigma=None, **kwargs)[source]#
Run the denoiser on noisy image. The noise level is not used in this denoiser.
- Parameters:
x (torch.Tensor) – noisy image.
sigma (float) – noise level (not used).
Examples using UNet
:#

Imaging inverse problems with adversarial networks

Self-supervised learning from incomplete measurements of multiple operators.

Self-supervised denoising with the Neighbor2Neighbor loss.

Self-supervised denoising with the Generalized R2R loss.

Self-supervised learning with measurement splitting