otx.core.utils.utils#

Utility functions.

Functions

get_adaptive_num_workers([num_dataloader])

Measure appropriate num_workers value and return it.

get_idx_list_per_classes(dm_dataset[, ...])

Compute class statistics.

import_object_from_module(obj_path)

Get object from import format string.

is_ckpt_for_finetuning(ckpt)

Check the checkpoint will be used to finetune.

is_ckpt_from_otx_v1(ckpt)

Check the checkpoint where it comes from.

remove_state_dict_prefix(state_dict, prefix)

Remove prefix from state_dict keys.

otx.core.utils.utils.get_adaptive_num_workers(num_dataloader: int = 1) int | None[source]#

Measure appropriate num_workers value and return it.

otx.core.utils.utils.get_idx_list_per_classes(dm_dataset: DmDataset, use_string_label: bool = False) dict[int | str, list[int]][source]#

Compute class statistics.

otx.core.utils.utils.import_object_from_module(obj_path: str) Any[source]#

Get object from import format string.

otx.core.utils.utils.is_ckpt_for_finetuning(ckpt: dict) bool[source]#

Check the checkpoint will be used to finetune.

Parameters:

ckpt (dict) – the checkpoint file

Returns:

True means the checkpoint will be used to finetune.

Return type:

bool

otx.core.utils.utils.is_ckpt_from_otx_v1(ckpt: dict) bool[source]#

Check the checkpoint where it comes from.

Parameters:

ckpt (dict) – the checkpoint file

Returns:

True means the checkpoint comes from otx1

Return type:

bool

otx.core.utils.utils.remove_state_dict_prefix(state_dict: dict[str, Any], prefix: str) dict[str, Any][source]#

Remove prefix from state_dict keys.