tfds-nightly 4.9.9.dev202507290047__py3-none-any.whl → 4.9.9.dev202507310045__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 +3 -0
- tensorflow_datasets/core/dataset_builders/croissant_builder_test.py +9 -0
- tensorflow_datasets/core/features/video_feature.py +2 -1
- tensorflow_datasets/core/features/video_feature_test.py +5 -2
- tensorflow_datasets/core/utils/conversion_utils.py +12 -0
- tensorflow_datasets/core/utils/conversion_utils_test.py +17 -6
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507310045.dist-info}/METADATA +1 -1
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507310045.dist-info}/RECORD +13 -13
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507310045.dist-info}/WHEEL +0 -0
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507310045.dist-info}/entry_points.txt +0 -0
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507310045.dist-info}/licenses/AUTHORS +0 -0
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507310045.dist-info}/licenses/LICENSE +0 -0
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507310045.dist-info}/top_level.txt +0 -0
@@ -58,6 +58,7 @@ from tensorflow_datasets.core.features import image_feature
|
|
58
58
|
from tensorflow_datasets.core.features import sequence_feature
|
59
59
|
from tensorflow_datasets.core.features import tensor_feature
|
60
60
|
from tensorflow_datasets.core.features import text_feature
|
61
|
+
from tensorflow_datasets.core.features import video_feature
|
61
62
|
from tensorflow_datasets.core.utils import conversion_utils
|
62
63
|
from tensorflow_datasets.core.utils import croissant_utils
|
63
64
|
from tensorflow_datasets.core.utils import type_utils
|
@@ -195,6 +196,8 @@ def datatype_converter(
|
|
195
196
|
feature = audio_feature.Audio(
|
196
197
|
doc=field.description, sample_rate=field.source.sampling_rate
|
197
198
|
)
|
199
|
+
elif field_data_type == mlc.DataType.VIDEO_OBJECT:
|
200
|
+
feature = video_feature.Video(doc=field.description)
|
198
201
|
else:
|
199
202
|
raise ValueError(
|
200
203
|
f'Unknown data type: {field_data_type} for field {field.id}.'
|
@@ -28,6 +28,7 @@ from tensorflow_datasets.core.features import image_feature
|
|
28
28
|
from tensorflow_datasets.core.features import sequence_feature
|
29
29
|
from tensorflow_datasets.core.features import tensor_feature
|
30
30
|
from tensorflow_datasets.core.features import text_feature
|
31
|
+
from tensorflow_datasets.core.features import video_feature
|
31
32
|
from tensorflow_datasets.core.utils.lazy_imports_utils import mlcroissant as mlc
|
32
33
|
|
33
34
|
FileFormat = file_adapters.FileFormat
|
@@ -225,6 +226,14 @@ def test_datatype_converter_bbox_with_invalid_format():
|
|
225
226
|
bounding_boxes.BBoxFeature,
|
226
227
|
None,
|
227
228
|
),
|
229
|
+
(
|
230
|
+
mlc.Field(
|
231
|
+
data_types=mlc.DataType.VIDEO_OBJECT,
|
232
|
+
description="Video feature",
|
233
|
+
),
|
234
|
+
video_feature.Video,
|
235
|
+
None,
|
236
|
+
),
|
228
237
|
(
|
229
238
|
mlc.Field(
|
230
239
|
id="person",
|
@@ -129,7 +129,7 @@ class Video(sequence_feature.Sequence):
|
|
129
129
|
frame_shape = shape[1:]
|
130
130
|
self._encoding_format = encoding_format
|
131
131
|
self._extra_ffmpeg_args = list(ffmpeg_extra_args or [])
|
132
|
-
super(
|
132
|
+
super().__init__(
|
133
133
|
image_feature.Image(
|
134
134
|
shape=frame_shape,
|
135
135
|
dtype=dtype,
|
@@ -137,6 +137,7 @@ class Video(sequence_feature.Sequence):
|
|
137
137
|
use_colormap=use_colormap,
|
138
138
|
),
|
139
139
|
length=shape[0] if shape else None,
|
140
|
+
doc=doc,
|
140
141
|
)
|
141
142
|
|
142
143
|
def _ffmpeg_decode(self, path_or_fobj):
|
@@ -26,6 +26,7 @@ from tensorflow_datasets import testing
|
|
26
26
|
from tensorflow_datasets.core import features
|
27
27
|
|
28
28
|
|
29
|
+
|
29
30
|
class VideoFeatureTest(testing.FeatureExpectationsTestCase):
|
30
31
|
|
31
32
|
@property
|
@@ -34,9 +35,10 @@ class VideoFeatureTest(testing.FeatureExpectationsTestCase):
|
|
34
35
|
|
35
36
|
def test_video_numpy(self):
|
36
37
|
np_video = np.random.randint(256, size=(128, 64, 64, 3), dtype=np.uint8)
|
37
|
-
|
38
|
+
doc = 'This is a test video.'
|
39
|
+
feature = features.Video(shape=(None, 64, 64, 3), doc=doc)
|
38
40
|
self.assertFeature(
|
39
|
-
feature=
|
41
|
+
feature=feature,
|
40
42
|
shape=(None, 64, 64, 3),
|
41
43
|
dtype=tf.uint8,
|
42
44
|
tests=[
|
@@ -135,5 +137,6 @@ class VideoFeatureTest(testing.FeatureExpectationsTestCase):
|
|
135
137
|
],
|
136
138
|
)
|
137
139
|
|
140
|
+
|
138
141
|
if __name__ == '__main__':
|
139
142
|
testing.test_main()
|
@@ -128,6 +128,18 @@ def to_tfds_value(value: Any, feature: feature_lib.FeatureConnector) -> Any:
|
|
128
128
|
match feature:
|
129
129
|
case feature_lib.ClassLabel() | feature_lib.Scalar():
|
130
130
|
return value
|
131
|
+
case feature_lib.Video():
|
132
|
+
match value:
|
133
|
+
case dict():
|
134
|
+
if 'path' in value and value['path']:
|
135
|
+
return value['path']
|
136
|
+
elif 'bytes' in value and value['bytes']:
|
137
|
+
return value['bytes']
|
138
|
+
else:
|
139
|
+
raise ValueError(
|
140
|
+
'Dictionary-like video features must have either a `path` or'
|
141
|
+
' `bytes` key.'
|
142
|
+
)
|
131
143
|
case feature_lib.FeaturesDict():
|
132
144
|
return {
|
133
145
|
name: to_tfds_value(value.get(name), inner_feature)
|
@@ -81,7 +81,7 @@ def test_convert_value_raises(value, feature):
|
|
81
81
|
@pytest.mark.parametrize(
|
82
82
|
'value,feature,expected_value',
|
83
83
|
[
|
84
|
-
#
|
84
|
+
# Datetime.
|
85
85
|
(
|
86
86
|
datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc),
|
87
87
|
feature_lib.Scalar(dtype=np.int64),
|
@@ -92,14 +92,14 @@ def test_convert_value_raises(value, feature):
|
|
92
92
|
feature_lib.Scalar(dtype=np.int64),
|
93
93
|
86400,
|
94
94
|
),
|
95
|
-
#
|
95
|
+
# Scalar.
|
96
96
|
(42, feature_lib.Scalar(dtype=np.int64), 42),
|
97
97
|
(42, feature_lib.Scalar(dtype=np.int32), 42),
|
98
98
|
('abc', feature_lib.Scalar(dtype=np.object_), 'abc'),
|
99
99
|
(True, feature_lib.Scalar(dtype=np.bool_), True),
|
100
100
|
(False, feature_lib.Scalar(dtype=np.bool_), False),
|
101
101
|
(42.0, feature_lib.Scalar(dtype=np.float32), 42.0),
|
102
|
-
#
|
102
|
+
# Sequence.
|
103
103
|
([42], feature_lib.Sequence(feature=tf.int64), [42]),
|
104
104
|
(42, feature_lib.Sequence(feature=tf.int64), [42]),
|
105
105
|
(None, feature_lib.Sequence(feature=tf.int64), []),
|
@@ -111,7 +111,7 @@ def test_convert_value_raises(value, feature):
|
|
111
111
|
),
|
112
112
|
{'someint': [b'', 'string', b'']},
|
113
113
|
),
|
114
|
-
#
|
114
|
+
# Image.
|
115
115
|
(
|
116
116
|
lazy_imports_lib.lazy_imports.PIL_Image.new(mode='L', size=(4, 4)),
|
117
117
|
feature_lib.Image(),
|
@@ -119,7 +119,7 @@ def test_convert_value_raises(value, feature):
|
|
119
119
|
mode='RGB', size=(4, 4)
|
120
120
|
),
|
121
121
|
),
|
122
|
-
#
|
122
|
+
# Dict.
|
123
123
|
(
|
124
124
|
{
|
125
125
|
'de': b'Hallo Welt',
|
@@ -148,7 +148,18 @@ def test_convert_value_raises(value, feature):
|
|
148
148
|
}),
|
149
149
|
{'name': b'Name', 'age': 100},
|
150
150
|
),
|
151
|
-
#
|
151
|
+
# Video.
|
152
|
+
(
|
153
|
+
{'path': 'path/to/video.avi', 'bytes': None},
|
154
|
+
feature_lib.Video(),
|
155
|
+
'path/to/video.avi',
|
156
|
+
),
|
157
|
+
(
|
158
|
+
{'path': None, 'bytes': b'video_bytes'},
|
159
|
+
feature_lib.Video(),
|
160
|
+
b'video_bytes',
|
161
|
+
),
|
162
|
+
# nan, but the feature type is not float.
|
152
163
|
(
|
153
164
|
np.nan,
|
154
165
|
feature_lib.Text(),
|
@@ -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.dev202507310045
|
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.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507310045.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=XmnbIKiEN9OnY_RC8P7-83hbUfvtuJhbm24HfNFpiQs,17088
|
145
|
+
tensorflow_datasets/core/dataset_builders/croissant_builder_test.py,sha256=42HpBr3pANVKiok4lcx6xqwf0fY7kma6WIGA8WehNSs,15072
|
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
|
@@ -213,8 +213,8 @@ tensorflow_datasets/core/features/top_level_feature.py,sha256=JeOnaBUqp-xFLuPxUt
|
|
213
213
|
tensorflow_datasets/core/features/top_level_feature_test.py,sha256=JutGHU-08tg5KWiB3mIB6Q3a80CvS5_F6jG0bfAYXWM,3628
|
214
214
|
tensorflow_datasets/core/features/translation_feature.py,sha256=Qmx39XwMJy18u9eoZlT3Spc0VT0qtqsTHahWoETLZZo,8284
|
215
215
|
tensorflow_datasets/core/features/translation_feature_test.py,sha256=iK8ckwApuMu13BS1-vkny-m_NV6uNTz6ky5gbZEfxoc,6060
|
216
|
-
tensorflow_datasets/core/features/video_feature.py,sha256=
|
217
|
-
tensorflow_datasets/core/features/video_feature_test.py,sha256=
|
216
|
+
tensorflow_datasets/core/features/video_feature.py,sha256=vtKbhT04u-Ne6BImn9VBetYwo9IAmvwKLyGxpBYAhTA,7819
|
217
|
+
tensorflow_datasets/core/features/video_feature_test.py,sha256=Zp5wuGvSajMjxiayXoFYJyYHj_M977pHq8smFIdwOqc,4321
|
218
218
|
tensorflow_datasets/core/folder_dataset/__init__.py,sha256=Pn2mSU-CPxC89lvywHAD-XrhQj0mvAaqZogpekjr-bs,1515
|
219
219
|
tensorflow_datasets/core/folder_dataset/compute_split_utils.py,sha256=Ob_ZaqfS00zViAtRhHK_ff7R8eJAtYDDh6XjQGXdcP4,13515
|
220
220
|
tensorflow_datasets/core/folder_dataset/compute_split_utils_test.py,sha256=XBo4UC1IydAPuIP1SY2psrEVeEr3y0KPmCEje6yQWhs,3784
|
@@ -243,8 +243,8 @@ tensorflow_datasets/core/utils/benchmark_test.py,sha256=WUls_DapQTGs5P3DYJrcFldS
|
|
243
243
|
tensorflow_datasets/core/utils/bool_utils.py,sha256=299rj0bCG4zytHfsTEbptCV1M0RG_xN6d0SvmQZ1Sg4,1066
|
244
244
|
tensorflow_datasets/core/utils/bool_utils_test.py,sha256=rwFRcYV0wBknvYODjeTgRDqwUifzwLGCwejGdAjo61Q,1559
|
245
245
|
tensorflow_datasets/core/utils/colormap.csv,sha256=DDayUU9R19cxhcG3fj4cFwhI46W20U7ofBG0kToUHOw,2732
|
246
|
-
tensorflow_datasets/core/utils/conversion_utils.py,sha256=
|
247
|
-
tensorflow_datasets/core/utils/conversion_utils_test.py,sha256=
|
246
|
+
tensorflow_datasets/core/utils/conversion_utils.py,sha256=V8kFmJu38op7-8ufZvEn0fLOH8FMkjQebQ1NstIMRYo,6747
|
247
|
+
tensorflow_datasets/core/utils/conversion_utils_test.py,sha256=rP_nbzQWzmZc_GXp3Y6TirwIGJqiQbF-JtY3B1tOuN0,5346
|
248
248
|
tensorflow_datasets/core/utils/croissant_utils.py,sha256=9C8sScaEqSRsThqpQQc48GDNR1KFmDkS8hmKIvfZCB0,5181
|
249
249
|
tensorflow_datasets/core/utils/croissant_utils_test.py,sha256=UdkAVYDTPm1L0zmMESScurV_IMA5K3qAKmL_umeMJZI,4497
|
250
250
|
tensorflow_datasets/core/utils/docs.py,sha256=0AeGyhPXQc_DMsTX7ocbb8IuJv_RTrG7StYdfZiwSzU,1549
|
@@ -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.dev202507310045.dist-info/licenses/AUTHORS,sha256=nvBG4WwfgjuOu1oZkuQKw9kg7X6rve679ObS-YDDmXg,309
|
2472
|
+
tfds_nightly-4.9.9.dev202507310045.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
2473
|
+
tfds_nightly-4.9.9.dev202507310045.dist-info/METADATA,sha256=Z9I4QyzIXa3XoZSMv2SnWkVzCZQ52gELmAvGkUYWiJ0,11694
|
2474
|
+
tfds_nightly-4.9.9.dev202507310045.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
2475
|
+
tfds_nightly-4.9.9.dev202507310045.dist-info/entry_points.txt,sha256=eHEL7nF5y1uCY2FgkuYIdE062epJXlAQTSdq89px4p4,73
|
2476
|
+
tfds_nightly-4.9.9.dev202507310045.dist-info/top_level.txt,sha256=bAevmk9209s_oxVZVlN6hSDIVS423qrMQvmcWSvW4do,20
|
2477
|
+
tfds_nightly-4.9.9.dev202507310045.dist-info/RECORD,,
|
{tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507310045.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|