1
$\begingroup$

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')])
$\endgroup$
1
  • $\begingroup$ This question is really at the limit of being on-topic, but I will leave it open. $\endgroup$ – nbro Oct 30 '20 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.