Simple Inverse Mapping

A simple inverse mapping module which expects a trained GAN module as function \(G: A \rightarrow B\).

class ecgan.modules.inverse_mapping.vanilla_inverse_mapping.SimpleGANInverseMapping(inv_cfg, module_cfg, run_path, seq_len, num_channels, tracker)[source]

Bases: ecgan.modules.inverse_mapping.inverse_mapping.InvertibleBaseModule

Implementation of a simple inverse mapping module.

The module expects a pre-trained generator model and trains a downsampling CNN based on the generator model.

static configure()[source]

Return a default configuration for the module.

Return type

Dict

invert(data)[source]

Apply the downsampling CNN.

Return type

Tensor

validation_step(batch)[source]

Move along. Nothing to see here.

Return type

dict

property watch_list: List

Return torch nn.Modules that should be watched during training.

Return type

List

on_epoch_end(epoch, sample_interval, batch_size)[source]

Perform artifact and metric logging in a sample interval.

The function creates two types of sample images:

  1. Apply the generator module on some fixed noise and some randomly sampled noise.

  2. Apply the inverse mapping on the output of the generator and then re-apply the generator on the output of the downsampling.

Return type

List[Artifact]