Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising

Overview

DnCNN

Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising

visitors

News: DRUNet

PyTorch training and testing code - 18/12/2019

I recommend to use the PyTorch code for training and testing. The model parameters of MatConvnet and PyTorch are same.

Merge batch normalization (PyTorch)

import torch
import torch.nn as nn


def merge_bn(model):
    ''' merge all 'Conv+BN' (or 'TConv+BN') into 'Conv' (or 'TConv')
    based on https://github.com/pytorch/pytorch/pull/901
    by Kai Zhang ([email protected]) 
    https://github.com/cszn/DnCNN
    01/01/2019
    '''
    prev_m = None
    for k, m in list(model.named_children()):
        if (isinstance(m, nn.BatchNorm2d) or isinstance(m, nn.BatchNorm1d)) and (isinstance(prev_m, nn.Conv2d) or isinstance(prev_m, nn.Linear) or isinstance(prev_m, nn.ConvTranspose2d)):

            w = prev_m.weight.data

            if prev_m.bias is None:
                zeros = torch.Tensor(prev_m.out_channels).zero_().type(w.type())
                prev_m.bias = nn.Parameter(zeros)
            b = prev_m.bias.data

            invstd = m.running_var.clone().add_(m.eps).pow_(-0.5)
            if isinstance(prev_m, nn.ConvTranspose2d):
                w.mul_(invstd.view(1, w.size(1), 1, 1).expand_as(w))
            else:
                w.mul_(invstd.view(w.size(0), 1, 1, 1).expand_as(w))
            b.add_(-m.running_mean).mul_(invstd)
            if m.affine:
                if isinstance(prev_m, nn.ConvTranspose2d):
                    w.mul_(m.weight.data.view(1, w.size(1), 1, 1).expand_as(w))
                else:
                    w.mul_(m.weight.data.view(w.size(0), 1, 1, 1).expand_as(w))
                b.mul_(m.weight.data).add_(m.bias.data)

            del model._modules[k]
        prev_m = m
        merge_bn(m)


def tidy_sequential(model):
    for k, m in list(model.named_children()):
        if isinstance(m, nn.Sequential):
            if m.__len__() == 1:
                model._modules[k] = m.__getitem__(0)
        tidy_sequential(m)

Training (MatConvNet)

Testing (MatConvNet or Matlab)

  • [demos] Demo_test_DnCNN-.m.

  • [models] including the trained models for Gaussian denoising; a single model for Gaussian denoising, single image super-resolution (SISR) and deblocking.

  • [testsets] BSD68 and Set10 for Gaussian denoising evaluation; Set5, Set14, BSD100 and Urban100 datasets for SISR evaluation; Classic5 and LIVE1 for JPEG image deblocking evaluation.

New FDnCNN Models

I have trained new Flexible DnCNN (FDnCNN) models based on FFDNet.

FDnCNN can handle noise level range of [0, 75] via a single model.

Demo_FDnCNN_Gray.m

Demo_FDnCNN_Gray_Clip.m

Demo_FDnCNN_Color.m

Demo_FDnCNN_Color_Clip.m

Network Architecture and Design Rationale

  • Network Architecture

  • Batch normalization and residual learning are beneficial to Gaussian denoising (especially for a single noise level). The residual of a noisy image corrupted by additive white Gaussian noise (AWGN) follows a constant Gaussian distribution which stablizes batch normalization during training.

    • Histogram of noisy patches, clean patches, and residual (noise) patches from a batch of training. The noise level is 25, the patch size is 40x40, the batch size is 128.
    • Histogram of noisy patches, clean patches, and residual (noise) patches from another batch of training. The noise level is 25, the patch size is 40x40, the batch size is 128.
    • Noise-free image super-resolution does not have this property.
  • Predicting the residual can be interpreted as performing one gradient descent inference step at starting point (i.e., noisy image).

    • The parameters in DnCNN are mainly representing the image priors (task-independent), thus it is possible to learn a single model for different tasks, such as image denoising, image super-resolution and JPEG image deblocking.

    • The left is the input image corrupted by different degradations, the right is the restored image by DnCNN-3.

Results

Gaussian Denoising

The average PSNR(dB) results of different methods on the BSD68 dataset.

Noise Level BM3D WNNM EPLL MLP CSF TNRD DnCNN DnCNN-B FDnCNN DRUNet
15 31.07 31.37 31.21 - 31.24 31.42 31.73 31.61 31.69 31.91
25 28.57 28.83 28.68 28.96 28.74 28.92 29.23 29.16 29.22 29.48
50 25.62 25.87 25.67 26.03 - 25.97 26.23 26.23 26.27 26.59

Visual Results

The left is the noisy image corrupted by AWGN, the middle is the denoised image by DnCNN, the right is the ground-truth.

Gaussian Denoising, Single ImageSuper-Resolution and JPEG Image Deblocking via a Single (DnCNN-3) Model

Average PSNR(dB)/SSIM results of different methods for Gaussian denoising with noise level 15, 25 and 50 on BSD68 dataset, single image super-resolution with upscaling factors 2, 3 and 40 on Set5, Set14, BSD100 and Urban100 datasets, JPEG image deblocking with quality factors 10, 20, 30 and 40 on Classic5 and LIVE11 datasets.

Gaussian Denoising

Dataset Noise Level BM3D TNRD DnCNN-3
15 31.08 / 0.8722 31.42 / 0.8826 31.46 / 0.8826
BSD68 25 28.57 / 0.8017 28.92 / 0.8157 29.02 / 0.8190
50 25.62 / 0.6869 25.97 / 0.7029 26.10 / 0.7076

Single Image Super-Resolution

Dataset Upscaling Factor TNRD VDSR DnCNN-3
2 36.86 / 0.9556 37.56 / 0.9591 37.58 / 0.9590
Set5 3 33.18 / 0.9152 33.67 / 0.9220 33.75 / 0.9222
4 30.85 / 0.8732 31.35 / 0.8845 31.40 / 0.8845
2 32.51 / 0.9069 33.02 / 0.9128 33.03 / 0.9128
Set14 3 29.43 / 0.8232 29.77 / 0.8318 29.81 / 0.8321
4 27.66 / 0.7563 27.99 / 0.7659 28.04 / 0.7672
2 31.40 / 0.8878 31.89 / 0.8961 31.90 / 0.8961
BSD100 3 28.50 / 0.7881 28.82 / 0.7980 28.85 / 0.7981
4 27.00 / 0.7140 27.28 / 0.7256 27.29 / 0.7253
2 29.70 / 0.8994 30.76 / 0.9143 30.74 / 0.9139
Urban100 3 26.42 / 0.8076 27.13 / 0.8283 27.15 / 0.8276
4 24.61 / 0.7291 25.17 / 0.7528 25.20 / 0.7521

JPEG Image Deblocking

Dataset Quality Factor AR-CNN TNRD DnCNN-3
Classic5 10 29.03 / 0.7929 29.28 / 0.7992 29.40 / 0.8026
20 31.15 / 0.8517 31.47 / 0.8576 31.63 / 0.8610
30 32.51 / 0.8806 32.78 / 0.8837 32.91 / 0.8861
40 33.34 / 0.8953 - 33.77 / 0.9003
LIVE1 10 28.96 / 0.8076 29.15 / 0.8111 29.19 / 0.8123
20 31.29 / 0.8733 31.46 / 0.8769 31.59 / 0.8802
30 32.67 / 0.9043 32.84 / 0.9059 32.98 / 0.9090
40 33.63 / 0.9198 - 33.96 / 0.9247

Requirements and Dependencies

or just MATLAB R2015b to test the model. https://github.com/cszn/DnCNN/blob/4a4b5b8bcac5a5ac23433874d4362329b25522ba/Demo_test_DnCNN.m#L64-L65

Citation

@article{zhang2017beyond,
  title={Beyond a {Gaussian} denoiser: Residual learning of deep {CNN} for image denoising},
  author={Zhang, Kai and Zuo, Wangmeng and Chen, Yunjin and Meng, Deyu and Zhang, Lei},
  journal={IEEE Transactions on Image Processing},
  year={2017},
  volume={26}, 
  number={7}, 
  pages={3142-3155}, 
}
@article{zhang2020plug,
  title={Plug-and-Play Image Restoration with Deep Denoiser Prior},
  author={Zhang, Kai and Li, Yawei and Zuo, Wangmeng and Zhang, Lei and Van Gool, Luc and Timofte, Radu},
  journal={arXiv preprint},
  year={2020}
}

====================================================================

Convolutional Neural Networks for Image Denoising and Restoration

@Inbook{zuo2018convolutional,
author={Zuo, Wangmeng and Zhang, Kai and Zhang, Lei},
editor={Bertalm{\'i}o, Marcelo},
title={Convolutional Neural Networks for Image Denoising and Restoration},
bookTitle={Denoising of Photographic Images and Video: Fundamentals, Open Challenges and New Trends},
year={2018},
publisher={Springer International Publishing},
address={Cham},
pages={93--123},
isbn={978-3-319-96029-6},
doi={10.1007/978-3-319-96029-6_4},
url={https://doi.org/10.1007/978-3-319-96029-6_4}
}

Challenges and Possible Solutions (from the above book chapter)

While the image denoising for AWGN removal has been well-studied, little work has been done on real image denoising. The main difficulty arises from the fact that real noises are much more complex than AWGN and it is not an easy task to thoroughly evaluate the performance of a denoiser. Fig. 4.15 shows four typical noise types in real world. It can be seen that the characteristics of those noises are very different and a single noise level may be not enough to parameterize those noise types. In most cases, a denoiser can only work well under a certain noise model. For example, a denoising model trained for AWGN removal is not effective for mixed Gaussian and Poisson noise removal. This is intuitively reasonable because the CNN-based methods can be treated as general case of Eq. (4.3) and the important data fidelity term corresponds to the degradation process. In spite of this, the image denoising for AWGN removal is valuable due to the following reasons. First, it is an ideal test bed to evaluate the effectiveness of different CNN-based denoising methods. Second, in the unrolled inference via variable splitting techniques, many image restoration problems can be addressed by sequentially solving a series of Gaussian denoising subproblems, which further broadens the application fields.

To improve the practicability of a CNN denoiser, perhaps the most straightforward way is to capture adequate amounts of real noisy-clean training pairs for training so that the real degradation space can be covered. This solution has advantage that there is no need to know the complex degradation process. However, deriving the corresponding clean image of a noisy one is not a trivial task due to the need of careful post-processing steps, such as spatial alignment and illumination correction. Alternatively, one can simulate the real degradation process to synthesize noisy images for a clean one. However, it is not easy to accurately model the complex degradation process. In particular, the noise model can be different across different cameras. Nevertheless, it is practically preferable to roughly model a certain noise type for training and then use the learned CNN model for type-specific denoising.

Besides the training data, the robust architecture and robust training also play vital roles for the success of a CNN denoiser. For the robust architecture, designing a deep multiscale CNN which involves a coarse-to-fine procedure is a promising direction. Such a network is expected to inherit the merits of multiscale: (i) the noise level decreases at larger scales; (ii) the ubiquitous low-frequency noise can be alleviated by multiscale procedure; and (iii) downsampling the image before denoising can effectively enlarge the receptive filed. For the robust training, the effectiveness of the denoiser trained with generative adversarial networks (GAN) for real image denoising still remains further investigation. The main idea of GAN-based denoising is to introduce an adversarial loss to improve the perceptual quality of denoised image. Besides, a distinctive advantage of GAN is that it can do unsupervised learning. More specifically, the noisy image without ground truth can be used in the training. So far, we have provided several possible solutions to improve the practicability of a CNN denoiser. We should note that those solutions can be combined to further improve the performance.

Comments
  • data_size is NAN

    data_size is NAN

    I met some difficuties after use vl_compilenn().

    >> Demo_Train_model_64_25_Res_Bnorm_Adam
         layer|      0|      1|      2|      3|      4|      5|      6|      7|      8|      9|     10|     11|     12|     13|     14|     15|     16|     17|
          type|  input|   conv|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|
          name|    n/a| layer1| layer2| layer3| layer4| layer5| layer6| layer7| layer8| layer9|layer10|layer11|layer12|layer13|layer14|layer15|layer16|layer17|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
       support|    n/a|      3|      1|      3|      1|      1|      3|      1|      1|      3|      1|      1|      3|      1|      1|      3|      1|      1|
      filt dim|    n/a|      1|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|
    filt dilat|    n/a|      1|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|
     num filts|    n/a|     64|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|
        stride|    n/a|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|
           pad|    n/a|      1|      0|      1|      0|      0|      1|      0|      0|      1|      0|      0|      1|      0|      0|      1|      0|      0|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
       rf size|    n/a|      3|      3|      5|      5|      5|      7|      7|      7|      9|      9|      9|     11|     11|     11|     13|     13|     13|
     rf offset|    n/a|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|
     rf stride|    n/a|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
     data size|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|
    data depth|    NaN|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|
      data num|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
      data mem|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|
     param mem|    n/a|    2KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|
    
         layer|     18|     19|     20|     21|     22|     23|     24|     25|     26|     27|     28|     29|     30|     31|     32|     33|     34|     35|
          type|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|
          name|layer18|layer19|layer20|layer21|layer22|layer23|layer24|layer25|layer26|layer27|layer28|layer29|layer30|layer31|layer32|layer33|layer34|layer35|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
       support|      3|      1|      1|      3|      1|      1|      3|      1|      1|      3|      1|      1|      3|      1|      1|      3|      1|      1|
      filt dim|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|
    filt dilat|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|
     num filts|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|
        stride|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|
           pad|      1|      0|      0|      1|      0|      0|      1|      0|      0|      1|      0|      0|      1|      0|      0|      1|      0|      0|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
       rf size|     15|     15|     15|     17|     17|     17|     19|     19|     19|     21|     21|     21|     23|     23|     23|     25|     25|     25|
     rf offset|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|
     rf stride|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
     data size|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|
    data depth|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|
      data num|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
      data mem|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|
     param mem|  144KB|    1KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|
    
         layer|     36|     37|     38|     39|     40|     41|     42|     43|     44|     45|     46|     47|     48|     49|
          type|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|  bnorm|   relu|   conv|   loss|
          name|layer36|layer37|layer38|layer39|layer40|layer41|layer42|layer43|layer44|layer45|layer46|layer47|layer48|layer49|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
       support|      3|      1|      1|      3|      1|      1|      3|      1|      1|      3|      1|      1|      3|      1|
      filt dim|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|
    filt dilat|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|    n/a|      1|    n/a|
     num filts|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|     64|    n/a|    n/a|      1|    n/a|
        stride|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|
           pad|      1|      0|      0|      1|      0|      0|      1|      0|      0|      1|      0|      0|      1|      0|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
       rf size|     27|     27|     27|     29|     29|     29|     31|     31|     31|     33|     33|     33|     35|     35|
     rf offset|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|
     rf stride|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|      1|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
     data size|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|NaNxNaN|
    data depth|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|     64|      1|      1|
      data num|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|    128|      1|
    ----------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
      data mem|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|    NaN|
     param mem|  144KB|    1KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|  144KB|    1KB|     0B|    2KB|     0B|
    
    opened by ghost 21
  • Get back the clean image

    Get back the clean image

    Hi, is that possible to change the Demo test model in TrainingCodes to get back the clean image instead of the residual image? Or need to re-initialize the model and train the model again? Thanks!

    opened by yangisme 12
  • Reference to non-existent field 'dilate', matconvnet 1.0-beta25

    Reference to non-existent field 'dilate', matconvnet 1.0-beta25

    Hi, I got this error when running Demo_test_DnCNN.m with Matlab 2017a, matconvnet 1.0-beta25, Window 10. The details are

    Reference to non-existent field 'dilate'.

    Error in vl_simplenn (line 303) 'dilate', l.dilate, ...

    Error in Demo_test_DnCNN (line 64) res = vl_simplenn(net,input,[],[],'conserveMemory',true,'mode','test');

    Any idea to fix this? Thank you.

    opened by ngcthuong 8
  • Training with 980Ti data size NAN

    Training with 980Ti data size NAN

    Hi there,

    I could not train the model with my 980Ti card due to this NAN issue. Does it mean I need a better card or any way to resolve this issues?

    image image

    Thankyou

    opened by ngcthuong 7
  • Is the code on line 23 in the main_train.py file[DnCNN-keras] correct?

    Is the code on line 23 in the main_train.py file[DnCNN-keras] correct?

    noise = np.random.normal(0, args.sigma / 255.0, batch_x.shape) # noise batch_y = batch_x + noise yield batch_y, batch_x

    Does these lines of code mean that the labels are clean pictures rather than noises? However, in the paper 'Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising ', the noise are set as labels. Is the code correct?

    opened by wangweiwei104 6
  • Struggle with PyTorch version code

    Struggle with PyTorch version code

    I'm afraid I might bother you, but it seems that the PyTorch implementation cannot reproduce the expected result. When I tried to do so, I met following issues......:

    When I run train/test code(without touching any setting),

    • DnCNN-S for noise level=25 made PSNR=29.24 in <30 epoch
    • DnCNN-S for noise level=15 got stuck at PSNR=23.xx. I tried this many times but didn't work.
    • DnCNN-S for noise level=50 made 25.9x in <50 epoch, but couldn't reach near 26.23 at all. There's multi_step scheduling, however I forced it to use smaller learning rate after the convergence, and it didn't help. +) I tried some modifications on the model, and still the problem remained. Just <0.8dB changed. So think it is not about model. +) I also tried to change the optimizer and lr scheduling exactly same as it is mentioned on the original paper, but that made it even worse.

    Is it right to add Gaussian noise and don't clip it? I thought it must be clipped according to [0., 255.] (uint8) or [0., 1.] (float32) because in real case(of course it is not completely 'real' 'cause it's AWGN) the corrupted image would be in [0., 255.] range. How much does the clipping lowers its performance, or is it better? I wanted to test it myself but... like I mentioned in 1., the baseline model isn't working correctly, so... If you have already tried it, could you let me know?

    opened by onwn 5
  • Can I ask a question about sigma setting of blind Gaussian denoising

    Can I ask a question about sigma setting of blind Gaussian denoising

    Hi, I see that you set the range of the noise levels as σ ∈ [0,55].When I reproduced the blind Gaussian denoising training model, I used random functions to produce sigma. However the effect was not good. May I ask you please for your help?

    Thanks, Wilson

    opened by wangWilson 4
  • Understanding vl_nnloss.m

    Understanding vl_nnloss.m

    Hi there,

    I am trying to modify the loss function in DnCNN, but I am not quite sure how to do it. Could you explain a little more about your vl_nnloss?
    I understand that

    t = ((X-c).^2)/2; Y = sum(t(:))/size(X,4); % reconstruction error per sample;

    calculates the L2 loss function. How about the second part?

    Y = bsxfun(@minus,X,c).*dzdy;

    why did you use bsxfun and minus? and could you explain the meaning of dzdy?

    Thank you very much, Best regards, Atena

    opened by ngcthuong 4
  • Where can I get train400 dataset?

    Where can I get train400 dataset?

    The train400 data from BSD dataset is used for training it, following those works:

    Chen, Yunjin, and Thomas Pock. "Trainable nonlinear reaction diffusion: A flexible framework for fast and effective image restoration." IEEE transactions on pattern analysis and machine intelligence 39.6 (2017): 1256-1272. Schmidt, Uwe, and Stefan Roth. "Shrinkage fields for effective image restoration." Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2014.

    and well, I couldn't find a list of these 400 images(and also tried to find the exact image files like BSD68, but couldn't). What are these and how can I get them?

    opened by onwn 3
  • Blind Color Denoiser Model

    Blind Color Denoiser Model

    Hi,

    I see that you include the pre-trained model for blind denoising on color images under model/specifics/GD_Color_Blind.mat

    I have noticed that this model does not include the parameters of the batch normalization layers. Did you change the weights of the convolution layers after the training by scaling and shifting them with the batch norm parameters or did you just remove the batch norm layers from the model?

    I would like to use your model to initialize my network and either I need the full model or I need to have the same training dataset to be able to train it. May I ask you please for your help?

    Thanks, Caner

    opened by hazirbas 3
  • Incompatible Image shape error

    Incompatible Image shape error

    Hi @cszn -

    I have been trying to use the DnCNN architecture - I am encountering the below error at Subtract layer. Can you suggest where I am heading wrong?

    **InvalidArgumentError: Incompatible shapes: [2,300,300,1] vs. [2,2] [[node gradients/loss/subtract13_loss/sum_squared_error/sub_grad/BroadcastGradientArgs (defined at /opt/conda/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1751) ]] [Op:__inference_keras_scratch_graph_3338]

    Function call stack: keras_scratch_graph**

    Thanks

    opened by ghost 2
  • Repetitive Dataset and DataLoader Creation in PyTorch version

    Repetitive Dataset and DataLoader Creation in PyTorch version

    Hi there! My question is - is there any particular reason for creating the entire dataset and dataloader every epoch from scratch? This is done in the PyTorch version, in the main_train file:

    image

    As I see it - it doesn't add anything because the addition of the noise is done in the 'get_item' function, so the noise is randomized any way a batch is drawn anyway. So this creation takes time from computing the same dataloader each epoch, without adding value.

    Am I missing something? Please correct me if I'm wrong

    opened by sptom 0
  • Lower depth yields same performance

    Lower depth yields same performance

    Hi !

    Thanks for publishing your training repository !

    I trained the 17 depth model on BSD dataset (train) using the pytorch_training scripts (that I fixed because of some compatibility issues), and it yielded the same result as a model of depth 4 (didn't try to go lower).

    It just feels weird that I get the same mean train loss / PSNR with a much lower depth model. I only tried on gray scale images.

    Is it possible that something is wrong with the code, or is this result normal ? Is there a thorough study on the performance of DnCNN according to its depth ?

    Thank you in advance for your response.

    opened by Youyoun 0
  • If I want to input my own image for deep learning,but i don't need add to Gassian noise level,what should I do?

    If I want to input my own image for deep learning,but i don't need add to Gassian noise level,what should I do?

    Sorry to disturb everyone during your busy schedule. I am a student,,I recently taught myself deep learning and machine vision in my spare time outside of work.

    If I want to input my own image for deep learning,but i don't need add to Gassian noise level,what should I do?

    If I want to test the operation of the program,I download DnCNN and run "GenerateTrainingPatches" program of "DnCNN_TrainingCodes_v1.1" file and "Demo_Train_model_64_25_Res_Bnorm_Adam" program of "DnCNN_TrainingCodes_v1.1". I want to ask what to do next?which program do i need to run.

    And I run "GenerateData_model_64_25_Res_Bnorm_Adam" program of "DnCNN_TrainingCodes_v1.0" and "Demo_Train_model_64_25_Res_Bnorm_Adam" program of "DnCNN_TrainingCodes_v1.0",but MATLAB as shown in the attached. DnCNN_TrainingCodes_v1 0-error1 This problem has been bugging me for weeks,I have searched the internet for answers but to no avail.Hope someone can assist me. I only know MATLAB now,but I can try to understand other programming languages.

    Thanks eveyone

    opened by LIN-CHENG-YUEH 0
Owner
Kai Zhang
Image Restoration; Inverse Problems
Kai Zhang
Official repository for "Restormer: Efficient Transformer for High-Resolution Image Restoration". SOTA for motion deblurring, image deraining, denoising (Gaussian/real data), and defocus deblurring.

Restormer: Efficient Transformer for High-Resolution Image Restoration Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan,

Syed Waqas Zamir 906 Dec 30, 2022
Gradient Step Denoiser for convergent Plug-and-Play

Source code for the paper "Gradient Step Denoiser for convergent Plug-and-Play"

Samuel Hurault 11 Sep 17, 2022
Official implementation of Deep Convolutional Dictionary Learning for Image Denoising.

DCDicL for Image Denoising Hongyi Zheng*, Hongwei Yong*, Lei Zhang, "Deep Convolutional Dictionary Learning for Image Denoising," in CVPR 2021. (* Equ

Z80 91 Dec 21, 2022
NFT-Price-Prediction-CNN - Using visual feature extraction, prices of NFTs are predicted via CNN (Alexnet and Resnet) architectures.

NFT-Price-Prediction-CNN - Using visual feature extraction, prices of NFTs are predicted via CNN (Alexnet and Resnet) architectures.

null 5 Nov 3, 2022
PyTorch code for our ECCV 2018 paper "Image Super-Resolution Using Very Deep Residual Channel Attention Networks"

PyTorch code for our ECCV 2018 paper "Image Super-Resolution Using Very Deep Residual Channel Attention Networks"

Yulun Zhang 1.2k Dec 26, 2022
PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)

About PyTorch 1.2.0 Now the master branch supports PyTorch 1.2.0 by default. Due to the serious version problem (especially torch.utils.data.dataloade

Sanghyun Son 2.1k Jan 1, 2023
Image Super-Resolution Using Very Deep Residual Channel Attention Networks

Image Super-Resolution Using Very Deep Residual Channel Attention Networks

kongdebug 14 Oct 14, 2022
Torch implementation of "Enhanced Deep Residual Networks for Single Image Super-Resolution"

NTIRE2017 Super-resolution Challenge: SNU_CVLab Introduction This is our project repository for CVPR 2017 Workshop (2nd NTIRE). We, Team SNU_CVLab, (B

Bee Lim 625 Dec 30, 2022
Resco: A simple python package that report the effect of deep residual learning

resco Description resco is a simple python package that report the effect of dee

Pierre-Arthur Claudé 1 Jun 28, 2022
Self-Attention Between Datapoints: Going Beyond Individual Input-Output Pairs in Deep Learning

We challenge a common assumption underlying most supervised deep learning: that a model makes a prediction depending only on its parameters and the features of a single input. To this end, we introduce a general-purpose deep learning architecture that takes as input the entire dataset instead of processing one datapoint at a time.

OATML 360 Dec 28, 2022
A bare-bones TensorFlow framework for Bayesian deep learning and Gaussian process approximation

Aboleth A bare-bones TensorFlow framework for Bayesian deep learning and Gaussian process approximation [1] with stochastic gradient variational Bayes

Gradient Institute 127 Dec 12, 2022
Pytorch implementation of Deep Recursive Residual Network for Super Resolution (DRRN)

DRRN-pytorch This is an unofficial implementation of "Deep Recursive Residual Network for Super Resolution (DRRN)", CVPR 2017 in Pytorch. [Paper] You

yun_yang 192 Dec 12, 2022
A PyTorch implementation for PyramidNets (Deep Pyramidal Residual Networks)

A PyTorch implementation for PyramidNets (Deep Pyramidal Residual Networks) This repository contains a PyTorch implementation for the paper: Deep Pyra

Greg Dongyoon Han 262 Jan 3, 2023
Reproduce ResNet-v2(Identity Mappings in Deep Residual Networks) with MXNet

Reproduce ResNet-v2 using MXNet Requirements Install MXNet on a machine with CUDA GPU, and it's better also installed with cuDNN v5 Please fix the ran

Wei Wu 531 Dec 4, 2022
Graph Regularized Residual Subspace Clustering Network for hyperspectral image clustering

Graph Regularized Residual Subspace Clustering Network for hyperspectral image clustering

Yaoming Cai 5 Jul 18, 2022
Official implementation of the paper "Lightweight Deep CNN for Natural Image Matting via Similarity Preserving Knowledge Distillation"

Lightweight-Deep-CNN-for-Natural-Image-Matting-via-Similarity-Preserving-Knowledge-Distillation Introduction Accepted at IEEE Signal Processing Letter

DongGeun-Yoon 19 Jun 7, 2022
《Single Image Reflection Removal Beyond Linearity》(CVPR 2019)

Single-Image-Reflection-Removal-Beyond-Linearity Paper Single Image Reflection Removal Beyond Linearity. Qiang Wen, Yinjie Tan, Jing Qin, Wenxi Liu, G

Qiang Wen 51 Jun 24, 2022
Beyond Image to Depth: Improving Depth Prediction using Echoes (CVPR 2021)

Beyond Image to Depth: Improving Depth Prediction using Echoes (CVPR 2021) Kranti Kumar Parida, Siddharth Srivastava, Gaurav Sharma. We address the pr

Kranti Kumar Parida 33 Jun 27, 2022