otx.algo.anomaly#

Module for anomaly OTX Models.

Classes

Padim([label_info, backbone, layers, ...])

OTX Padim model.

Stfpm([label_info, layers, backbone, task, ...])

OTX STFPM model.

class otx.algo.anomaly.Padim(label_info: LabelInfoTypes = AnomalyLabelInfo(label_names=['Normal', 'Anomaly'], label_ids=['0', '1'], label_groups=[['Normal', 'Anomaly']]), backbone: str = 'resnet18', layers: list[str] = ['layer1', 'layer2', 'layer3'], pre_trained: bool = True, n_features: int | None = None, task: Literal[OTXTaskType.ANOMALY, OTXTaskType.ANOMALY_CLASSIFICATION, OTXTaskType.ANOMALY_DETECTION, OTXTaskType.ANOMALY_SEGMENTATION] = OTXTaskType.ANOMALY_CLASSIFICATION, input_size: tuple[int, int] = (256, 256))[source]#

Bases: AnomalyMixin, Padim, OTXAnomaly

OTX Padim model.

Parameters:
  • backbone (str, optional) – Feature extractor backbone. Defaults to “resnet18”.

  • layers (list[str], optional) – Feature extractor layers. Defaults to [“layer1”, “layer2”, “layer3”].

  • pre_trained (bool, optional) – Pretrained backbone. Defaults to True.

  • n_features (int | None, optional) – Number of features. Defaults to None.

  • (Literal[ (task) – OTXTaskType.ANOMALY_CLASSIFICATION, OTXTaskType.ANOMALY_DETECTION, OTXTaskType.ANOMALY_SEGMENTATION ], optional): Task type of Anomaly Task. Defaults to OTXTaskType.ANOMALY_CLASSIFICATION.

  • input_size (tuple[int, int], optional) – Model input size in the order of height and width. Defaults to (256, 256)

class otx.algo.anomaly.Stfpm(label_info: LabelInfoTypes = AnomalyLabelInfo(label_names=['Normal', 'Anomaly'], label_ids=['0', '1'], label_groups=[['Normal', 'Anomaly']]), layers: Sequence[str] = ['layer1', 'layer2', 'layer3'], backbone: str = 'resnet18', task: Literal[OTXTaskType.ANOMALY, OTXTaskType.ANOMALY_CLASSIFICATION, OTXTaskType.ANOMALY_DETECTION, OTXTaskType.ANOMALY_SEGMENTATION] = OTXTaskType.ANOMALY_CLASSIFICATION, input_size: tuple[int, int] = (256, 256), **kwargs)[source]#

Bases: AnomalyMixin, Stfpm, OTXAnomaly

OTX STFPM model.

Parameters:
  • layers (Sequence[str]) – Feature extractor layers.

  • backbone (str, optional) – Feature extractor backbone. Defaults to “resnet18”.

  • (Literal[ (task) – OTXTaskType.ANOMALY_CLASSIFICATION, OTXTaskType.ANOMALY_DETECTION, OTXTaskType.ANOMALY_SEGMENTATION ], optional): Task type of Anomaly Task. Defaults to OTXTaskType.ANOMALY_CLASSIFICATION.

  • input_size (tuple[int, int], optional) – Model input size in the order of height and width. Defaults to (256, 256)