pe.callback.image package

Submodules

pe.callback.image.sample_images module

class pe.callback.image.sample_images.SampleImages(num_images_per_class=10)[source]

Bases: Callback

The callback that samples images from the synthetic data.

__call__(syn_data)[source]

This function is called after each PE iteration that samples images from the synthetic data.

Parameters:

syn_data (pe.data.data.Data) – The pe.data.data.Data object of the synthetic data

Returns:

A metric item with the list of sampled images

Return type:

list[pe.metric_item.ImageListMetricItem]

__init__(num_images_per_class=10)[source]

Constructor.

Parameters:

num_images_per_class (int, optional) – number of images to sample per class, defaults to 10

pe.callback.image.save_all_images module

class pe.callback.image.save_all_images.SaveAllImages(output_folder, path_format='{iteration:09d}/{label_id}_{label_name}/{index}.png', tqdm_enabled=True)[source]

Bases: Callback

The callback that saves all images.

__call__(syn_data)[source]

This function is called after each PE iteration that saves all images.

Parameters:

syn_data (pe.data.data.Data) – The pe.data.data.Data object of the synthetic data

__init__(output_folder, path_format='{iteration:09d}/{label_id}_{label_name}/{index}.png', tqdm_enabled=True)[source]

Constructor.

Parameters:
  • output_folder (str) – The output folder that will be used to save the images

  • path_format (str, optional) – The format of the image paths, defaults to “{iteration:09d}/{label_id}_{label_name}/{index}.png”

  • tqdm_enabled (bool, optional) – Whether to show tqdm progress bar when saving the images, defaults to True

_save_image(image, label_name, label_id, index, iteration)[source]

A helper function that saves an image.