pyphoon.visualise

class pyphoon.visualise.DisplaySequence(images, images_ids, interval=100, start_frame=0, end_frame=None, show_title=True, alt_title=None)

Bases: object

Animates a sequence of images. Mainly to be used to display a typhoon sequence temporal evolution.

Parameters:
  • images (list) – List with image arrays. Each element of the list must be an array of 2 dimensions.
  • images_ids (list) – List of the ids of the elements in the list images.
  • interval (int) – Interval between frames while visualizing the animation.
  • start_frame (int) – First image frame of the list to visualize.
  • end_frame (int) – Last image frame of the list to visualize.
  • show_title (bool) – Set to false if no title should be shown in the figure.
run(save=False, filename='untitled')

Runs the animation

run_html()

Runs the animation

class pyphoon.visualise.DisplayPredictedLabeledSequence(images, images_ids, predictions, ground_truth, interval=100, start_frame=0, end_frame=None, show_title=True, alt_title=None)

Bases: pyphoon.visualise.DisplaySequence

Animates a sequence of images and provides a visualisation of the network prediction. To be used to display a typhoon sequence temporal evolution. Currently, only working for binary predictions (0, 1).

Parameters:
  • images (list) – List with image arrays. Each element of the list must be an array of 2 dimensions.
  • images_ids (list) – List of the ids of the elements in the list images.
  • predictions (Network predictions for samples in images. Note that this list should only contain ‘0’ and ‘1’.) – list
  • ground_truth (list) – Ground truth labels for samples in images. Note that this list should only contain ‘0’ and ‘1’.
  • interval (int) – Interval between frames while visualizing the animation.
  • start_frame (int) – First image frame of the list to visualize.
  • end_frame (int) – Last image frame of the list to visualize.
  • show_title (bool) – Set to false if no title should be shown in the figure.
pyphoon.visualise.nice_imshow(ax, X, colorbar=False, vmin=None, vmax=None, cmap=None, barsize=None)

Wrapper around plt.imshow. Code from here.

Parameters:
  • ax (matplotlib.axes.Axes instance) – Plot axis.
  • X (numpy.array) – 2D image array.
  • colorbar
  • vmin (float) – Minimum value in the bar.
  • vmax (float) – Maximum value in the bar.
  • cmap – If None, default to rc image.cmap value. cmap is ignored if X is 3-D, directly specifying RGB(A) values.
  • barsize (float or str) – Tick label font size in points or as a string (e.g., ‘large’).
pyphoon.visualise.make_mosaic(imgs, nrows, ncols, border=1)

Given a set of images with all the same shape, makes a mosaic with nrows and ncols

Parameters:
  • imgs (numpy.array) – Array of shape (N, W, H), where N: #images, W: width and H: height.
  • nrows (int) – Number of rows in the plot grid.
  • ncols (int) – Number of columns in the plot grid.
  • border (int or float.) – padding between images.
Returns: