vae.autoencoder =============== .. py:module:: vae.autoencoder Classes ------- .. autoapisummary:: vae.autoencoder.KLDivergenceLayer vae.autoencoder.VAE Functions --------- .. autoapisummary:: vae.autoencoder.sample_point_from_normal_distribution Module Contents --------------- .. py:function:: sample_point_from_normal_distribution(args) Sampling function using the reparameterization trick. .. py:class:: KLDivergenceLayer Bases: :py:obj:`tensorflow.keras.layers.Layer` Custom layer to compute and add KL divergence to the model's loss. .. py:method:: call(inputs) .. py:class:: VAE(input_shape, conv_filters, conv_kernels, conv_strides, latent_space_dim) VAE represents a Deep Convolutional variational autoencoder architecture with mirrored encoder and decoder components. .. py:attribute:: input_shape .. py:attribute:: conv_filters .. py:attribute:: conv_kernels .. py:attribute:: conv_strides .. py:attribute:: latent_space_dim .. py:attribute:: reconstruction_loss_weight :value: 10000 .. py:attribute:: encoder :value: None .. py:attribute:: decoder :value: None .. py:attribute:: model :value: None .. py:attribute:: _num_conv_layers .. py:attribute:: _shape_before_bottleneck :value: None .. py:attribute:: _model_input :value: None .. py:method:: summary() .. py:method:: compile(learning_rate=0.0001) .. py:method:: train(x_train, batch_size, num_epochs) .. py:method:: save(save_folder='.') .. py:method:: load_weights(weights_path) .. py:method:: reconstruct(images) .. py:method:: load(save_folder='.') :classmethod: .. py:method:: _calculate_combined_loss(y_target, y_predicted) .. py:method:: _calculate_reconstruction_loss(y_target, y_predicted) .. py:method:: _create_folder_if_it_doesnt_exist(folder) .. py:method:: _save_parameters(save_folder) .. py:method:: _save_weights(save_folder) .. py:method:: _build() .. py:method:: _build_autoencoder() .. py:method:: _build_decoder() .. py:method:: _add_decoder_input() .. py:method:: _add_dense_layer(decoder_input) .. py:method:: _add_reshape_layer(dense_layer) .. py:method:: _add_conv_transpose_layers(x) .. py:method:: _add_conv_transpose_layer(layer_index, x) .. py:method:: _add_decoder_output(x) .. py:method:: _build_encoder() .. py:method:: _add_encoder_input() .. py:method:: _add_conv_layers(encoder_input) .. py:method:: _add_conv_layer(layer_index, x) .. py:method:: _add_bottleneck(x)