コード例 #1
0
def _get_feature_label_keys():
    """Extracts and returns the dataset feature and label keys."""
    feature_spec = (rio_specs.scene_feature_spec(
        with_annotations=True).get_serialized_info())
    feature_dict = tfds.core.utils.flatten_nest_dict(feature_spec)
    feature_keys = []
    label_keys = []
    for key in sorted(feature_dict):
        if 'labels' in key:
            label_keys.append(key)
        else:
            feature_keys.append(key)
    return feature_keys, label_keys
コード例 #2
0
 def decode_fn(value):
     tensors = example_parser.decode_serialized_example(
         serialized_example=value,
         features=rio_specs.scene_feature_spec(with_annotations=True))
     tensor_dict = tfds.core.utils.flatten_nest_dict(tensors)
     return tensor_dict