DnCNN

介绍DnCNNs深度卷积神经网络用于图像去噪的技术细节,包括网络架构、残差学习、批量归一化及实验设置。通过17层深度网络,有效解决了图像去噪中的梯度消失问题,提升去噪效果。

Kai Zhang, Wangmeng Zuo, Yunjin Chen, Deyu Meng, Lei Zhang, Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising, IEEE Trans. on Image Processing, 2017

Network Architecture

 DnCNNs: feed-forward denoising convolutional neural networks

Code

def dncnn(input, is_training=True, output_channels=1):
    
    with tf.variable_scope('block1'):
        output = tf.layers.conv2d(input, 64, 3, padding='same', activation=tf.nn.relu)
         ## (i) Conv+ReLU: for the first layer
            # 64 filters of size 3*3*c are used to generate 64 feature maps
            # zero padding to avoid boundary artifacts
            # utilize rectified linearunits (ReLU, max(0; ·)) to introduce nonlinearity
            
    for layers in xrange(2, 16 + 1):
        with tf.variable_scope('block%d' % layers):
            output = tf.layers.conv2d(output, 64, 3, padding='same', name='conv%d' % layers, use_bias=False)
            output = tf.nn.relu(tf.layers.batch_normalization(output, training=is_training))
        ## (ii) Conv+BN+ReLU: for layers 2 ~ (D - 1)
            # 64 filters of size 3*3*64 
            # batch normalization is added between convolution and ReLU  
            
    with tf.variable_scope('block17'):
        output = tf.layers.conv2d(output, output_channels, 3, padding='same')
        ## (iii) Conv: for the last layer
            # c filters of size 3*3*64 are used to reconstruct the output
            
     ## output is residual image; return is (input-output) = predicted clean image       
    return input - output

网络结构说明:

  1. First layer:Conv(3 * 3 * c * 64)+ReLu (c代表图片通道数)
  2. Layers 2~(D-1):Conv(3 * 3 * 64 * 64)+BN(batch normalization)+ReLu
  3. Last layer:Conv(3 * 3 * 64)
  4. 每一层都zero padding,使得每一层的输入、输出尺寸保持一致,防止产生 boundary artifact。

Highlights

  1. Residual learning:解决网络深度加深带来的梯度消失或梯度爆炸问题☞ResNet论文详解
  2. Batch normalization:解决内部协变量移位问题☞ BN生动形象的说明

Experimental setting

  1. 400 images of size 180×180 for training
  2. three noise levels, i.e., σ = 15, 25 and 50
  3. patch size = 40 × 40, crop 128 × 1600 patches to train the model
  4. network depth = 17
  5. mini-batch size = 128
  6. training epochs = 50
  7. learning rate was decayed exponentially from 1e-1 to 1e-4 for the 50 epochs.

 

DnCNN(Deep Convolutional Neural Network for Image Denoising)是一种专门用于图像去噪任务的深度学习模型。其核心结构包括多个卷积、ReLU 激活函数以及批量归一化(Batch Normalization),最终通过残差学习的方式输出去噪后的图像。 以下是一个基于 PyTorch 的 DnCNN 模型实现示例: ```python import torch import torch.nn as nn class DnCNN(nn.Module): def __init__(self, num_layers=17, num_features=64): super(DnCNN, self).__init__() layers = [nn.Sequential( nn.Conv2d(3, num_features, kernel_size=3, stride=1, padding=1), nn.ReLU(inplace=True) )] for i in range(num_layers - 2): layers.append(nn.Sequential( nn.Conv2d(num_features, num_features, kernel_size=3, padding=1), nn.BatchNorm2d(num_features), nn.ReLU(inplace=True) )) layers.append(nn.Conv2d(num_features, 3, kernel_size=3, padding=1)) self.layers = nn.Sequential(*layers) self._initialize_weights() def _initialize_weights(self): for m in self.modules(): if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight) elif isinstance(m, nn.BatchNorm2d): nn.init.ones_(m.weight) nn.init.zeros_(m.bias) def forward(self, inputs): y = inputs residual = self.layers(y) return y - residual ``` 该代码定义了一个包含 17 DnCNN 网络,其中前几为卷积与 ReLU 激活函数组合,中间加入了批量归一化以提升训练稳定性,最后一仅包含卷积操作用于重建图像[^1]。 --- ### 获取 DnCNN 的 GitHub 实现 DnCNN 的官方实现最初由其作者在论文《Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising》中提出,并提供了 MATLAB 和 Python 版本的实现。以下是几个常见的 GitHub 上的 DnCNN 实现资源: 1. **官方 GitHub 仓库**: - 地址:[https://github.com/cszn/DnCNN](https://github.com/cszn/DnCNN) - 提供了 MATLAB 和 PyTorch 实现,适合研究和实验使用。 2. **PyTorch 实现参考**: - 地址:[https://github.com/SaoYan/DnCNN-PyTorch](https://github.com/SaoYan/DnCNN-PyTorch) - 包含完整的训练与测试流程,适用于图像去噪任务。 3. **改进版本(如 xDnCNN)**: - 可以参考相关论文“xUnit: Learning a Better CNN Unit for Image Denoising”中的实现方式,将自定义激活函数模块集成进 DnCNN 结构中。 --- ### 相关问题
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值