An example of a denoising autoencoder with TensorFlow

In this example (based on the previous one), we are going to employ a very similar architecture, but as the goal is denoising the images, we will impose a code length equal to (width × height), setting all the strides to (1 × 1), and therefore we won't need to resize the images anymore:

import tensorflow as tfgraph = tf.Graph()with graph.as_default():    input_noisy_images = tf.placeholder(tf.float32, shape=(None, width, height, 1))    input_images = tf.placeholder(tf.float32, shape=(None, width, height, 1))        # Encoder    conv_0 = tf.layers.conv2d(inputs=input_noisy_images,                              filters=32,                              kernel_size=(3, 3),                              activation=tf.nn.relu,                              padding='same')        conv_1 = tf.layers.conv2d(inputs=conv_0, filters=64, ...

Get Mastering Machine Learning Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.