Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Encoder - Decoder Principle | VAE implementation
Image Synthesis Through Generative Networks

book
Encoder - Decoder Principle

Encoder Component

The encoder component of an autoencoder is tasked with encoding the input data into a latent representation.
Utilizing a basic CNN architecture, the convolutional layers capture important image features, while pooling layers reduce the dimensionality of these extracted features. Finally, the dense layer generates latent values that represent the image encoding.

# Define the input placeholder
input_img = Input(shape=(28, 28, 1))

# Encoder
x = Conv2D(32, (2, 2), activation='relu', padding='same')(input_img)
x = MaxPooling2D((2, 2), padding='same')(x)
x = Conv2D(64, (2, 2), activation='relu', padding='same')(x)
encoded = MaxPooling2D((2, 2), padding='same')(x)

# Latent space
latent_dim = 16
x = Flatten()(encoded)
latent = Dense(latent_dim, activation='sigmoid', name='latent')(x)

Decoder Component

The autoencoder's decoder component aims to reconstruct the original input from the latent representation.
Using a simple CNN architecture, the decoder applies convolution layers to process the latent features and refine their details, followed by upsampling layers to expand their spatial dimensions.

# Decoder
decoder_input = Input(shape=(latent_dim,))
x = Dense(7*7*64, activation='relu')(decoder_input)
x = Reshape((7, 7, 64))(x)
x = Conv2D(64, (2, 2), activation='relu', padding='same')(x)
x = UpSampling2D((2, 2))(x)
x = Conv2D(32, (2, 2), activation='relu', padding='same')(x)
x = UpSampling2D((2, 2))(x)
decoded_output = Conv2D(1, (2, 2), activation='linear', padding='same')(x)

As a result, we have an architecture that compresses the image into a lower dimension and then restores it from this compressed representation. This compression must retain the most valuable and important features of the image, allowing us to reconstruct the original image with the highest possible quality.

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 2
We use cookies to make your experience better!
some-alt