[TFRecord文件格式]基本介绍
标准TensorFlow格式 TFRecords
觉得有用的话,欢迎一起讨论相互学习~Follow Me
TFRecords可以允许你讲任意的数据转换为TensorFlow所支持的格式, 这种方法可以使TensorFlow的数据集更容易与网络应用架构相匹配。这种建议的方法就是使用TFRecords文件,TFRecords文件包含了[tf.train.Example 协议内存块(protocol buffer)](协议内存块包含了字段[Features]。你可以写一段代码获取你的数据, 将数据填入到Example协议内存块(protocol buffer),将协议内存块序列化为一个字符串, 并且通过[tf.python_io.TFRecordWriter class]写入到TFRecords文件。
TFRecords文件格式在图像识别中有很好的使用,其可以将二进制数据和标签数据(训练的类别标签)数据存储在同一个文件中,它可以在模型进行训练之前通过预处理步骤将图像转换为TFRecords格式,此格式最大的优点实践每幅输入图像和与之关联的标签放在同一个文件中.TFRecords文件是一种二进制文件,其不对数据进行压缩,所以可以被快速加载到内存中.格式不支持随机访问,因此它适合于大量的数据流,但不适用于快速分片或其他非连续存取。
TFRecordWriter
tf.python_io.TFRecordWriter.write(record)
Write a string record to the file.
将字符记录写到文件中,注意传入的参数是string类型的字符串.
Args:
record: str
TFRecordReader
class tf.TFRecordReader
A Reader that outputs the records from a TFRecords file.
从TFrecords文件中读取记录
See ReaderBase for supported methods.
- - -
tf.TFRecordReader.__init__(name=None)
Create a TFRecordReader.
创建一个TFRecordReader
name: A name for the operation (optional).
tf.TFRecordReader.num_records_produced(name=None)
Returns the number of records this reader has produced.
This is the same as the number of Read executions that have
succeeded.
返回这个阅读器生成的记录的数量。这与已成功执行读取操作的数量相同。
name: A name for the operation (optional).
Returns:
An int64 Tensor.
一个int64位张量.
tf.TFRecordReader.num_work_units_completed(name=None)
Returns the number of work units this reader has finished processing.
返回该阅读器完成处理的工作单元的数量。
Args:
name: A name for the operation (optional).
Returns:
An int64 Tensor.
tf.TFRecordReader.read(queue, name=None)
Returns the next record (key, value pair) produced by a reader.
返回一个阅读器生成的下一个记录(键值对)。
Will dequeue a work unit from queue if necessary (e.g. when the
Reader needs to start reading from a new file since it has
finished with the previous file).
如果有必要,将从队列中对一个工作单元进行排序(例如,当读者需要从一个新文件开始阅读时,因为它已经完成了前面的文件)。
Args:
queue: A Queue or a mutable string Tensor representing a handle
to a Queue, with string work items.
文件名队列句柄name: A name for the operation (optional).
Returns:
A tuple of Tensors (key, value).
key: A string scalar Tensor.value: A string scalar Tensor.
返回键值对,其中值表示读取的文件
tf.TFRecordReader.reset(name=None)
Restore a reader to its initial clean state.
恢复一个文件阅读器使其置空
Args:
name: A name for the operation (optional).
Returns:
The created Operation.
tf.TFRecordReader.restore_state(state, name=None)
Restore a reader to a previously saved state.
恢复阅读器至先前保存的状态.
Not all Readers support being restored, so this can produce an
Unimplemented error.
并不是所有的阅读器都可以实现恢复的操作,所以这有可能导致一个未实现的错误.
Args:
state: A string Tensor.
一个字符串张量
Result of a SerializeState of a Reader with matching type.
一个具有匹配类型的阅读器的串行化的结果。name: A name for the operation (optional).
Returns:
The created Operation.
tf.TFRecordReader.serialize_state(name=None)
Produce a string tensor that encodes the state of a reader.
产生一个字符串张量,它可以对一个阅读器的状态进行编码。
Not all Readers support being serialized, so this can produce an
Unimplemented error.
不是所有的阅读器都支持编码,所以这会导致一个未实现的错误.
Args:
name: A name for the operation (optional).
Returns:
A string Tensor.
tf.TFRecordReader.supports_serialize
Whether the Reader implementation can serialize its state.
阅读器是否可以实现对当前状态进行编码.
[TFRecord文件格式]基本介绍的更多相关文章
- PCM文件格式简单介绍
PCM文件格式简单介绍 PCM文件:模拟音频信号经模数转换(A/D变换)直接形成的二进制序列,该文件没有附加的文件头和文件结束标志.Windows的Convert工具能够把PCM音频格式的文件转换成M ...
- [mobi文件格式详细介绍一]_[资料篇]
Amazon 收购 Mobipocket 于 2005年3月: Kindle 第一版于2007发布,mobi成为其系统支持的电子格式之一,mobi是由kindle带动发展起来的; 有人问Amazon为 ...
- (转)AVI文件格式解析+AVI文件解析工具
AVI文件解析工具下载地址:http://download.csdn.net/detail/zjq634359531/7556659 AVI(Audio Video Interleaved的缩写)是一 ...
- Dalvik虚拟机简要介绍和学习计划
文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8852432 我们知道,Android应用程序是 ...
- OpenGL---------BMP文件格式
计算机保存图象的方法通常有两种:一是“矢量图”,一是“像素图”.矢量图保存了图象中每一几何物体的位置.形状.大小等信息,在显示图象时,根据这些信息计算得到完整的图象.“像素图”是将完整的图象纵横分为若 ...
- WAVE文件格式解析
WAVE 文件作为Windows多媒体中使用的声音波形文件格式之一,它是以RIFF(Resource Interchange File Format)格式为标准的.这里不针对RIFF文件格式做介绍,不 ...
- PPM / PGM / PBM 图像文件格式
PPM / PGM / PBM 图像文件格式 声明:引用请注明出处http://blog.csdn.net/lg1259156776/ 说明:在进行图像压缩后传输,然后解压缩显示的过程中,通常会用到P ...
- TensorFlow读写数据
前言 只有光头才能变强. 文本已收录至我的GitHub仓库,欢迎Star:https://github.com/ZhongFuCheng3y/3y 回顾前面: 从零开始学TensorFlow[01-搭 ...
- tensorflow Importing Data
tf.data API可以建立复杂的输入管道.它可以从分布式文件系统中汇总数据,对每个图像数据施加随机扰动,随机选择图像组成一个批次训练.一个文本模型的管道可能涉及提取原始文本数据的符号,使用查询表将 ...
随机推荐
- Grails框架使用指南
Grails框架使用指南,详解Grails框架!cnxieyang@163.com
- Sql的基础知识技巧(三)
三.技巧 1.1=1,1=2 的使用,在 SQL 语句组合时用的较多 "where 1=1" 是表示选择全部 "where 1=2"全部不选, 如:if @st ...
- HDU2243 考研路茫茫――单词情结
Description 背单词,始终是复习英语的重要环节.在荒废了3年大学生涯后,Lele也终于要开始背单词了. 一天,Lele在某本单词书上看到了一个根据词根来背单词的方法.比如"ab&q ...
- hdu3076—概率dp
hdu3076-概率dp 标签 : 概率dp 题目链接 题意: 2个人分别有AB的血数,轮流扔骰子,数小的自减一血,平的不变,谁先到减0, 谁输,问A赢的概率. 题解: dp[i][j]表示的是第一个 ...
- python列表三
>>> list1 = [123]>>> list2 =[234]>>> list1 > list2False>>> li ...
- 五 : springMVC拦截器
springMVC拦截器的实现一般有两种方式 第一种方式是要定义的Interceptor类要实现了Spring的HandlerInterceptor 接口 第二种方式是继承实现了HandlerInte ...
- 使用Eclipse在Excel中找出两张表中相同证件号而姓名或工号却出现不同的的项
1:首先把Excel中的文本复制到txt中,复制如下: A表: 证件号 工号 姓名 310110xxxx220130004 101 傅家宜3101 ...
- JavaScript八张思维导图
JS基本概念 JS操作符 JS基本语句 JS数组用法 Date用法 JS字符串用法 JS编程风格 JS编程实践 不知不觉做前端已经五年多了,无论是从最初的jQuery还是现在火热的Angular,Vu ...
- MySql Host is blocked because of many connection errors;
错误:Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 原因: 同一个i ...
- 如何查看dede版本信息
dedecms版本信息 更新日期 it 分类: dedecms 打开 /include/common.inc.php 查找 $cfg_version 可以看到版本号 /打开 data/admin/ve ...