DnCNN#
- class deepinv.models.DnCNN(in_channels=3, out_channels=3, depth=20, bias=True, nf=64, pretrained='download', device='cpu', dim=2)[source]#
Bases:
DenoiserDnCNN convolutional denoiser.
The architecture was introduced by Zhang et al.[1] 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 Pesquet et al.[2], usingpretrained='download_lipschitz'. 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 2D or 3D network (if str, can be β2β, β2dβ, β3Dβ, etc.)
- References:
- 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:#
Pattern Ordering in a Compressive Single Pixel Camera
PnP with custom optimization algorithm (Condat-Vu Primal-Dual)
Plug-and-Play algorithm with Mirror Descent for Poisson noise inverse problems.
Deep Equilibrium (DEQ) algorithms for image deblurring
Reducing the memory and computational complexity of unfolded network training