dival.datasets.ellipses_dataset module

Provides EllipsesDataset.

class dival.datasets.ellipses_dataset.EllipsesDataset(image_size=128, min_pt=None, max_pt=None, train_len=32000, validation_len=3200, test_len=3200, fixed_seeds=False)[source]

Bases: dival.datasets.dataset.GroundTruthDataset

Dataset with images of multiple random ellipses.

This dataset uses odl.phantom.ellipsoid_phantom() to create the images. The images are normalized to have a value range of [0., 1.] with a background value of 0..

space

odl.uniform_discr(min_pt, max_pt, (image_size, image_size), dtype='float32'), with the parameters passed to __init__().

shape

(image_size, image_size), with image_size parameter passed to __init__(). Default (128, 128).

train_len

train_len parameter passed to __init__(). Default 32000.

validation_len

validation_len parameter passed to __init__(). Default 3200.

test_len

test_len parameter passed to __init__(). Default 3200.

random_access

False

num_elements_per_sample

1

__init__(image_size=128, min_pt=None, max_pt=None, train_len=32000, validation_len=3200, test_len=3200, fixed_seeds=False)[source]
Parameters
  • image_size (int, optional) – Number of pixels per image dimension. Default: 128.

  • min_pt ([int, int], optional) – Minimum values of the lp space. Default: [-image_size/2, -image_size/2].

  • max_pt ([int, int], optional) – Maximum values of the lp space. Default: [image_size/2, image_size/2].

  • train_len (int or None, optional) – Length of training set. Default: 32000. If None, infinitely many samples could be generated.

  • validation_len (int, optional) – Length of training set. Default: 3200.

  • test_len (int, optional) – Length of test set. Default: 3200.

  • fixed_seeds (dict or bool, optional) – Seeds to use for random generation. The values of the keys 'train', 'validation' and 'test' are used. If a seed is None or omitted, it is choosen randomly. If True is passed, the seeds fixed_seeds={'train': 42, 'validation': 2, 'test': 1} are used. If False is passed (the default), all seeds are chosen randomly.

generator(part='train')[source]

Yield random ellipse phantom images using odl.phantom.ellipsoid_phantom().

Parameters

part ({'train', 'validation', 'test'}, optional) – The data part. Default is 'train'.

Yields

image (element of space) – Random ellipse phantom image with values in [0., 1.].