otx.api.usecases.tasks.interfaces.training_interface#

This module contains the interface class for tasks that can perform training.

Classes

ITrainingTask()

A base interface class for tasks which can perform training.

class otx.api.usecases.tasks.interfaces.training_interface.ITrainingTask[source]#

Bases: object

A base interface class for tasks which can perform training.

abstract cancel_training()[source]#

Cancels the currently running training process.

If training is not running, do nothing.

abstract save_model(output_model: ModelEntity)[source]#

Save the model currently loaded by the task to output_model.

This method is for instance used to save the pre-trained weights before training when the task has been initialised with pre-trained weights rather than an existing model.

Parameters:

output_model (ModelEntity) – Output model where the weights should be stored

abstract train(dataset: DatasetEntity, output_model: ModelEntity, train_parameters: TrainParameters)[source]#

Train a new model using the model currently loaded by the task.

If training was successful, the new model should be used for subsequent calls (e.g. optimize or infer).

The new model weights should be saved in the object output_model.

The task has two choices:

  • Set the output model weights, if the task was able to improve itself (according to own measures)

  • Set the model state as failed if it failed to improve itself (according to own measures)

Parameters:
  • dataset (DatasetEntity) – Dataset containing the training and validation splits to use for training.

  • output_model (ModelEntity) – Output model where the weights should be stored

  • train_parameters (TrainParameters) – Training parameters