peal.data.interfaces.DataConfig¶
- class peal.data.interfaces.DataConfig[source]¶
Bases:
BaseModelPydantic description of a dataset, loadable from yaml.
The individual fields are documented by the string literals that precede them in the source. The fields without such a literal configure diffusion based data augmentation and are consumed by
dataset_factoryandpeal.data.transformations.DiffusionAugmentation.- Parameters:
generator (
strorobjectorNone) – Generator (config path, config or instance) used for augmentation.diffusion_augmented (
bool) – IfTruethe training transform noises every sample withgeneratorand denoises it again (a stochastic augmentation).sampling_time_fraction (
float) – Fraction of the diffusion schedule to noise to (default 0.3).num_discretization_steps (
int) – Number of denoising steps used by the augmentation (default 20).batch_wise_augmentation (
bool) – IfTrue(default) the per-sampleDiffusionAugmentationtransform is not added to the dataset; augmentation is expected to be applied to whole batches elsewhere.
Methods
Attributes
The background contexts to use for the experiment.
The ratio of the classes in the dataset.
The type of config.
The correlation strength of the target and the confounding variable.
A pair of known confounding factors, one usually being the target.
The number of classes in the dataset.
The name of the dataset.
The path of the original dataset.
The path to the dataset.
The delimiter used for the csv file.
The way how to downsize an sample if required.
The path to the font file.
The foreground categories to use for the experiment.
alternative to confounder_probability, specify individual group sizes, e.g. [0.25, 0.25, 0.25, 0.25].
Whether the dataset contains spatial annotations where the true feature is.
Whether to load all datasets into the RAM or not.
The input size of data.
The input type of the data: Options: ['image', 'sequence', 'symbolic']
A list of the invariances exploited for data augmentation: Options: ['hflipping', 'vflipping', 'rotation', 'circlecut']
The path of the original dataset.
The label noise of a generated dataset.
Where the label path is relative to the dataset path.
The applied normalization.
The number of samples in the dataset.
The output size of the model.
The number of binary multiclass variables in the mixed setting.
The output type of the data.
The seed the dataset was generated with.
Whether to set negative values to zero.
The split between train, validation and test set.
Whether to re-balance group sizes after dropping samples without a spray label
Path to spray label csv file.
List of preprocessing methods to apply to tabular datasets.
The name of the folder where the images are stored.
- config_name: str = 'DataConfig'¶
The type of config. This is necessary to find config class from yaml config
- output_type: str = 'singleclass'¶
The output type of the data. Options: [‘singleclass’, ‘multiclass’, ‘continuous’, ‘mixed’] ‘mixed’ is a hybrid between binary multiclass classification and continuous and requires ‘output_split’ to be set
- input_size: list[pydantic.PositiveInt] = [3, 128, 128]¶
The input size of data. For images: [Channels, Height, Width] For sequences: [MaxLength, NumTokens] For symbolic: [NumVariables]
- output_size: list[pydantic.PositiveInt] = [2]¶
The output size of the model. For singleclass: [NumClasses] For multiclass: [NumBinaryClasses] For continuous: [NumVariables] For mixed: [NumBinaryClasses + NumVariables]
- num_samples: None | int = None¶
The number of samples in the dataset. Sometimes important when executing specific experiments.
- dataset_class: None | str = None¶
The name of the dataset. Only necessary to tell dataset factory which customized dataset class to use
- has_hints: None | bool = False¶
Whether the dataset contains spatial annotations where the true feature is.
- invariances: list[str] = []¶
A list of the invariances exploited for data augmentation: Options: [‘hflipping’, ‘vflipping’, ‘rotation’, ‘circlecut’]
- output_split: None | int = None¶
The number of binary multiclass variables in the mixed setting. Has to be smaller than output_size.
- downsize: None | str = None¶
The way how to downsize an sample if required. Options: [‘Downsample’, ‘RandomCrop’, ‘CenterCrop’]
- confounding_factors: None | list[str] = []¶
A pair of known confounding factors, one usually being the target. This knowledge helps for controlled sampling of confounders for experiments.
- confounder_probability: None | float = None¶
The correlation strength of the target and the confounding variable.
- full_confounder_config: None | list[float] = None¶
alternative to confounder_probability, specify individual group sizes, e.g. [0.25, 0.25, 0.25, 0.25]
- seed: None | int = 0¶
The seed the dataset was generated with. Only relevant for generated datasets!
- label_noise: None | float = None¶
The label noise of a generated dataset. Necessary to mimic real dataset behauviour and avoid trivial non-robust solutions.
- x_selection: str = 'imgs'¶
The name of the folder where the images are stored. The header of the column in the underlying csv either has to be called like this as well or the path to the images has to be in the first column.
- in_memory: bool = False¶
Whether to load all datasets into the RAM or not. Careful with big datasets!
- spray_label_file: str | None = None¶
Path to spray label csv file. When set, use spray labels instead of true confounder labels. Samples without a spray label will be dropped