TransWikia.com

Why do we add additional axis in CNN autoencoder while denoising?

Artificial Intelligence Asked by Maciek Woźniak on February 3, 2021

I am currently learning about autoencoders and I follow https://www.tensorflow.org/tutorials/generative/autoencoder

When denoising images, authors of tutorial add an additional axis to the data and I cannot find any explanation why… I would appreciate any answer or suggestion 🙂

x_train = x_train[..., tf.newaxis]
x_test = x_test[..., tf.newaxis]

Then the encoder is built from the following layers:

 self.encoder = tf.keras.Sequential([
      layers.Input(shape=(28, 28, 1)), 
      layers.Conv2D(16, (3,3), activation='relu', padding='same', strides=2),
      layers.Conv2D(8, (3,3), activation='relu', padding='same', strides=2)])
    
 self.decoder = tf.keras.Sequential([
      layers.Conv2DTranspose(8, kernel_size=3, strides=2, activation='relu', padding='same'),
      layers.Conv2DTranspose(16, kernel_size=3, strides=2, activation='relu', padding='same'),
      layers.Conv2D(1, kernel_size=(3,3), activation='sigmoid', padding='same')])

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP