import numpy as np META = { "name": "euler_morphology_denoising", "domain": "vision", "description": "Synthetic binary-shape image denoising with spatial topology in the clean target." } def get_dataset(seed, n_train, n_test): rng = np.random.RandomState(seed) h = w = 16 yy, xx = np.mgrid[:h, :w] def make(n): clean = np.zeros((n, 1, h, w), dtype=np.float32) for i in range(n): if rng.rand() < 0.5: cx, cy = rng.uniform(3, 13, 2) r = rng.uniform(2.0, 4.5) clean[i, 0] = (((xx-cx)**2 + (yy-cy)**2) <= r*r) else: x0, y0 = rng.randint(1, 10, 2) bw, bh = rng.randint(3, 7, 2) clean[i, 0, y0:y0+bh, x0:x0+bw] = 1.0 if rng.rand() < 0.25: cx, cy = rng.uniform(3, 13, 2) r = rng.uniform(1.2, 2.5) blob = (((xx-cx)**2 + (yy-cy)**2) <= r*r) clean[i, 0] = np.maximum(clean[i, 0], blob) noisy = np.clip(clean + rng.normal(0, 0.28, clean.shape), 0, 1) return noisy.astype(np.float32), clean xtr, ytr = make(n_train) xte, yte = make(n_test) return {"xtr": xtr, "ytr": ytr, "xte": xte, "yte": yte, "task": "regression", "metric": "mse", "out_dim": 1}