Image classifier
Example of a simple algorithm for image classification.
This can be run from the command-line like so:
ImageClassifier #
Bases: LightningModule
Example learning algorithm for image classification.
__init__ #
__init__(
datamodule: ImageClassificationDataModule,
network: HydraConfigFor[Module],
optimizer: HydraConfigFor[partial[Optimizer]],
init_seed: int = 42,
)
Create a new instance of the algorithm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datamodule
|
ImageClassificationDataModule
|
Object used to load train/val/test data. See the lightning docs for LightningDataModule for more info. |
required |
network
|
HydraConfigFor[Module]
|
The config of the network to instantiate and train. |
required |
optimizer
|
HydraConfigFor[partial[Optimizer]]
|
The config for the Optimizer. Instantiating this will return a function (a functools.partial) that will create the Optimizer given the hyper-parameters. |
required |
init_seed
|
int
|
The seed to use when initializing the weights of the network. |
42
|
configure_optimizers #
Creates the optimizers.
See lightning.pytorch.core.LightningModule.configure_optimizers
for more information.