otx.api.usecases.reporting#

Training reporting.

Classes

Callback()

Abstract base class used to build new callbacks.

TimeMonitorCallback(num_epoch, ...)

A callback to monitor the progress of training.

class otx.api.usecases.reporting.Callback[source]#

Bases: object

Abstract base class used to build new callbacks.

Properties
params: dict. Training parameters

(eg. verbosity, batch size, number of epochs…).

model: instance of keras.models.Model.

Reference of the model being trained.

The logs dictionary that callback methods take as argument will contain keys for quantities relevant to the current batch or epoch.

Currently, the .fit() method of the Sequential model class will include the following quantities in the logs that it passes to its callbacks:

on_epoch_end: logs include acc and loss, and

optionally include val_loss (if validation is enabled in fit), and val_acc (if validation and accuracy monitoring are enabled).

on_batch_begin: logs include size,

the number of samples in the current batch.

on_batch_end: logs include loss, and optionally acc

(if accuracy monitoring is enabled).

on_batch_begin(batch, logs=None)[source]#

It is called on batch begin event.

on_batch_end(batch, logs=None)[source]#

It is called on batch end event.

on_epoch_begin(epoch, logs=None)[source]#

It is called on epoch begin event.

on_epoch_end(epoch, logs=None)[source]#

It is called on epoch end event.

on_test_batch_begin(batch, logs)[source]#

It is called on test batch begin event.

on_test_batch_end(batch, logs)[source]#

It is called on test batch end event.

on_test_begin(logs)[source]#

It is called on test begin event.

on_test_end(logs)[source]#

It is called on test end event.

on_train_batch_begin(batch, logs)[source]#

It is called on train batch begin event.

on_train_batch_end(batch, logs)[source]#

It is called on train batch end event.

on_train_begin(logs=None)[source]#

It is called on train begin event.

on_train_end(logs=None)[source]#

It is called on train end event.

set_model(model)[source]#

Sets callback model.

set_params(params)[source]#

Sets callback parameters.

class otx.api.usecases.reporting.TimeMonitorCallback(num_epoch: int = 0, num_train_steps: int = 0, num_val_steps: int = 0, num_test_steps: int = 0, epoch_history: int = 5, step_history: int = 50, update_progress_callback: ~otx.api.entities.train_parameters.UpdateProgressCallback = <function default_progress_callback>)[source]#

Bases: Callback

A callback to monitor the progress of training.

Parameters:
  • num_epoch (int) – Amount of epochs

  • num_train_steps (int) – amount of training steps per epoch

  • num_val_steps (int) – amount of validation steps per epoch

  • num_test_steps (int) – amount of testing steps

  • epoch_history (int) – Amount of previous epochs to calculate average epoch time over

  • step_history (int) – Amount of previous steps to calculate average steps time over

  • update_progress_callback (UpdateProgressCallback) – Callback to update progress

get_progress()[source]#

Returns current progress as a percentage.

is_stalling() bool[source]#

Returns True if the training is stalling.

Returns True if the current step has taken more than 30 seconds and at least 20x more than the average step duration

on_epoch_begin(epoch, logs=None)[source]#

Set the number of current epoch and start the timer.

on_epoch_end(epoch, logs=None)[source]#

Computes the average time taken to complete an epoch based on a running average of epoch_history epochs.

on_test_batch_begin(batch, logs)[source]#

Set the number of current epoch and start the timer.

on_test_batch_end(batch, logs)[source]#

Compute average time taken to complete a step based on a running average of step_history steps.

on_train_batch_begin(batch, logs=None)[source]#

Set the value of current step and start the timer.

on_train_batch_end(batch, logs=None)[source]#

Compute average time taken to complete a step.

on_train_begin(logs=None)[source]#

Sets training to true.

on_train_end(logs=None)[source]#

Handles early stopping when the total_steps is greater than the current_step.