otx.tools.converter#

Converter for v1 config.

Functions

update_augmentations(augmentation_params, config)

Update augmentations in the config.

update_early_stopping(early_stopping_cfg, config)

Update early stopping parameters in the config.

update_input_size(height, width, config)

Update input size in the config.

update_learning_rate(param_value, config)

Update learning rate in the config.

update_num_iters(param_value, config)

Update max_epochs in the config.

update_tiling(tiling_dict, config)

Update tiling parameters in the config.

Classes

GetiConfigConverter()

Convert Geti model manifest to OTXv2 recipe dictionary.

ModelStatus(value[, names, module, ...])

Enum for model status.

class otx.tools.converter.GetiConfigConverter[source]#

Bases: object

Convert Geti model manifest to OTXv2 recipe dictionary.

Example

The following examples show how to use the Converter class. We expect a config file with ModelTemplate information in json form.

Convert template.json to dictionary:

converter = GetiConfigConverter()
config = converter.convert("train_config.yaml")

Instantiate an object from the configuration dictionary:

engine, train_kwargs = converter.instantiate(
    config=config,
    work_dir="otx-workspace",
    data_root="tests/assets/car_tree_bug",
)

Train the model:

engine.train(**train_kwargs)
static convert(config: dict) dict[source]#

Convert a geti configuration file to a default configuration dictionary.

Parameters:
  • config (dict) – The path to the Geti yaml configuration file.

  • task (OTXTaskType | None) – Value to override the task.

Returns:

The default configuration dictionary.

Return type:

dict

static get_callback_idx(callbacks: list, name: str) int[source]#

Return required callbacks index from callback list.

static instantiate(config: dict, work_dir: str | Path | PathLike | None = None, data_root: str | Path | PathLike | None = None, **kwargs) tuple[Engine, dict[str, Any]][source]#

Instantiate an object from the configuration dictionary.

Parameters:
  • config (dict) – The configuration dictionary.

  • work_dir (PathLike) – Path to the working directory.

  • data_root (PathLike) – The root directory for data.

Returns:

A tuple containing the engine and the train kwargs dictionary.

Return type:

tuple

static instantiate_datamodule(config: dict, data_root: str | Path | PathLike | None = None, **kwargs) OTXDataModule[source]#

Instantiate an OTXDataModule with arrow data format.

class otx.tools.converter.ModelStatus(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

Enum for model status.

otx.tools.converter.update_augmentations(augmentation_params: dict, config: dict) None[source]#

Update augmentations in the config.

Example

augmentation_params = {
random_affine = {

“enable”: True, “scaling_ratio_range”: [0.1, 2.0]

}, gaussian_blur = {

“enable”: True, “kernel_size”: 5

}

otx.tools.converter.update_early_stopping(early_stopping_cfg: dict | None, config: dict) None[source]#

Update early stopping parameters in the config.

otx.tools.converter.update_input_size(height: int | None, width: int | None, config: dict) None[source]#

Update input size in the config.

otx.tools.converter.update_learning_rate(param_value: float | None, config: dict) None[source]#

Update learning rate in the config.

otx.tools.converter.update_num_iters(param_value: int | None, config: dict) None[source]#

Update max_epochs in the config.

otx.tools.converter.update_tiling(tiling_dict: dict | None, config: dict) None[source]#

Update tiling parameters in the config.