otx.core.config#

Config data type objects.

Functions

any_representer(dumper, data)

Representer function that converts any data to a YAML node.

as_int_tuple(*args)

Resolve YAML list into Python integer tuple.

as_torch_dtype(arg)

Resolve YAML string into PyTorch dtype.

dtype_representer(dumper, data)

Custom representer for converting dtype object to YAML sequence node.

ignore_aliases(self, data)

Determine whether to ignore aliases in YAML representation.

otx_str_type_representer(dumper, data)

Representer function for converting OTXTaskType or OTXTrainType to a YAML string representation.

register_configs()

Register custom resolvers.

otx.core.config.any_representer(dumper: Dumper | SafeRepresenter, data: Any) ScalarNode[source]#

Representer function that converts any data to a YAML node.

Parameters:
  • dumper (yaml.Dumper | yaml.representer.SafeRepresenter) – The YAML dumper or safe representer.

  • data (Any) – The data to be represented.

Returns:

The YAML node representing the data.

Return type:

yaml.Node

otx.core.config.as_int_tuple(*args) tuple[int, ...][source]#

Resolve YAML list into Python integer tuple.

Example

YAML file example:

```yaml
mem_cache_img_max_size: ${as_int_tuple:500,500}
```
otx.core.config.as_torch_dtype(arg: str) dtype[source]#

Resolve YAML string into PyTorch dtype.

Example

YAML file example:

```yaml
transforms:
    - class_path: torchvision.transforms.v2.ToDtype
      init_args:
        dtype: ${as_torch_dtype:torch.float32}
        scale: True
```
otx.core.config.dtype_representer(dumper: yaml.Dumper | yaml.representer.SafeRepresenter, data: dtype) yaml.ScalarNode[source]#

Custom representer for converting dtype object to YAML sequence node.

Parameters:
  • dumper (yaml.Dumper) – The YAML dumper object.

  • data (dtype) – The dtype object to be converted.

Returns:

The converted YAML node.

Return type:

yaml.Node

otx.core.config.ignore_aliases(self: SafeRepresenter, data: Any) bool[source]#

Determine whether to ignore aliases in YAML representation.

Parameters:

data – The data to check.

Returns:

True if aliases should be ignored, None otherwise.

Return type:

bool | None

otx.core.config.otx_str_type_representer(dumper: Dumper | SafeRepresenter, data: OTXTaskType | OTXTrainType) ScalarNode[source]#

Representer function for converting OTXTaskType or OTXTrainType to a YAML string representation.

Parameters:
  • dumper (yaml.Dumper | yaml.representer.SafeRepresenter) – The YAML dumper or safe representer object.

  • data (OTXTaskType | OTXTrainType) – The OTXTaskType or OTXTrainType object to be represented.

Returns:

The YAML ScalarNode representation of the given object.

Return type:

yaml.ScalarNode

otx.core.config.register_configs() None[source]#

Register custom resolvers.

Modules

otx.core.config.data

Config data type objects for data.

otx.core.config.device

Config data type objects for device.

otx.core.config.explain

Config data type objects for export method.

otx.core.config.hpo

Config objects for HPO.