tfds-nightly 4.9.9.dev202507160045__py3-none-any.whl → 4.9.9.dev202507180045__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tensorflow_datasets/core/dataset_builders/croissant_builder.py +16 -1
- tensorflow_datasets/core/dataset_builders/croissant_builder_test.py +31 -0
- {tfds_nightly-4.9.9.dev202507160045.dist-info → tfds_nightly-4.9.9.dev202507180045.dist-info}/METADATA +1 -1
- {tfds_nightly-4.9.9.dev202507160045.dist-info → tfds_nightly-4.9.9.dev202507180045.dist-info}/RECORD +9 -9
- {tfds_nightly-4.9.9.dev202507160045.dist-info → tfds_nightly-4.9.9.dev202507180045.dist-info}/WHEEL +0 -0
- {tfds_nightly-4.9.9.dev202507160045.dist-info → tfds_nightly-4.9.9.dev202507180045.dist-info}/entry_points.txt +0 -0
- {tfds_nightly-4.9.9.dev202507160045.dist-info → tfds_nightly-4.9.9.dev202507180045.dist-info}/licenses/AUTHORS +0 -0
- {tfds_nightly-4.9.9.dev202507160045.dist-info → tfds_nightly-4.9.9.dev202507180045.dist-info}/licenses/LICENSE +0 -0
- {tfds_nightly-4.9.9.dev202507160045.dist-info → tfds_nightly-4.9.9.dev202507180045.dist-info}/top_level.txt +0 -0
@@ -48,7 +48,9 @@ from tensorflow_datasets.core import dataset_info
|
|
48
48
|
from tensorflow_datasets.core import download
|
49
49
|
from tensorflow_datasets.core import split_builder as split_builder_lib
|
50
50
|
from tensorflow_datasets.core import splits as splits_lib
|
51
|
+
from tensorflow_datasets.core.features import audio_feature
|
51
52
|
from tensorflow_datasets.core.features import bounding_boxes
|
53
|
+
from tensorflow_datasets.core.features import bounding_boxes_utils as bb_utils
|
52
54
|
from tensorflow_datasets.core.features import feature as feature_lib
|
53
55
|
from tensorflow_datasets.core.features import features_dict
|
54
56
|
from tensorflow_datasets.core.features import image_feature
|
@@ -174,8 +176,21 @@ def datatype_converter(
|
|
174
176
|
feature = image_feature.Image(doc=field.description)
|
175
177
|
elif field_data_type == mlc.DataType.BOUNDING_BOX:
|
176
178
|
# TFDS uses REL_YXYX by default, but Hugging Face doesn't enforce a format.
|
179
|
+
if bbox_format := field.source.format:
|
180
|
+
try:
|
181
|
+
bbox_format = bb_utils.BBoxFormat(bbox_format)
|
182
|
+
except ValueError as e:
|
183
|
+
raise ValueError(
|
184
|
+
f'Unsupported bounding box format: {bbox_format}. Currently'
|
185
|
+
' supported bounding box formats are: '
|
186
|
+
f'{[format.value for format in bb_utils.BBoxFormat]}'
|
187
|
+
) from e
|
177
188
|
feature = bounding_boxes.BBoxFeature(
|
178
|
-
doc=field.description, bbox_format=
|
189
|
+
doc=field.description, bbox_format=bbox_format
|
190
|
+
)
|
191
|
+
elif field_data_type == mlc.DataType.AUDIO_OBJECT:
|
192
|
+
feature = audio_feature.Audio(
|
193
|
+
doc=field.description, sample_rate=field.source.sampling_rate
|
179
194
|
)
|
180
195
|
else:
|
181
196
|
raise ValueError(f'Unknown data type: {field_data_type}.')
|
@@ -20,7 +20,9 @@ import pytest
|
|
20
20
|
from tensorflow_datasets import testing
|
21
21
|
from tensorflow_datasets.core import file_adapters
|
22
22
|
from tensorflow_datasets.core.dataset_builders import croissant_builder
|
23
|
+
from tensorflow_datasets.core.features import audio_feature
|
23
24
|
from tensorflow_datasets.core.features import bounding_boxes
|
25
|
+
from tensorflow_datasets.core.features import bounding_boxes_utils as bb_utils
|
24
26
|
from tensorflow_datasets.core.features import features_dict
|
25
27
|
from tensorflow_datasets.core.features import image_feature
|
26
28
|
from tensorflow_datasets.core.features import sequence_feature
|
@@ -129,6 +131,27 @@ def test_simple_datatype_converter(
|
|
129
131
|
assert actual_feature == expected_feature
|
130
132
|
|
131
133
|
|
134
|
+
def test_bbox_datatype_converter():
|
135
|
+
field = mlc.Field(
|
136
|
+
data_types=mlc.DataType.BOUNDING_BOX,
|
137
|
+
description="Bounding box feature",
|
138
|
+
source=mlc.Source(format="XYWH"),
|
139
|
+
)
|
140
|
+
actual_feature = croissant_builder.datatype_converter(field)
|
141
|
+
assert isinstance(actual_feature, bounding_boxes.BBoxFeature)
|
142
|
+
assert actual_feature.bbox_format == bb_utils.BBoxFormat.XYWH
|
143
|
+
|
144
|
+
|
145
|
+
def test_bbox_datatype_converter_with_invalid_format():
|
146
|
+
field = mlc.Field(
|
147
|
+
data_types=mlc.DataType.BOUNDING_BOX,
|
148
|
+
description="Bounding box feature",
|
149
|
+
source=mlc.Source(format="InvalidFormat"),
|
150
|
+
)
|
151
|
+
with pytest.raises(ValueError, match="Unsupported bounding box format"):
|
152
|
+
croissant_builder.datatype_converter(field)
|
153
|
+
|
154
|
+
|
132
155
|
@pytest.mark.parametrize(
|
133
156
|
["field", "feature_type", "subfield_types"],
|
134
157
|
[
|
@@ -150,6 +173,14 @@ def test_simple_datatype_converter(
|
|
150
173
|
image_feature.Image,
|
151
174
|
None,
|
152
175
|
),
|
176
|
+
(
|
177
|
+
mlc.Field(
|
178
|
+
data_types=mlc.DataType.AUDIO_OBJECT,
|
179
|
+
description="Audio feature",
|
180
|
+
),
|
181
|
+
audio_feature.Audio,
|
182
|
+
None,
|
183
|
+
),
|
153
184
|
(
|
154
185
|
mlc.Field(
|
155
186
|
data_types=mlc.DataType.BOUNDING_BOX,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: tfds-nightly
|
3
|
-
Version: 4.9.9.
|
3
|
+
Version: 4.9.9.dev202507180045
|
4
4
|
Summary: tensorflow/datasets is a library of datasets ready to use with TensorFlow.
|
5
5
|
Home-page: https://github.com/tensorflow/datasets
|
6
6
|
Download-URL: https://github.com/tensorflow/datasets/tags
|
{tfds_nightly-4.9.9.dev202507160045.dist-info → tfds_nightly-4.9.9.dev202507180045.dist-info}/RECORD
RENAMED
@@ -141,8 +141,8 @@ tensorflow_datasets/core/data_sources/python_test.py,sha256=O3yqMPx40JlHN0uFfZPN
|
|
141
141
|
tensorflow_datasets/core/dataset_builders/__init__.py,sha256=StTA3euephqDZdpTzJQgfWNqB5inZosrAhaWg2BOeio,1945
|
142
142
|
tensorflow_datasets/core/dataset_builders/adhoc_builder.py,sha256=QVE8wWGPOgILPTC27Q28QZ3KIi5N64OGOfKpTq4W4_0,9216
|
143
143
|
tensorflow_datasets/core/dataset_builders/adhoc_builder_test.py,sha256=yhRwrznK78MvHeWGRggnMTiyx_SlR1z30iD5VU3Gweo,13096
|
144
|
-
tensorflow_datasets/core/dataset_builders/croissant_builder.py,sha256=
|
145
|
-
tensorflow_datasets/core/dataset_builders/croissant_builder_test.py,sha256=
|
144
|
+
tensorflow_datasets/core/dataset_builders/croissant_builder.py,sha256=Ef9fSTxFIvUKf_zfCqL3JyUje6f9buIQXvT1iuHgB20,16596
|
145
|
+
tensorflow_datasets/core/dataset_builders/croissant_builder_test.py,sha256=1KPrGPFYHQvo33TwnG5LmPpdlyRTudPfni4ipFsj0ao,11607
|
146
146
|
tensorflow_datasets/core/dataset_builders/huggingface_dataset_builder.py,sha256=Loq3qeGk1Ias-d2oT_dK47BRNgTA4LKJchNGh7aA4a0,18313
|
147
147
|
tensorflow_datasets/core/dataset_builders/huggingface_dataset_builder_test.py,sha256=6N3DLsry9LhDqhpleaoXrrhaGiLJMBgUlwDnAji-1fI,4389
|
148
148
|
tensorflow_datasets/core/dataset_builders/view_builder.py,sha256=eaCtjN5Vg4rK8JD3auA4PhF9mjH5HvQ9dslDX8LbwyM,11907
|
@@ -2468,10 +2468,10 @@ tensorflow_datasets/vision_language/wit/wit_test.py,sha256=PXS8DMNW-MDrT2p5oy4Ic
|
|
2468
2468
|
tensorflow_datasets/vision_language/wit_kaggle/__init__.py,sha256=vGwSGeM8WE4Q-l0-eEE1sBojmk6YT0l1OO60AWa4Q40,719
|
2469
2469
|
tensorflow_datasets/vision_language/wit_kaggle/wit_kaggle.py,sha256=q-vX_FBzIwsFxL4sY9vuyQ3UQD2PLM4yhUR4U6l-qao,16903
|
2470
2470
|
tensorflow_datasets/vision_language/wit_kaggle/wit_kaggle_test.py,sha256=ZymHT1NkmD-pUnh3BmM3_g30c5afsWYnmqDD9dVyDSA,1778
|
2471
|
-
tfds_nightly-4.9.9.
|
2472
|
-
tfds_nightly-4.9.9.
|
2473
|
-
tfds_nightly-4.9.9.
|
2474
|
-
tfds_nightly-4.9.9.
|
2475
|
-
tfds_nightly-4.9.9.
|
2476
|
-
tfds_nightly-4.9.9.
|
2477
|
-
tfds_nightly-4.9.9.
|
2471
|
+
tfds_nightly-4.9.9.dev202507180045.dist-info/licenses/AUTHORS,sha256=nvBG4WwfgjuOu1oZkuQKw9kg7X6rve679ObS-YDDmXg,309
|
2472
|
+
tfds_nightly-4.9.9.dev202507180045.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
2473
|
+
tfds_nightly-4.9.9.dev202507180045.dist-info/METADATA,sha256=nJXUk8MApA1PG6w8CkH8by_d1XcPHzen2tW9qs_QzRA,11694
|
2474
|
+
tfds_nightly-4.9.9.dev202507180045.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
2475
|
+
tfds_nightly-4.9.9.dev202507180045.dist-info/entry_points.txt,sha256=eHEL7nF5y1uCY2FgkuYIdE062epJXlAQTSdq89px4p4,73
|
2476
|
+
tfds_nightly-4.9.9.dev202507180045.dist-info/top_level.txt,sha256=bAevmk9209s_oxVZVlN6hSDIVS423qrMQvmcWSvW4do,20
|
2477
|
+
tfds_nightly-4.9.9.dev202507180045.dist-info/RECORD,,
|
{tfds_nightly-4.9.9.dev202507160045.dist-info → tfds_nightly-4.9.9.dev202507180045.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|