otx.algorithms.common.tasks.base_task#

Base task of OTX.

Classes

OTXTask(task_environment[, output_path])

Base task of OTX.

OnHookInitialized(task_instance)

OnHookInitialized class.

class otx.algorithms.common.tasks.base_task.OTXTask(task_environment: TaskEnvironment, output_path: str | None = None)[source]#

Bases: IInferenceTask, IExportTask, IEvaluationTask, IUnload, ABC

Base task of OTX.

cancel_hook_initialized(cancel_interface: CancelInterfaceHook)[source]#

Initialization of cancel_interface hook.

cancel_training()[source]#

Cancel training function in trining task.

Sends a cancel training signal to gracefully stop the optimizer. The signal consists of creating a ‘.stop_training’ file in the current work_dir. The runner checks for this file periodically. The stopping mechanism allows stopping after each iteration, but validation will still be carried out. Stopping will therefore take some time.

cleanup()[source]#

Clean up work directory if user specified it.

abstract evaluate(output_resultset: ResultSetEntity, evaluation_metric: str | None = None)[source]#

Evaluate function of OTX Task.

abstract explain(dataset: DatasetEntity, explain_parameters: ExplainParameters | None = None) DatasetEntity[source]#

Main explain function of OTX Task.

abstract export(export_type: ExportType, output_model: ModelEntity, precision: ModelPrecision = ModelPrecision.FP32, dump_features: bool = True)[source]#

Export function of OTX Task.

abstract infer(dataset: DatasetEntity, inference_parameters: InferenceParameters | None = None) DatasetEntity[source]#

Main infer function.

abstract save_model(output_model: ModelEntity)[source]#

Save best model weights in trining task.

set_seed()[source]#

Set seed and deterministic.

abstract train(dataset: DatasetEntity, output_model: ModelEntity, train_parameters: TrainParameters | None = None, seed: int | None = None, deterministic: bool = False)[source]#

Train function for OTX task.

unload()[source]#

Unload the task.

property config#

Config of OTX task.

class otx.algorithms.common.tasks.base_task.OnHookInitialized(task_instance)[source]#

Bases: object

OnHookInitialized class.

__call__(cancel_interface)[source]#

Function call in OnHookInitialized.