DnCNN
- class deepinv.models.DnCNN(in_channels=3, out_channels=3, depth=20, bias=True, nf=64, pretrained='download', device='cpu')[source]
Bases:
Module
DnCNN convolutional denoiser.
The architecture was introduced by Zhang et al. in https://arxiv.org/abs/1608.03981 and is composed of a series of convolutional layers with ReLU activation functions. The number of layers can be specified by the user. Unlike the original paper, this implementation does not include batch normalization layers.
The network can be initialized with pretrained weights, which can be downloaded from an online repository. The pretrained weights are trained with the default parameters of the network, i.e. 20 layers, 64 channels and biases.
- Parameters:
in_channels (int) – input image channels
out_channels (int) – output image channels
depth (int) – number of convolutional layers
bias (bool) – use bias in the convolutional layers
nf (int) – number of channels per convolutional layer
pretrained (str, None) – use a pretrained network. If
pretrained=None
, the weights will be initialized at random using Pytorch’s default initialization. Ifpretrained='download'
, the weights will be downloaded from an online repository (only available for architecture with depth 20, 64 channels and biases). It is possible to download weights trained via the regularization method in https://epubs.siam.org/doi/abs/10.1137/20M1387961 usingpretrained='download_lipschitz'
. Finally,pretrained
can also be set as a path to the user’s own pretrained weights. See pretrained-weights for more details.train (bool) – training or testing mode
device (str) – gpu or cpu
- forward(x, sigma=None)[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 DnCNN
:
Vanilla PnP for computed tomography (CT).
PnP with custom optimization algorithm (Condat-Vu Primal-Dual)
Uncertainty quantification with PnP-ULA.
Vanilla Unfolded algorithm for super-resolution
Deep Equilibrium (DEQ) algorithms for image deblurring