tf.keras.visualization.plot_segmentation_mask_gallery

Plots a gallery of images with corresponding segmentation masks.

images A 4D tensor or NumPy array of images. Shape should be (batch_size, height, width, channels).
num_classes The number of segmentation classes. Class indices should start from 1. Class 0 will be treated as background and ignored if ignore_index is not 0.
value_range A tuple specifying the value range of the images (e.g., (0, 255) or (0, 1)). Defaults to (0, 255).
y_true A 3D/4D tensor or NumPy array representing the ground truth segmentation masks. Shape should be (batch_size, height, width) or (batch_size, height, width, 1). Defaults to None.
y_pred A 3D/4D tensor or NumPy array representing the predicted segmentation masks. Shape should be the same as y_true. Defaults to None.
color_mapping A dictionary mapping class indices to RGB colors. If None, a default color palette is used. Class indices start from 1. Defaults to None.
blend Whether to blend the masks with the input image using the alpha value. If False, the masks are drawn directly on the images without blending. Defaults to True.
alpha The opacity of the segmentation masks (a float between 0 and 1). Defaults to 0.8.
ignore_index The class index to ignore when drawing masks. Defaults to -1.
data_format The image data format "channels_last" or "channels_first". Defaults to the Keras backend data format.
kwargs Additional keyword arguments to be passed to keras.visualization.plot_image_gallery.

The output of keras.visualization.plot_image_gallery.

ValueError If images is not a 4D tensor/array.