Base Dataset#

Anomalib dataset base class.

class anomalib.data.base.dataset.AnomalibDataset(task, transform)#

Bases: Dataset, ABC

Anomalib dataset.

Parameters:
  • task (str) – Task type, either ‘classification’ or ‘segmentation’

  • transform (A.Compose) – Albumentations Compose object describing the transforms that are applied to the inputs.

property has_anomalous: bool#

Check if the dataset contains any anomalous samples.

property has_normal: bool#

Check if the dataset contains any normal samples.

property is_setup: bool#

Checks if setup() been called.

property samples: DataFrame#

Get the samples dataframe.

setup()#

Load data/metadata into memory.

Return type:

None

subsample(indices, inplace=False)#

Subsamples the dataset at the provided indices.

Parameters:
  • indices (Sequence[int]) – Indices at which the dataset is to be subsampled.

  • inplace (bool) – When true, the subsampling will be performed on the instance itself. Defaults to False.

Return type:

AnomalibDataset