コード例 #1
0
def train(x_train, x_test, y_size, x_size, num_channels, latent_space_dim,
          learning_rate):
    autoencoder, encoder, decoder, encoder_mu, encoder_log_variance = VAE(
        y_size, x_size, num_channels, latent_space_dim)
    autoencoder.summary()
    autoencoder.compile(optimizer=Adam(lr=learning_rate),
                        loss=loss_func(encoder_mu, encoder_log_variance))

    return autoencoder, encoder, decoder
コード例 #2
0
def train(x_train, learning_rate, batch_size, epochs):
    autoencoder = VAE(input_shape=(28, 28, 1),
                      conv_filters=(32, 64, 64, 64),
                      conv_kernels=(3, 3, 3, 3),
                      conv_strides=(1, 2, 2, 1),
                      latent_space_dim=100)
    autoencoder.summary()
    autoencoder.compile(learning_rate)
    autoencoder.train(x_train, batch_size, epochs)
    return autoencoder
def train(x_train, learning_rate, batch_size, epochs):
    autoencoder = VAE(
        input_shape=(256, 388, 1),
        conv_filters=(512, 256),  #(512, 256, 128, 64, 32)
        conv_kernels=(3, 3),  # (3, 3, 3, 3, 3)
        conv_strides=(2, 2),  # (2, 2, 2, 2, (2, 1))
        latent_space_dim=128)
    autoencoder.summary()
    autoencoder.compile(learning_rate)
    autoencoder.train(x_train, batch_size, epochs)
    return autoencoder