基于深度学习堆栈自动编码器模型的图像去噪python代码


这个存储库包含使用深度学习对高分辨率图像进行分解的工作的代码。目前最先进的方法,如BM3D,KSVD和非本地手段确实能够产生高质量的去噪效果。但是当图像的大小变得非常高时,例如。 4000 x 80000像素,那些高质量的结果以高计算时间为代价。这个耗时的因素可以作为一个动机来提出一个模型,可以在更短的时间内提供可比较的结果,如果不是更好的话。因此,我使用了一种深度学习方法,它会自动尝试学习将噪声图像映射到其去噪版本的功能。
资源截图
代码片段和文件信息

from __future__ import print_function

import os
import sys
import timeit

import numpy

import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams

from logistic_sgd import load_data
from utils import tile_raster_images

try:
    import PIL.Image as Image
except ImportError:
    import Image


class dA(object):
    “““Denoising Auto-Encoder class (dA)

    A denoising autoencoders tries to reconstruct the input from a corrupted
    version of it by projecting it first in a latent space and reprojecting
    it afterwards back in the input space. Please refer to Vincent et al.2008
    for more details. If x is the input then equation (1) computes a partially
    destroyed version of x by means of a stochastic mapping q_D. Equation (2)
    computes the projection of the input into the latent space. Equation (3)
    computes the reconstruction of the input while equation (4) computes the
    reconstruction error.

    .. math::

         ilde{x} ~ q_D( ilde{x}|x)                                     (1)

        y = s(W  ilde{x} + b)                                           (2)

        x = s(W‘ y  + b‘)                                                (3)

        L(xz) = -sum_{k=1}^d [x_k log z_k + (1-x_k) log( 1-z_k)]      (4)

    “““

    def __init__(
        self
        numpy_rng
        theano_rng=None
        input=None
        n_visible=784
        n_hidden=500
        W=None
        bhid=None
        bvis=None
    ):
        “““
        Initialize the dA class by specifying the number of visible units (the
        dimension d of the input ) the number of hidden units ( the dimension
        d‘ of the latent or hidden space ) and the corruption level. The
        constructor also receives symbolic variables for the input weights and
        bias. Such a symbolic variables are useful when for example the input
        is the result of some computations or when weights are shared between
        the dA and an MLP layer. When dealing with SdAs this always happens
        the dA on layer 2 gets as input the output of the dA on layer 1
        and the weights of the dA are used in the second stage of training
        to construct an MLP.

        :type numpy_rng: numpy.random.RandomState
        :param numpy_rng: number random generator used to generate weights

        :type theano_rng: theano.tensor.shared_randomstreams.RandomStreams
        :param theano_rng: Theano random generator; if None is given one is
                     generated based on a seed drawn from ‘rng‘

        :type input: theano.tensor.TensorType
        :param input: a symbolic description of the input or None for
                      standalone dA

        :type n_visible: int
        :param n_visible: number of visible units

        :type n_hidden: int
        :param n_hidden:  number of hidden units

        :type W: theano.tensor.TensorType
        :param W: Theano variable pointing to a set o

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-14 10:45  image-denoising-master
     文件        2320  2017-12-14 10:45  image-denoising-masterREADME.md
     文件       13234  2017-12-14 10:45  image-denoising-masterdA.py
     目录           0  2017-12-14 10:45  image-denoising-masterdata
     文件       86860  2017-12-14 10:45  image-denoising-masterdataand1_denoised1.png
     文件       89019  2017-12-14 10:45  image-denoising-masterdataand1_denoised2.png
     文件       96255  2017-12-14 10:45  image-denoising-masterdataand1_noisy1.png
     文件       95355  2017-12-14 10:45  image-denoising-masterdataand1_noisy2.png
     文件       29920  2017-12-14 10:45  image-denoising-masterdenoise_function.py
     目录           0  2017-12-14 10:45  image-denoising-mastergraphs
     文件       20564  2017-12-14 10:45  image-denoising-mastergraphspatches_plot.png
     文件       14858  2017-12-14 10:45  image-denoising-mastergraphspsnr_plot.png
     文件       21213  2017-12-14 10:45  image-denoising-mastergraphsvariation_with_no_of_hidden_layers1.png
     文件       21676  2017-12-14 10:45  image-denoising-mastergraphsvariation_with_size_of_hidden_layers.png
     文件       16224  2017-12-14 10:45  image-denoising-masterlogistic_sgd.py
     文件       13634  2017-12-14 10:45  image-denoising-mastermlp.py
     目录           0  2017-12-14 10:45  image-denoising-masterpaper
     文件     2633933  2017-12-14 10:45  image-denoising-masterpaperFinal_icmla_poster(1)_jp.jpg
     文件     1440465  2017-12-14 10:45  image-denoising-masterpaperFinal_paper.pdf

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)