incerto.data.CorruptedDataOOD#

class incerto.data.CorruptedDataOOD(dataset, corruption_type='gaussian_noise', severity=0.5)[source]#

Bases: OODBenchmark

Create OOD benchmark using corrupted versions of ID data.

Applies various corruptions (noise, blur, etc.) to create OOD samples.

Parameters:
__init__(dataset, corruption_type='gaussian_noise', severity=0.5)[source]#

Initialize corrupted data OOD benchmark.

Parameters:
  • dataset (Dataset) – Base dataset

  • corruption_type (str) – Type of corruption to apply

  • severity (float) – Corruption severity (0-1)

Methods

__init__(dataset[, corruption_type, severity])

Initialize corrupted data OOD benchmark.

apply_corruption(image)

Apply corruption to image.

get_datasets()

Get ID (clean) and OOD (corrupted) datasets.

__init__(dataset, corruption_type='gaussian_noise', severity=0.5)[source]#

Initialize corrupted data OOD benchmark.

Parameters:
  • dataset (Dataset) – Base dataset

  • corruption_type (str) – Type of corruption to apply

  • severity (float) – Corruption severity (0-1)

apply_corruption(image)[source]#

Apply corruption to image.

Parameters:

image (Tensor)

Return type:

Tensor

get_datasets()[source]#

Get ID (clean) and OOD (corrupted) datasets.

Return type:

Tuple[Dataset, Dataset]