rex_xai.visualisation ===================== .. py:module:: rex_xai.visualisation .. autoapi-nested-parse:: image generation functions Functions --------- .. autoapisummary:: rex_xai.visualisation.plot_curve rex_xai.visualisation.plot_3d rex_xai.visualisation._transparent_cmap rex_xai.visualisation.heatmap_plot rex_xai.visualisation.contour_plot rex_xai.visualisation.__group_spectral_parts rex_xai.visualisation.spectral_plot rex_xai.visualisation.surface_plot rex_xai.visualisation.overlay_grid rex_xai.visualisation.remove_background rex_xai.visualisation.voxel_plot rex_xai.visualisation.__transpose_mask rex_xai.visualisation.generate_colours rex_xai.visualisation.make_composite_mask rex_xai.visualisation.apply_boundaries_to_image rex_xai.visualisation.get_img_as_array rex_xai.visualisation.save_multi_explanation rex_xai.visualisation.save_image rex_xai.visualisation.plot_image_grid Module Contents --------------- .. py:function:: plot_curve(curve, chunk_size, style='insertion', destination=None) plots an insertion/deletion curve of a responsibility map .. py:function:: plot_3d(path, ranking, ogrid, norm=255.0) plots a 3d grid in matplotlib given an image If is greyscale or RGBA, it is converted to RGB for plotting. .. py:function:: _transparent_cmap(cmap, N=255) Copy colormap and set alpha values .. py:function:: heatmap_plot(data, resp_map, colour, path=None) .. py:function:: contour_plot(path, maps, target, levels=30, destination=None) plots a contour plot .. py:function:: __group_spectral_parts(explanation) .. py:function:: spectral_plot(explanation, data, ranking, colour, extra=True, path=None) .. py:function:: surface_plot(args, resp_map, target, path=None) plots a 3d surface plot .. py:function:: overlay_grid(img, step_count=10) .. py:function:: remove_background(data, resp_map) Remove the background from the responsibility map if set in the Data object .. py:function:: 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. .. py:function:: __transpose_mask(explanation, mode, transposed) .. py:function:: generate_colours(n, colourmap) Generate n evenly spaced RGB colours from a matplotlib colourmap. .. py:function:: make_composite_mask(explanations) Creates a composite mask from a list of masks. .. py:function:: apply_boundaries_to_image(image, explanations, colours) Draws the boundaries of the explanations on the image, using the provided colours. .. py:function:: get_img_as_array(data) Return original input image as a numpy array, resized to match model size and converted to RGB if necessary. .. py:function:: save_multi_explanation(explanations, data, args, clause=None, path=None) .. py:function:: save_image(explanation, data, args, path=None) .. py:function:: plot_image_grid(images, ncols=None) Plot a grid of images