hyrax.models
Submodules
Classes
This autoencoder is designed to work with datasets that are prepared with Hyrax's HSC Data Set class. |
|
This autoencoder is designed to work with datasets that are prepared with Hyrax's HSC Data Set class. |
|
This is an autoencoder with skipconnections that should work with |
|
This autoencoder is designed to work with a wide range of image datasets to allow testing. |
|
This is tweaked version of HyraxAutoencoder and is designed to work with a wide range of imaging datasets. |
|
This CNN is designed to work with datasets that are prepared with Hyrax's HSC Data Set class. |
|
Simple model for testing which returns its own input |
Functions
|
Decorator to register a model with the model registry, and to add common interface functions |
Package Contents
- class HSCAutoencoder(config, shape)[source]
Bases:
torch.nn.ModuleThis autoencoder is designed to work with datasets that are prepared with Hyrax’s HSC Data Set class.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- encoder
- decoder
- config
- train_step(batch)[source]
This function contains the logic for a single training step. i.e. the contents of the inner loop of a ML training process.
- Parameters:
batch (tuple) – A tuple containing the two values the loss function
- Returns:
Current loss value – Dictionary containing the loss value for the current batch.
- Return type:
dict
- class HSCDCAE(config, shape)[source]
Bases:
torch.nn.ModuleThis autoencoder is designed to work with datasets that are prepared with Hyrax’s HSC Data Set class.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- encoder1
- encoder2
- encoder3
- encoder4
- pool
- decoder4
- decoder3
- decoder2
- decoder1
- activation
- config
- train_step(batch)[source]
This function contains the logic for a single training step. i.e. the contents of the inner loop of a ML training process.
- Parameters:
batch (tuple) – A tuple containing the two values the loss function
- Returns:
Current loss value – Dictionary containing the loss value for the current batch.
- Return type:
dict
- class ImageDCAE(config, shape)[source]
Bases:
torch.nn.ModuleThis is an autoencoder with skipconnections that should work with arbitarily sized images with arbitrary number of channels.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- input_shape
- config
- latent_dim
- base_channel_size
- conv_output_size
- encoder1
- encoder2
- encoder3
- encoder4
- pool
- latent_encoder
- latent_decoder
- decoder4
- decoder3
- decoder2
- decoder1
- activation
- _calculate_conv_output_size()[source]
Calculate the output size after all convolutional layers for the linear bottleneck.
- decode(latent, skip_connections, encoded_shape)[source]
Decode from latent space to image with skip connections.
- class HyraxAutoencoder(config, data_sample=None)[source]
Bases:
torch.nn.ModuleThis autoencoder is designed to work with a wide range of image datasets to allow testing.
This example model is taken from this autoenocoder tutorial
The train function has been converted into train_step for use with pytorch-ignite.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- config
- c_hid
- latent_dim
- conv_end_w
- conv_end_h
- train_step(batch)[source]
This function contains the logic for a single training step. i.e. the contents of the inner loop of a ML training process.
- Parameters:
batch (tuple) – A tuple containing the inputs and labels for the current batch.
- Returns:
Current loss value – Dictionary containing the loss value for the current batch.
- Return type:
dict
- class HyraxAutoencoderV2(config, shape=(5, 250, 250))[source]
Bases:
torch.nn.ModuleThis is tweaked version of HyraxAutoencoder and is designed to work with a wide range of imaging datasets.
V2 improvements: - Configurable final layer activation - Uses criterion and optimizer from config variables
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- config
- c_hid
- latent_dim
- conv_end_w = 250
- conv_end_h = 250
- train_step(batch)[source]
This function contains the logic for a single training step. i.e. the contents of the inner loop of a ML training process.
- Parameters:
batch (tuple) – A tuple containing the inputs and labels for the current batch.
- Returns:
Current loss value – Dictionary containing the loss value for the current batch.
- Return type:
dict
- class HyraxCNN(config, shape=(3, 32, 32))[source]
Bases:
torch.nn.ModuleThis CNN is designed to work with datasets that are prepared with Hyrax’s HSC Data Set class.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
- config
- conv1
- pool
- conv2
- fc1
- fc2
- fc3
- train_step(batch)[source]
This function contains the logic for a single training step. i.e. the contents of the inner loop of a ML training process.
- Parameters:
batch (tuple) – A tuple containing the inputs and labels for the current batch.
- Returns:
Current loss value – Dictionary containing the loss value for the current batch.
- Return type:
dict