trw.datasets.dataset_fake_symbols_3d

Module Contents

Functions

_add_square_3d(imag, mask, shapes_added, scale_factor)

_add_rectangle_3d(imag, mask, shapes_added, scale_factor)

default_shapes_3d(global_scale_factor=1.0)

create_fake_symbols_3d_dataset(nb_samples: int, image_shape: trw.basic_typing.ShapeX, ratio_valid: float = 0.2, nb_classes_at_once: Optional[int] = None, global_scale_factor: float = 1.0, normalize_0_1: bool = True, noise_fn: Callable[[numpy.ndarray], numpy.ndarray] = functools.partial(_noisy, noise_type='poisson'), shapes_fn: trw.datasets.dataset_fake_symbols.ShapeCreator = default_shapes_3d, max_classes: Optional[int] = None, batch_size: int = 64, background: int = 255, dataset_name: str = 'fake_symbols_3d') → trw.basic_typing.Datasets

Create artificial 2D for classification and segmentation problems

trw.datasets.dataset_fake_symbols_3d._add_square_3d(imag, mask, shapes_added, scale_factor)
trw.datasets.dataset_fake_symbols_3d._add_rectangle_3d(imag, mask, shapes_added, scale_factor)
trw.datasets.dataset_fake_symbols_3d.default_shapes_3d(global_scale_factor=1.0)
trw.datasets.dataset_fake_symbols_3d.create_fake_symbols_3d_dataset(nb_samples: int, image_shape: trw.basic_typing.ShapeX, ratio_valid: float = 0.2, nb_classes_at_once: Optional[int] = None, global_scale_factor: float = 1.0, normalize_0_1: bool = True, noise_fn: Callable[[numpy.ndarray], numpy.ndarray] = functools.partial(_noisy, noise_type='poisson'), shapes_fn: trw.datasets.dataset_fake_symbols.ShapeCreator = default_shapes_3d, max_classes: Optional[int] = None, batch_size: int = 64, background: int = 255, dataset_name: str = 'fake_symbols_3d') trw.basic_typing.Datasets

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