Model architecture¶
CVAE (Convolutional Variational Autoencoder)¶
Encoder: a stack of strided
Conv2Dlayers (downsampling) →Flatten→Dense→z_meanandz_log_var, with the reparameterization trick producing the latent samplez.Decoder:
Dense→Reshape→ stackedConv2DTransposelayers (upsampling) → a finalConv2DTransposewith sigmoid activation reconstructing all input channels.Loss: per-channel binary cross-entropy reconstruction loss +
beta× KL divergence.
See CVAE.
CondCVAE (Conditional CVAE)¶
Extends CVAE by concatenating one-hot encoded condition labels into the encoder (after the
flattened features) and the decoder (with the latent vector). The number of condition columns
chosen in initialize_model determines the one-hot dimension; the fitted encoder is saved
alongside the model so the same encoding is reused at inference.
See CondCVAE.
Configuration¶
Key parameters of initialize_model():
Parameter |
Default |
Description |
|---|---|---|
|
— |
Dimensionality of the latent space. |
|
— |
Size of the dense layer between conv and latent layers. |
|
— |
obs columns used as conditions; |
|
|
Patch shape |
|
|
Filters per convolutional layer. |
|
|
Dropout rate. |
|
|
KL-divergence weight (beta-VAE). |
|
|
Training batch size. |
Note
input_shape must be consistent with the patch_size used in generate_dataset
(same height/width, plus the channel count).