Models

  • Models should specify their sample format. E.g., a 2-element tuple of (input, target)

  • Data Modules should return a sample in the format specified by the model

  • Top-level modules must by Lightning Modules

  • Consider inheriting from minerva.models.nets.base.SimpleSupervisedModel for simple supervised models

The SimpleSupervisedModel class

This class implements a very common deep learning pipeline, which is composed by the following steps:

  1. Make a forward pass with the input data on the backbone model;

  2. Make a forward pass with the input data on the fc model;

  3. Compute the loss between the output and the label data;

  4. Optimize the model (backbone and FC) parameters with respect to the loss.

This reduces the code duplication for autoencoder models, and makes it easier to implement new models by only changing the backbone model. More complex models, that does not follow this pipeline, should not inherit from this class. Note that, for this class the input data is a tuple of tensors, where the first tensor is the input data and the second tensor is the mask or label.