trw.datasets.dataset_fake_symbols_2d

Module Contents

Functions

_add_square(imag, mask, shapes_added, scale_factor)

_add_rectangle(imag, mask, shapes_added, scale_factor)

_add_cross(imag, mask, shapes_added, scale_factor)

_add_triangle(imag, mask, shapes_added, scale_factor)

_add_circle(imag, mask, shapes_added, scale_factor)

default_shapes_2d(global_scale_factor=1.0)

create_fake_symbols_2d_datasset(nb_samples, image_shape, ratio_valid=0.2, nb_classes_at_once=None, global_scale_factor=1.0, normalize_0_1=True, noise_fn=functools.partial(_noisy, noise_type='poisson'), shapes_fn=default_shapes_2d, max_classes=None, batch_size=64, background=255, dataset_name='fake_symbols_2d')

Create artificial 2D for classification and segmentation problems

trw.datasets.dataset_fake_symbols_2d._add_square(imag, mask, shapes_added, scale_factor)
trw.datasets.dataset_fake_symbols_2d._add_rectangle(imag, mask, shapes_added, scale_factor)
trw.datasets.dataset_fake_symbols_2d._add_cross(imag, mask, shapes_added, scale_factor)
trw.datasets.dataset_fake_symbols_2d._add_triangle(imag, mask, shapes_added, scale_factor)
trw.datasets.dataset_fake_symbols_2d._add_circle(imag, mask, shapes_added, scale_factor)
trw.datasets.dataset_fake_symbols_2d.default_shapes_2d(global_scale_factor=1.0)
trw.datasets.dataset_fake_symbols_2d.create_fake_symbols_2d_datasset(nb_samples, image_shape, ratio_valid=0.2, nb_classes_at_once=None, global_scale_factor=1.0, normalize_0_1=True, noise_fn=functools.partial(_noisy, noise_type='poisson'), shapes_fn=default_shapes_2d, max_classes=None, batch_size=64, background=255, dataset_name='fake_symbols_2d')

Create artificial 2D for classification and segmentation problems

This dataset will randomly create shapes at random location & color with a segmentation map.

Parameters
  • nb_samples – the number of samples to be generated

  • image_shape – the shape of an image [height, width]

  • ratio_valid – the ratio of samples to be used for the validation split

  • nb_classes_at_once – the number of classes to be included in each sample. If None, all the classes will be included

  • global_scale_factor – the scale of the shapes to generate

  • noise_fn – a function to create noise in the image

  • shapes_fn – the function to create the different shapes

  • normalize_0_1 – if True, the data will be normalized (i.e., image & position will be in range [0..1])

  • max_classes – the total number of classes available

  • batch_size – the size of the batch for the dataset

  • background – the background value of the sample (before normalization if normalize_0_1 is True)

  • dataset_name – the name of the returned dataset

Returns

a dict containing the dataset fake_symbols_2d with train and valid splits with features image, mask, classification, <shape_name>_center