ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more


Visualize images (and labels) from an image classification dataset.

Used in the notebooks

Used in the tutorials

This function is for interactive use (Colab, Jupyter). It displays and return a plot of (rows*columns) images from a


ds, ds_info = tfds.load('cifar10', split='train', with_info=True)
fig = tfds.show_examples(ds, ds_info)

ds The object to visualize. Examples should not be batched. Examples will be consumed in order until (rows * cols) are read or the dataset is consumed.
ds_info The dataset info object to which extract the label and features info. Available either through tfds.load('mnist', with_info=True) or tfds.builder('mnist').info
**options_kwargs Additional display options, specific to the dataset type to visualize. Are forwarded to See the tfds.visualization for a list of available visualizers.

fig The matplotlib.Figure object