tfds.visualization.show_examples
Stay organized with collections
Save and categorize content based on your preferences.
Visualize images (and labels) from an image classification dataset.
tfds.visualization.show_examples(
ds: _Dataset,
ds_info: dataset_info.DatasetInfo,
is_batched: bool = False,
**options_kwargs
)
Used in the notebooks
This function is for interactive use (Colab, Jupyter). It displays and return
a plot of (rows*columns) images from a tf.data.Dataset.
Usage:
ds, ds_info = tfds.load('cifar10', split='train', with_info=True)
fig = tfds.show_examples(ds, ds_info)
Args |
ds
|
tf.data.Dataset . The tf.data.Dataset 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
|
is_batched
|
Whether the data is batched.
|
**options_kwargs
|
Additional display options, specific to the dataset type
to visualize. Are forwarded to tfds.visualization.Visualizer.show . See
the tfds.visualization for a list of available visualizers.
|
Returns |
fig
|
The matplotlib.Figure object
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tfds.visualization.show_examples\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/datasets/blob/v4.9.3/tensorflow_datasets/core/visualization/show_examples.py#L94-L150) |\n\nVisualize images (and labels) from an image classification dataset.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tfds.show_examples`](https://www.tensorflow.org/datasets/api_docs/python/tfds/visualization/show_examples)\n\n\u003cbr /\u003e\n\n tfds.visualization.show_examples(\n ds: _Dataset,\n ds_info: dataset_info.DatasetInfo,\n is_batched: bool = False,\n **options_kwargs\n )\n\n### Used in the notebooks\n\n| Used in the tutorials |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| - [TensorFlow Datasets](https://www.tensorflow.org/datasets/overview) - [Fine tuning models for plant disease detection](https://www.tensorflow.org/hub/tutorials/cropnet_on_device) |\n\nThis function is for interactive use (Colab, Jupyter). It displays and return\na plot of (rows\\*columns) images from a tf.data.Dataset.\n\n#### Usage:\n\n ds, ds_info = tfds.load('cifar10', split='train', with_info=True)\n fig = tfds.show_examples(ds, ds_info)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ds` | [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset). The tf.data.Dataset object to visualize. Examples should not be batched. Examples will be consumed in order until (rows \\* cols) are read or the dataset is consumed. |\n| `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` |\n| `is_batched` | Whether the data is batched. |\n| `**options_kwargs` | Additional display options, specific to the dataset type to visualize. Are forwarded to [`tfds.visualization.Visualizer.show`](../../tfds/visualization/Visualizer#show). See the [`tfds.visualization`](../../tfds/visualization) for a list of available visualizers. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-------|--------------------------------|\n| `fig` | The `matplotlib.Figure` object |\n\n\u003cbr /\u003e"]]