peal.data.custom_datasets.NicoPlusPlusDataset

class peal.data.custom_datasets.NicoPlusPlusDataset[source]

Bases: Image2MixedDataset

NICO++ subset in which the object category is confounded by its context.

NICO++ has to be downloaded manually to $PEAL_DATA/NICO++.zip; if it is missing, an empty skeleton is created and a RuntimeError with the download instructions is raised. Otherwise the nested NICO_DG_Benchmark.zip is read into memory and only those images are extracted whose category is in config.foreground (default bear, dog) and whose context is in config.background (default grass, water). They are written to imgs/<category>_<context>_<counter>.jpg and listed in data.csv as img, label, confounder with the positions in those two lists as indices.

Parameters:
  • config (DataConfig) – Uses dataset_path, foreground and background.

  • **kwargs – Forwarded to Image2MixedDataset.

Raises:
  • RuntimeError – If the zip is missing, or if it contains no matching image.

  • FileNotFoundError – If the nested benchmark zip cannot be found inside NICO++.zip.

Methods

Attributes

__init__(config, **kwargs)[source]

Extract the configured category/context subset if data.csv is missing.