File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
labelbox/data/serialization/labelbox_v1 Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1- from requests .exceptions import HTTPError
2- import labelbox
31from typing import Any , Dict , Generator , Iterable
42import logging
53
64import ndjson
75import requests
6+ from requests .exceptions import HTTPError
87from google .api_core import retry
98
9+ import labelbox
1010from .label import LBV1Label
1111from ...annotation_types .collection import (LabelCollection , LabelGenerator ,
1212 PrefetchGenerator )
1717class LBV1Converter :
1818
1919 @staticmethod
20- def deserialize_video (json_data : Iterable [Dict [str , Any ]], client ):
20+ def deserialize_video (json_data : Iterable [Dict [str , Any ]],
21+ client : labelbox .Client ):
2122 """
2223 Converts a labelbox video export into the common labelbox format.
2324
2425 Args:
2526 json_data: An iterable representing the labelbox video export.
27+ client: The labelbox client for downloading video annotations
2628 Returns:
2729 LabelGenerator containing the video data.
2830 """
@@ -80,7 +82,7 @@ def _process(self, value):
8082 if 'frames' in value ['Label' ]:
8183 req = self ._request (value )
8284 value ['Label' ] = ndjson .loads (req )
83- return value
85+ return value
8486
8587 @retry .Retry (predicate = retry .if_exception_type (HTTPError ))
8688 def _request (self , value ):
Original file line number Diff line number Diff line change @@ -214,8 +214,8 @@ def _infer_media_type(self):
214214 # To use this converter on data with this url format
215215 # filter out empty examples from the payload before deserializing.
216216 raise TypeError (
217- "Can't infer data type from row data. Remove empty examples before trying again"
218- )
217+ "Can't infer data type from row data. Remove empty examples before trying again. "
218+ f"row_data: { self . row_data [: 200 ] } " )
219219
220220 def _has_object_annotations (self ):
221221 return len (self .label .objects ) > 0
You can’t perform that action at this time.
0 commit comments