Features
Understand how data features are represented in TensorFlow.
We'll cover the following...
Chapter Goals:
- Learn what an Example spec is and what it is used for
- Understand the two different feature configuration classes in TensorFlow
- Implement a function that creates an Example spec from a feature configuration
A. Example spec
When we read from a TFRecords file for our input pipeline, we get back the serialized versions of the protocol buffers. What we really want, though, are easily accessible data values for each feature from the original protocol buffer. In order to achieve this, we need an Example spec.
An Example spec is a dictionary that maps the feature names from the original tf.train.Example
protocol buffer to particular configuration classes for each feature. Specifically, a feature is in exactly one of two configuration classes: VarLenFeature
or FixedLenFeature
.
B. VarLenFeature
class
A VarLenFeature
specifies a ...