Utils#

Collection of utils for task implementation in Detection Task.

otx.algorithms.detection.utils.format_list_to_str(value_lists: list)#

Decrease floating point digits in logs.

otx.algorithms.detection.utils.generate_label_schema(label_names: Sequence[str], label_domain: Domain = Domain.DETECTION)#

Generating label_schema function.

otx.algorithms.detection.utils.get_anchor_boxes(wh_stats: List[tuple], group_as: List[int])#

Get anchor box widths & heights.

otx.algorithms.detection.utils.get_det_model_api_configuration(label_schema: LabelSchemaEntity, task_type: TaskType, confidence_threshold: float)#

Get ModelAPI config.

otx.algorithms.detection.utils.get_sizes_from_dataset_entity(dataset: DatasetEntity, target_wh: List[int])#

Function to get sizes of instances in DatasetEntity and to resize it to the target size.

Parameters:
  • dataset – DatasetEntity in which to get statistics

  • target_wh – target width and height of the dataset

Return list:

tuples with width and height of each instance

otx.algorithms.detection.utils.load_dataset_items_coco_format(ann_file_path: str, data_root_dir: str, domain: Domain, subset: Subset = Subset.NONE, labels_list: Optional[List[LabelEntity]] = None, with_mask: bool = False)#

Load dataset from CocoDataset.