首次加载会联网下载数据集,需保证网络与磁盘空间;使用前需自行确认数据集许可证与可用性;README 标注需要 Python 3.11+
datasets
tensorflowApache-2.0活跃维护提供大量可直接用于 TensorFlow、JAX 等框架的数据集集合,省去自己下载、解析和预处理数据的麻烦,统一接口加载即可训练模型。
TFDS is a collection of datasets ready to use with TensorFlow, Jax, ...
把大量公开数据集封装成 tf.data.Dataset,省去下载和预处理
提供大量可直接用于 TensorFlow、JAX 等框架的数据集集合,省去自己下载、解析和预处理数据的麻烦,统一接口加载即可训练模型。
核心能力
- 用 tfds.load 一行加载公开数据集并指定 split
- 输出标准 tf.data.Dataset,可直接接 shuffle/batch/prefetch 流水线
- 保证同一用户得到相同顺序的样本,便于复现
- 支持自定义数据集,按官方指南即可添加
- 同时面向 TensorFlow 与 Jax 使用
容易踩的坑
- v4.9.10最新正式版2026-05-08 · 2026-05-08 13:32 UTC
这个版本没有写更新说明。
- v4.9.92025-05-28 · 2025-05-28 13:38 UTC
查看更新说明
Added
Changed
apache-beamversion is pinned at<2.65.0until related tests are fixed, see issue 11055.
Deprecated
Removed
Fixed
- CroissantBuilder now supports Croissant files without patch version (i.e. only {major.minor} are provided).
- Various small bug fixes.
Security
- v4.9.82025-03-12 · 2025-03-12 16:04 UTC
查看更新说明
Added
- New Beam writer
NoShuffleBeamWriterthat doesn't shuffle, which speeds up dataset generation significantly, but does not have deterministic order guarantees. Can be enabled with the flag--nondeterministic_order. - CroissantBuilder now supports Croissant files that define splits; and new feature types: feature dictionaries and multidimensional arrays.
- New datasets.
Changed
Deprecated
Removed
Fixed
- Various small bug fixes.
- Various performance improvements.
Security
- New Beam writer
- v4.9.72024-10-30 · 2024-10-30 12:58 UTC
查看更新说明
Added
- New datasets.
Changed
CroissantBuilder's API to generate TFDS datasets from Croissant files.
Deprecated
Removed
Fixed
- Versions for existing datasets.
Security
- v4.9.62024-06-05 · 2024-06-05 08:15 UTC
查看更新说明
Added
- Full support for Python 3.12.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
TensorFlow Datasets
TensorFlow Datasets provides many public datasets as tf.data.Datasets.
Documentation
To install and use TFDS, we strongly encourage to start with our getting started guide. Try it interactively in a Colab notebook.
Our documentation contains:
- Tutorials and guides
- List of all available datasets
- The API reference
# !pip install tensorflow-datasets
import tensorflow_datasets as tfds
import tensorflow as tf
# Construct a tf.data.Dataset
ds = tfds.load('mnist', split='train', as_supervised=True, shuffle_files=True)
# Build your input pipeline
ds = ds.shuffle(1000).batch(128).prefetch(10).take(5)
for image, label in ds:
pass
TFDS core values
TFDS has been built with these principles in mind:
- Simplicity: Standard use-cases should work out-of-the box
- Performance: TFDS follows best practices and can achieve state-of-the-art speed
- Determinism/reproducibility: All users get the same examples in the same order
- Customisability: Advanced users can have fine-grained control
If those use cases are not satisfied, please send us feedback.
Want a certain dataset?
Adding a dataset is really straightforward by following our guide.
Request a dataset by opening a Dataset request GitHub issue.
And vote on the current set of requests by adding a thumbs-up reaction to the issue.
Citation
Please include the following citation when using tensorflow-datasets for a
paper, in addition to any citation specific to the used datasets.
@misc{TFDS,
title = {{TensorFlow Datasets}, A collection of ready-to-use datasets},
howpublished = {\url{https://www.tensorflow.org/datasets}},
}
Disclaimers
This is a utility library that downloads and prepares public datasets. We do not host or distribute these datasets, vouch for their quality or fairness, or claim that you have license to use the dataset. It is your responsibility to determine whether you have permission to use the dataset under the dataset's license.
If you're a dataset owner and wish to update any part of it (description, citation, etc.), or do not want your dataset to be included in this library, please get in touch through a GitHub issue. Thanks for your contribution to the ML community!
If you're interested in learning more about responsible AI practices, including fairness, please see Google AI's Responsible AI Practices.
tensorflow/datasets is Apache 2.0 licensed. See the
LICENSE file.