Skip to content

Commit 6b5d9e5

Browse files
authored
Merge pull request #463 from Labelbox/jt/remvidgen
[AL-1283] Merge Label Generator and Video Label Generator
2 parents 17edb8d + 81ecfd0 commit 6b5d9e5

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

examples/annotation_types/basics.ipynb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@
140140
" - Covered in this notebook\n",
141141
"2. Export labels to an annotation generator\n",
142142
" - `project.label_generator()`\n",
143-
" - `project.video_label_generator()`\n",
144143
"3. Use a converter to load from another format\n",
145144
" - Covered in the converters.ipynb notebook."
146145
]

examples/annotation_types/converters.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
"* The goal is to create a set of converts that convert to and from labelbox annotation types.\n",
3636
"* This is automatically used when exporting labels from labelbox with:\n",
3737
" 1. `label.label_generator()`\n",
38-
" 2. `label.video_label_generator()`\n",
3938
"* Currently we support:\n",
4039
" 1. NDJson Converter\n",
4140
" - Convert to and from the prediction import format (mea, mal)\n",
@@ -363,7 +362,7 @@
363362
],
364363
"source": [
365364
"project = client.get_project(\"ckqcx1d58068c0y619qv7hzgu\")\n",
366-
"labels = project.video_label_generator()\n",
365+
"labels = project.label_generator()\n",
367366
"\n",
368367
"for label in labels:\n",
369368
" annotation_lookup = label.frame_annotations()\n",

labelbox/schema/project.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ def video_label_generator(self, timeout_seconds=600, **kwargs):
228228
Returns:
229229
LabelGenerator for accessing labels for each video
230230
"""
231+
warnings.warn(
232+
"video_label_generator will be deprecated in a future release. "
233+
"Use label_generator for video or text/image labels.")
231234
_check_converter_import()
232235
json_data = self.export_labels(download=True,
233236
timeout_seconds=timeout_seconds,
@@ -252,10 +255,12 @@ def video_label_generator(self, timeout_seconds=600, **kwargs):
252255

253256
def label_generator(self, timeout_seconds=600, **kwargs):
254257
"""
255-
Download text and image annotations
258+
Download text and image annotations, or video annotations.
259+
260+
For a mixture of text/image and video, use project.export_labels()
256261
257262
Returns:
258-
LabelGenerator for accessing labels for each text or image
263+
LabelGenerator for accessing labels
259264
"""
260265
_check_converter_import()
261266
json_data = self.export_labels(download=True,
@@ -272,11 +277,14 @@ def label_generator(self, timeout_seconds=600, **kwargs):
272277
is_video = [
273278
'frames' in row['Label'] for row in json_data if row['Label']
274279
]
275-
if len(is_video) and any(is_video):
280+
281+
if len(is_video) and not all(is_video) and any(is_video):
276282
raise ValueError(
277-
"Found video data rows in export. "
283+
"Found mixed data types of video and text/image. "
278284
"Use project.export_labels() to export projects with mixed data types. "
279-
"Or use project.video_label_generator() for video data.")
285+
)
286+
if len(is_video) and all(is_video):
287+
return LBV1Converter.deserialize_video(json_data, self.client)
280288
return LBV1Converter.deserialize(json_data)
281289

282290
def export_labels(self,

0 commit comments

Comments
 (0)