@@ -221,6 +221,40 @@ def export_queued_data_rows(self,
221
221
self .uid )
222
222
time .sleep (sleep_time )
223
223
224
+ def video_label_generator (self , timeout_seconds = 600 , ** kwargs ):
225
+ """
226
+ Download video annotations
227
+
228
+ Returns:
229
+ LabelGenerator for accessing labels for each video
230
+ """
231
+ warnings .warn (
232
+ "video_label_generator will be deprecated in a future release. "
233
+ "Use label_generator for video or text/image labels."
234
+ )
235
+ _check_converter_import ()
236
+ json_data = self .export_labels (download = True ,
237
+ timeout_seconds = timeout_seconds ,
238
+ ** kwargs )
239
+ # assert that the instance this would fail is only if timeout runs out
240
+ assert isinstance (
241
+ json_data ,
242
+ List ), "Unable to successfully get labels. Please try again"
243
+ if json_data is None :
244
+ raise TimeoutError (
245
+ f"Unable to download labels in { timeout_seconds } seconds."
246
+ "Please try again or contact support if the issue persists." )
247
+ is_video = [
248
+ 'frames' in row ['Label' ] for row in json_data if row ['Label' ]
249
+ ]
250
+ if len (is_video ) and not all (is_video ):
251
+ raise ValueError (
252
+ "Found non-video data rows in export. "
253
+ "Use project.export_labels() to export projects with mixed data types. "
254
+ "Or use project.label_generator() for text and imagery data." )
255
+ return LBV1Converter .deserialize_video (json_data , self .client )
256
+
257
+
224
258
def label_generator (self , timeout_seconds = 600 , ** kwargs ):
225
259
"""
226
260
Download text and image annotations, or video annotations.
0 commit comments