peal.data.dataset_generators.latent_to_square_image

peal.data.dataset_generators.latent_to_square_image(color_a, color_b, position_x=None, position_y=None, SIZE_INNER=8, SIZE_BORDER=2, noise=None)[source]

Render one 64x64 “square” image from its generative factors.

The background is a grey level color_b, a grey border square of intensity 127 is placed at (position_x, position_y) and its inner SIZE_INNER square is filled with red intensity color_a (green and blue 0). Gaussian noise (std 20) is added to everything.

Parameters:
  • color_a (int) – Red intensity of the inner square, 0-255.

  • color_b (int) – Grey level of the background, 0-255.

  • position_x (int, optional) – Top-left corner of the bordered square; centred when None.

  • position_y (int, optional) – Top-left corner of the bordered square; centred when None.

  • SIZE_INNER (int) – Inner square side and border width in pixels.

  • SIZE_BORDER (int) – Inner square side and border width in pixels.

  • noise (numpy.ndarray, optional) – Noise of shape (64, 64, 3) to reuse (for an _inverse twin); drawn fresh when None.

Returns:

  • img (PIL.Image.Image) – The rendered RGB image.

  • noise (numpy.ndarray) – The noise that was used.