FeatureSpec¶
See the guides: Dataset
-
class
tflibs.datasets.feature_spec.FeatureSpec(shape)[source]¶ A class for specifying feature specs of a tflibs.datasets.BaseDataset.
-
feature_proto(value_dict)[source]¶ Returns a dict of tf.train.Feature proto corresponding to feature_proto_spec
Parameters: value_dict (dict) – A dict containing values of feature_proto_spec Returns: A dict of tf.train.Feature Return type: dict
-
feature_proto_spec¶ A property for specifying inner encoding spec of the feature
Returns: The dict containing shape and dtype info Return type: dict
-
parse(parent_key, record)[source]¶ Parse TF-record and returns dict of tf.Tensor
Parameters: - parent_key (str) – The key of the feature
- record (tf.Tensor) – String tensor of TF-record
Returns: A dict of tensors as specified at feature_proto_spec
Return type: dict
-
shape¶
-
-
class
tflibs.datasets.feature_spec.IDSpec[source]¶ Bases:
tflibs.datasets.feature_spec.FeatureSpecA class for specifying unique ID.
-
feature_proto_spec¶ A property for specifying inner encoding spec of the feature
Returns: The dict containing shape and dtype info Return type: dict
-
-
class
tflibs.datasets.feature_spec.ImageSpec(image_size)[source]¶ Bases:
tflibs.datasets.feature_spec.FeatureSpecA class for specifying image spec
Parameters: image_size (list|tuple) – The sizes of images -
feature_proto_spec¶ A property for specifying inner encoding spec of the feature
Returns: The dict containing shape and dtype info Return type: dict
-
-
class
tflibs.datasets.feature_spec.LabelSpec(depth, class_names=None)[source]¶ Bases:
tflibs.datasets.feature_spec.FeatureSpecA class for specifying one-hot label spec
Parameters: - depth (int) – The number of labels
- class_names (list) – A list of str which describes each labels
-
feature_proto_spec¶ A property for specifying inner encoding spec of the feature
Returns: The dict containing shape and dtype info Return type: dict
-
class
tflibs.datasets.feature_spec.MultiLabelSpec(depth, class_names=None)[source]¶ Bases:
tflibs.datasets.feature_spec.FeatureSpecA class for specifying multi-label spec
Parameters: - depth (int) – The number of labels
- class_names (list) – A list of str which describes each labels
-
feature_proto_spec¶ A property for specifying inner encoding spec of the feature
Returns: The dict containing shape and dtype info Return type: dict
-
classmethod
from_class_names(class_names)[source]¶ Create MultiLabelSpec object from a list of names specifying each classes
Parameters: class_names (list) – A list of names specifying each classes Returns: MultiLabelSpec object Return type: MultiLabelSpec