otx.algorithms.detection.adapters.mmdet#

OTX Adapters - mmdet.

Classes

OTXDetDataset(otx_dataset, labels, pipeline)

Wrapper that allows using a OTX dataset to train mmdetection models.

class otx.algorithms.detection.adapters.mmdet.OTXDetDataset(otx_dataset: DatasetEntity, labels: List[LabelEntity], pipeline: Sequence[dict], test_mode: bool = False, **kwargs)[source]#

Bases: CustomDataset

Wrapper that allows using a OTX dataset to train mmdetection models.

This wrapper is not based on the filesystem, but instead loads the items here directly from the OTX DatasetEntity object.

The wrapper overwrites some methods of the CustomDataset class: prepare_train_img, prepare_test_img and prepipeline Naming of certain attributes might seem a bit peculiar but this is due to the conventions set in CustomDataset. For instance, CustomDatasets expects the dataset items to be stored in the attribute data_infos, which is why it is named like that and not dataset_items.

evaluate(results, metric='mAP', logger=None, proposal_nums=(100, 300, 1000), iou_thr=0.5, scale_ranges=None)[source]#

Evaluate the dataset.

Parameters:
  • results (list) – Testing results of the dataset.

  • metric (str | list[str]) – Metrics to be evaluated.

  • logger (logging.Logger | None | str) – Logger used for printing related information during evaluation. Default: None.

  • proposal_nums (Sequence[int]) – Proposal number used for evaluating recalls, such as recall@100, recall@1000. Default: (100, 300, 1000).

  • iou_thr (float | list[float]) – IoU threshold. Default: 0.5.

  • scale_ranges (list[tuple] | None) – Scale ranges for evaluating mAP. Default: None.

get_ann_info(idx: int)[source]#

This method is used for evaluation of predictions.

The CustomDataset class implements a method CustomDataset.evaluate, which uses the class method get_ann_info to retrieve annotations.

Parameters:

idx – index of the dataset item for which to get the annotations

Return ann_info:

dict that contains the coordinates of the bboxes and their corresponding labels

static pre_pipeline(results: Dict[str, Any])[source]#

Prepare results dict for pipeline. Add expected keys to the dict.

prepare_test_img(idx: int) dict[source]#

Get testing data after pipeline.

Parameters:

idx – int, Index of data.

Return dict:

Testing data after pipeline with new keys introduced by pipeline.

prepare_train_img(idx: int) dict[source]#

Get training data and annotations after pipeline.

Parameters:

idx – int, Index of data.

Return dict:

Training data and annotation after pipeline with new keys introduced by pipeline.

Modules

otx.algorithms.detection.adapters.mmdet.models

Initial file for mmdetection models.