Callbacks#

Callbacks for OTX inference.

class otx.algorithms.anomaly.adapters.anomalib.callbacks.AnomalyInferenceCallback(otx_dataset: DatasetEntity, labels: List[LabelEntity], task_type: TaskType)#

Callback that updates the OTX dataset during inference.

on_predict_epoch_end(_trainer: Trainer, _pl_module: AnomalyModule, outputs: List[Any])#

Call when the predict epoch ends.

class otx.algorithms.anomaly.adapters.anomalib.callbacks.ProgressCallback(parameters: Optional[Union[TrainParameters, InferenceParameters, OptimizationParameters]] = None)#

Progress Callback.

Modify progress callback to show completion of the entire training step.

on_predict_batch_end(trainer, pl_module, outputs, batch, batch_idx, dataloader_idx)#

Adds prediction completion percentage to the progress bar.

on_predict_start(trainer, pl_module)#

Reset progress bar when prediction starts.

on_test_batch_end(trainer, pl_module, outputs, batch, batch_idx, dataloader_idx)#

Adds testing completion percentage to the progress bar.

on_test_start(trainer, pl_module)#

Reset progress bar when testing starts.

on_train_batch_end(trainer, pl_module, outputs, batch, batch_idx)#

Adds training completion percentage to the progress bar.

on_train_start(trainer, pl_module)#

Store max epochs and current epoch from trainer.

on_validation_epoch_end(trainer, pl_module)#

If score exists in trainer.logged_metrics, report the score.