peal.data.dataset_generators.SparseNumbersDatasetGenerator¶
- class peal.data.dataset_generators.SparseNumbersDatasetGenerator[source]¶
Bases:
objectGenerates a dataset of images with a 2x4 grid of 4-digit numbers. Resolution: 128x128. Grid: 2 columns, 4 rows. Numbers: 0000-9999, each appears 50 times in the dataset. Occupancy: Each slot has a 50% chance of being present (500,000 total numbers in 125,000 samples). Background: Variable red intensity (white to red). Foreground: Black numbers.
Methods
Generates the sparse_numbers dataset.
- __init__(data_config, **kwargs)[source]¶
- Parameters:
data_config (
DataConfig) – Suppliesdataset_path,num_samples(default 125000) andoutput_split(number of distinct numbers, default 10000).**kwargs –
font_pathoverrides the DejaVu Sans TrueType font.
- generate_dataset()[source]¶
Generates the sparse_numbers dataset.
Writes
imgs/<i:06d>.pnganddata.csvwith columnsimgs, Red1..Red8(background red intensity per slot) andNum1..Num8(number per slot, -1 if empty) todata_config.dataset_path; an existing folder is moved aside with a timestamp suffix. Uses the globalrandommodule (unseeded).