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个浮点坐标的列表,但是边界框数量是变化的。