FixedLenFeature和VarLenFeature区别

Class FixedLenFeature

Aliases:

Class tf.FixedLenFeature
Class tf.io.FixedLenFeature
复制代码

Defined in tensorflow/python/ops/parsing_ops.py.

Configuration for parsing a fixed-length input feature.

To treat sparse input as dense, provide a default_value; otherwise, the parse functions will fail on any examples missing this feature. Fields:

shape: Shape of input data.
dtype: Data type of input.
default_value: Value to be used if an example is missing this feature. It must be compatible with dtype and of the specified shape.
复制代码

例如,在目标检测中,可以使用 FixedLenFeature 来设置“image/encoded”特征。 “image/encoded”是固定长度的Feature(有一个元素)并保存“bytes”类型的值,但是“bytes”类型的值本身可以具有可变大小(它是一个字节串,并且可以在其中包含许多符号)。 “image/encoded”是一个列表,其中包含一个“bytes”类型的元素,它的长度是不变的。

Class VarLenFeature

Aliases:

Class tf.VarLenFeature
Class tf.io.VarLenFeature
复制代码

Defined in tensorflow/python/ops/parsing_ops.py.

Configuration for parsing a variable-length input feature. Fields:

dtype: Data type of input.
复制代码

例如,在目标检测中,可以使用 VarLenFeature 来设置“objects_number”特征 每个图像的边界框数量可变(等于图像中的对象), 每个边界框本身都是4个浮点坐标的列表,但是边界框数量是变化的。

转载于:https://juejin.im/post/5c3bf98be51d451bd166474d

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值