lagom.vis: Visualization

class lagom.vis.ImageViewer(max_width=500)[source]

Display an image from an RGB array in an OpenGL window.

Example:

imageviewer = ImageViewer(max_width=500)
image = np.asarray(Image.open('x.jpg'))
imageviewer(image)
__call__(x)[source]

Create an image from the given RGB array and display to the window.

Parameters:x (ndarray) – RGB array
close()[source]

Close the Window.

class lagom.vis.GridImage(ncol=8, padding=2, pad_value=0)[source]

Generate a grid of images. The images can be iteratively added.

Example:

grid = GridImage(ncol=8, padding=5, pad_value=0)

a = np.random.randint(0, 255+1, size=[10, 3, 64, 64])
grid.add(a)
grid()

Reference:

Parameters:
  • ncol (int, optional) – Number of images to show in each row of the grid. Final grid size is [N/ncol, ncol]. Default: 8.
  • padding (int, optional) – Number of paddings. Default: 2.
  • pad_value (float, optional) – Padding value in the range [0, 255]. Black is 0 and white 255. Default: 0
__call__(**kwargs)[source]

Make grid of images.

Parameters:**kwargs – keyword aguments used to specify the grid of images.
Returns:a grid of image with shape [H, W, C] and dtype np.uint8
Return type:Image
add(x)[source]

Add a new data for making grid images.

Parameters:x (list/ndarray) – a list or ndarray of images, with shape either [H, W], [C, H, W] or [N, C, H, W]
lagom.vis.set_ticker(ax, axis='x', num=None, KM_format=False, integer=False)[source]
lagom.vis.read_xy(log_folder, file_name, get_x, get_y, smooth_out=False, smooth_kws=None, point_step=1)[source]