peal.data.dataset_generators.SquareDatasetGenerator

class peal.data.dataset_generators.SquareDatasetGenerator[source]

Bases: object

Synthetic 64x64 “square” dataset with four independent binary factors.

Sample i gets ClassA = i % 2 (inner square bright/dark red), ClassB = (i // 2) % 2 (background bright/dark), ClassC and ClassD (square in the lower/upper half in x and y). The continuous factors are stored as ColorA, ColorB, PositionX, PositionY. Every sample also gets an _inverse twin with inverted background colour and the same noise, and a mask of the inner square is written for both.

Parameters:

data_config (DataConfig) – Supplies dataset_path and num_samples.

Methods

generate_dataset

Write imgs/, masks/ and data.csv for the dataset and its _inverse twin (<dataset_path>_inverse).

__init__(data_config, **kwargs)[source]

Store the data config; nothing is written until generate_dataset.

generate_dataset()[source]

Write imgs/, masks/ and data.csv for the dataset and its _inverse twin (<dataset_path>_inverse).

Existing folders are moved aside with a timestamp suffix; the csv is rewritten every 100 samples.