TensorFlow Datasets:即用型資料集集合。
TensorFlow Datasets 是一個可與 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"]