1717from labelbox .orm .db_object import DbObject , Updateable , Deletable
1818from labelbox .orm .model import Entity , Field , Relationship
1919from labelbox .pagination import PaginatedCollection
20- from labelbox .data .serialization import LBV1Converter
2120
2221try :
2322 datetime .fromisoformat # type: ignore[attr-defined]
2423except AttributeError :
2524 from backports .datetime_fromisoformat import MonkeyPatch
2625 MonkeyPatch .patch_fromisoformat ()
2726
27+ try :
28+ from labelbox .data .serialization import LBV1Converter
29+ except ImportError :
30+ pass
31+
2832logger = logging .getLogger (__name__ )
2933
3034
@@ -175,6 +179,7 @@ def video_label_generator(self, timeout_seconds=60):
175179 raise ValueError (
176180 "frames key not found in the first label. Cannot export video data."
177181 )
182+ _check_converter_import ()
178183 return LBV1Converter .deserialize_video (json_data , self .client )
179184
180185 def label_generator (self , timeout_seconds = 60 ):
@@ -186,6 +191,7 @@ def label_generator(self, timeout_seconds=60):
186191 """
187192 json_data = self .export_labels (download = True ,
188193 timeout_seconds = timeout_seconds )
194+ _check_converter_import ()
189195 return LBV1Converter .deserialize (json_data )
190196
191197 def export_labels (self , download = False , timeout_seconds = 60 ):
@@ -647,3 +653,11 @@ class LabelingParameterOverride(DbObject):
647653 "consensus average_benchmark_agreement last_activity_time" )
648654LabelerPerformance .__doc__ = (
649655 "Named tuple containing info about a labeler's performance." )
656+
657+
658+ def _check_converter_import ():
659+ if 'LBV1Converter' not in globals ():
660+ raise ImportError (
661+ "Missing dependencies to import converter. "
662+ "Use `pip install labelbox[data]` to add missing dependencies. "
663+ "or download raw json with project.export_labels()" )
0 commit comments