visualisation¶
image generation functions
Functions¶
|
plots an insertion/deletion curve of a responsibility map |
|
plots a 3d grid in matplotlib given an image <path> |
|
Copy colormap and set alpha values |
|
|
|
|
|
plots a 3d surface plot |
|
|
|
Remove the background from the responsibility map if set in the Data object |
|
Plot a 3D voxel plot of the responsibility map using plotly. |
|
|
|
Generate n evenly spaced RGB colours from a matplotlib colourmap. |
|
Creates a composite mask from a list of masks. |
|
Draws the boundaries of the explanations on the image, using the provided colours. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Plot a grid of images |
Module Contents¶
- visualisation.plot_curve(curve, chunk_size, style='insertion', destination=None)¶
plots an insertion/deletion curve of a responsibility map
- visualisation.plot_3d(input, ranking, ogrid, norm=255.0)¶
plots a 3d grid in matplotlib given an image <path> If <path> is greyscale or RGBA, it is converted to RGB for plotting.
- visualisation._transparent_cmap(cmap, N=255)¶
Copy colormap and set alpha values
- visualisation.heatmap_plot(data, resp_map, colour, path=None)¶
- Parameters:
data (rex_xai.input.input_data.Data)
- visualisation.spectral_plot(explanation, data, ranking, colour, extra=True, path=None)¶
- Parameters:
data (rex_xai.input.input_data.Data)
- visualisation.surface_plot(input, args, resp_map, target, path=None)¶
plots a 3d surface plot
- Parameters:
args (rex_xai.input.config.CausalArgs)
resp_map (numpy.ndarray)
target (rex_xai.responsibility.prediction.Prediction)
- visualisation.overlay_grid(img, step_count=10)¶
- visualisation.remove_background(data, resp_map)¶
Remove the background from the responsibility map if set in the Data object
- Parameters:
data (rex_xai.input.input_data.Data)
resp_map (numpy.ndarray)
- Return type:
numpy.ndarray
- visualisation.voxel_plot(args, resp_map, data, path=None)¶
Plot a 3D voxel plot of the responsibility map using plotly. - Assumes the data is greyscale Produces an interactive 3D plot of the data and the responsibility map.
- Parameters:
args (rex_xai.input.config.CausalArgs)
resp_map (torch.Tensor)
data (rex_xai.input.input_data.Data)
- visualisation.__transpose_mask(mask, mode)¶
- Parameters:
mask (torch.Tensor | numpy.ndarray)
mode (str)
- Return type:
numpy.ndarray
- visualisation.generate_colours(n, colourmap)¶
Generate n evenly spaced RGB colours from a matplotlib colourmap.
- visualisation.make_composite_mask(explanations)¶
Creates a composite mask from a list of masks.
- visualisation.apply_boundaries_to_image(image, explanations, colours)¶
Draws the boundaries of the explanations on the image, using the provided colours.
- visualisation.subplot_multi_explanations(image, explanations, titles=None, alpha=0.5)¶
- visualisation.__save_multi(path, explanations_subset, data, img, colours_subset, args)¶
- visualisation.save_contrastive(explanation, data, args, path=None)¶
- Parameters:
args (rex_xai.input.config.CausalArgs)
- visualisation.save_complete(explanation, data, args, path=None)¶
- Parameters:
args (rex_xai.input.config.CausalArgs)
- visualisation.save_multi_explanation(explanations, data, args, clause=None, path=None)¶
- Parameters:
args (rex_xai.input.config.CausalArgs)
- visualisation.save_image(mask, data, args, path=None)¶
- Parameters:
mask (torch.Tensor | numpy.ndarray)
data (rex_xai.input.input_data.Data)
args (rex_xai.input.config.CausalArgs)
- visualisation.plot_image_grid(images, ncols=None)¶
Plot a grid of images