TFRecordDataset 和 FixedLengthRecordDataset 有什么区别?
What is the difference between TFRecordDataset and FixedLengthRecordDataset?
最好能从项目中获得一个用例并解释每个用例的用法。提前致谢。
TFRecordDataset
、FixedLengthRecordDataset
以及TextLineDataset
是Dataset
的类。
Dataset is a base class containing methods to create and transform datasets. Also allows you initialize a dataset from data in memory, or from a Python generator.
Since release 1.4, Datasets is a new way to create input pipelines to TensorFlow models. This API is much more performant than using feed_dict or the queue-based pipelines, and it's cleaner and easier to use.
作为一个用例,您可以考虑对数据进行预处理以将其输入模型进行训练(以下链接中的示例非常不言自明)。
- TFRecordDataset: Reads records from TFRecord files (Example 1, Example 2).
#Python
dataset = tf.data.TFRecordDataset("/path/to/file.tfrecord")
- FixedLengthRecordDataset: Reads fixed size records from binary files (Example).
#Python
images = tf.data.FixedLengthRecordDataset(
images_file, 28 * 28, header_bytes=16).map(decode_image)
- TextLineDataset: 从文本文件中读取行。
看到这个documentation(包括 TextLineDataset 示例)
最好能从项目中获得一个用例并解释每个用例的用法。提前致谢。
TFRecordDataset
、FixedLengthRecordDataset
以及TextLineDataset
是Dataset
的类。
Dataset is a base class containing methods to create and transform datasets. Also allows you initialize a dataset from data in memory, or from a Python generator.
Since release 1.4, Datasets is a new way to create input pipelines to TensorFlow models. This API is much more performant than using feed_dict or the queue-based pipelines, and it's cleaner and easier to use.
作为一个用例,您可以考虑对数据进行预处理以将其输入模型进行训练(以下链接中的示例非常不言自明)。
- TFRecordDataset: Reads records from TFRecord files (Example 1, Example 2).
#Python
dataset = tf.data.TFRecordDataset("/path/to/file.tfrecord")
- FixedLengthRecordDataset: Reads fixed size records from binary files (Example).
#Python
images = tf.data.FixedLengthRecordDataset(
images_file, 28 * 28, header_bytes=16).map(decode_image)
- TextLineDataset: 从文本文件中读取行。
看到这个documentation(包括 TextLineDataset 示例)