自编码器图像去噪matlab,DenoisingAutoencoder(图像去噪自动编码器)

本文主要介绍使用TensorFlow实现DenoisingAutoencoder(图像去噪自动编码器)。

下面是示例代码:

# 导入相关模块

import numpy as np

import sys

import tensorflow as tf

import matplotlib.pyplot as plt

'''

IPython有一组预定义的“魔术函数”,您可以使用命令行样式语法调用

它们。有两种魔法,一种是线导向(line-oriented),另一种是单元

导向(cell-oriented)。line magics以%字符作为前缀,其工作方式

与操作系统命令行调用非常相似:它们作用于整行,line magics可以返

回结果,也可以进行赋值使用;cell magics是以%%开头,它需要出现

在单元的第一行,而且是作用于整个单元。

使用此方法时,绘制命令的输出将在前端显示,就像Jupyter笔记本一样

,直接显示在生成命令的代码单元格的下方,生成的绘图也将存储在笔记

本文档中。不过这个方法好像只适用于Jupyter notebook和Jupyter

QtConsole。

'''

%matplotlib inline

# 导入数据集

from tensorflow.examples.tutorials.mnist import input_data

mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

inputs_ = tf.placeholder(tf.float32, [None, 28, 28, 1])

targets_ = tf.placeholder(tf.float32, [None, 28, 28, 1])

def lrelu(x, alpha=0.1):

return tf.maximum(alpha * x, x)

### Encoder

with tf.name_scope('en-convolutions'):

conv1 = tf.layers.conv2d(inputs_, filters=32,

kernel_size=(3, 3),

strides

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值