trw.datasets.dataset_fake_symbols
¶
Module Contents¶
Functions¶
|
|
|
|
|
|
|
|
|
Create artificial 2D for classification and segmentation problems |
- trw.datasets.dataset_fake_symbols._noisy(image, noise_type)¶
- Parameters
image – a numpy image (float) in range [0..255]
noise_type – the type of noise. Must be one of:
noise. (* 'gauss' Gaussian-distributed additive) –
data. (* 'poisson' Poisson-distributed noise generated from the) –
1. (* 's&p' Replaces random pixels with 0 or) –
n*image (* 'speckle' Multiplicative noise using out = image +) – uniform noise with specified mean & variance
is (where n) – uniform noise with specified mean & variance
- Returns
noisy image
- trw.datasets.dataset_fake_symbols._random_location(image_shape, figure_shape)¶
- trw.datasets.dataset_fake_symbols._random_color()¶
- trw.datasets.dataset_fake_symbols._add_shape(imag, mask, shape, shapes_added, scale_factor, color, min_overlap_distance=30)¶
- trw.datasets.dataset_fake_symbols._create_image(shape, objects, nb_classes_at_once=None, max_classes=None, background=255)¶
- Parameters
shape – the shape of an image [height, width]
nb_classes_at_once – the number of classes to be included in each sample. If None, all the classes will be included
max_classes – the maximum number of classes to be used. If None, all classes can be used, else a random subset
- Returns
image, mask and shape information
- trw.datasets.dataset_fake_symbols.create_fake_symbols_datasset(nb_samples, image_shape, dataset_name, shapes_fn, 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'), max_classes=None, batch_size=64, background=255)¶
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