TensorFlow 資料集:一系列可立即使用的資料集。

TensorFlow 資料集是一系列可立即使用的資料集,可搭配 TensorFlow 或其他 Python 機器學習架構 (例如 Jax)。所有資料集都以 tf.data.Datasets 形式公開,可輕鬆建立高效能輸入管線。若要開始使用,請參閱指南和我們的資料集清單
import tensorflow as tf
import tensorflow_datasets as tfds

# Construct a tf.data.Dataset
ds = tfds.load('mnist', split='train', shuffle_files=True)

# Build your input pipeline
ds = ds.shuffle(1024).batch(32).prefetch(tf.data.AUTOTUNE)
for example in ds.take(1):
  image, label = example["image"], example["label"]
Notebook 中執行