learnergy.visual.image¶
Image-related visualization.
- learnergy.visual.image._rasterize(x: numpy.array, img_shape: Tuple[int, int], tile_shape: Tuple[int, int], tile_spacing: Optional[Tuple[int, int]] = (0, 0), scale: Optional[bool] = True, output: Optional[bool] = True)¶
Rasterizes and prepares an image to be outputted as a mosaic.
- Parameters
x – An input array to be rasterized.
img_shape – A tuple for the image shape.
tile_shape – A tuple holding the shape of each tile.
tile_spacing – A tuple containing the spacing between tiles.
scale – If output array should be scaled between 0 and 1.
output – If output values should be returned as pixels or not.
- Returns
Rasterized version of input array.
- Return type
(np.array)
- learnergy.visual.image.create_mosaic(tensor: torch.Tensor)¶
Creates a mosaic from a tensor using Pillow.
- Parameters
tensor – An input tensor to have its mosaic created.
- learnergy.visual.image.create_rgb_mosaic(tensor: torch.Tensor, n_samples: Optional[int] = 1)¶
Creates a squared mosaic for RGB images.
- Parameters
tensor – An input tensor to have its mosaic created.
n_samples – The amount of samples to be plotted (width or height).