mirapy.autoencoder.models

Module Contents

class mirapy.autoencoder.models.Autoencoder

Base Class for autoencoder models.

compile(self, optimizer, loss)

Compile model with given configuration.

Parameters
  • optimizer – Instance of optimizer.

  • loss – String (name of loss function) or custom function.

train(self, x, y, batch_size=32, epochs=100, validation_data=None, shuffle=True, verbose=1)

Trains the model on the training data with given settings.

Parameters
  • x – Numpy array of training data.

  • y – Numpy array of target data.

  • epochs – Integer. Number of epochs during training.

  • batch_size – Number of samples per gradient update.

  • validation_data – Numpy array of validation data.

  • shuffle – Boolean. Shuffles the data before training.

  • verbose – Value is 0, 1, or 2.

predict(self, x)

Predicts the output of the model for the given data as input.

Parameters

x – Input data as Numpy arrays.

plot_history(self)

Plots loss vs epoch graph.

save_model(self, model_name, path='models/')

Saves a model into a H5py file.

Parameters
  • model_name – File name.

  • path – Pa

load_model(self, model_name, path='models/')

Loads a model from a H5py file.

Parameters
  • model_name – File name.

  • path – Pa

summary(self)
class mirapy.autoencoder.models.DeNoisingAutoencoder(img_dim, activation='relu', padding='same')

Bases: mirapy.autoencoder.models.Autoencoder

De-noising Autoencoder used for the astronomical image reconstruction.

Parameters
  • img_dim – Set. Dimension of input and output image.

  • activation – String (activation function name).

  • padding – String (type of padding in convolution layers).

compile(self, optimizer, loss)

Compile model with given configuration.

Parameters
  • optimizer – Instance of optimizer.

  • loss – String (name of loss function) or custom function.

train(self, x, y, batch_size=32, epochs=100, validation_data=None, shuffle=True, verbose=1)

Trains the model on the training data with given settings.

Parameters
  • x – Numpy array of training data.

  • y – Numpy array of target data.

  • epochs – Integer. Number of epochs during training.

  • batch_size – Number of samples per gradient update.

  • validation_data – Numpy array of validation data.

  • shuffle – Boolean. Shuffles the data before training.

  • verbose – Value is 0, 1, or 2.

predict(self, x)

Predicts the output of the model for the given data as input.

Parameters

x – Input data as Numpy arrays.

show_image_pairs(self, original_images, decoded_images, max_images)

Displays images in pair of images in grid form using Matplotlib.

Parameters
  • original_images – Array of original images.

  • decoded_images – Array of decoded images.

  • max_images – Integer. Set number of images in a row.