55
66from labelbox .orm .model import Entity
77from labelbox .schema import ontology
8- from .annotation import (
9- ClassificationAnnotation ,
10- ObjectAnnotation ,
11- VideoClassificationAnnotation ,
12- VideoObjectAnnotation
13- )
8+ from .annotation import (ClassificationAnnotation , ObjectAnnotation ,
9+ VideoClassificationAnnotation , VideoObjectAnnotation )
1410from .classification import ClassificationAnswer
1511from .data import VideoData , TextData , ImageData , BaseData
1612from .geometry import Mask
@@ -40,14 +36,10 @@ class Label(BaseModel):
4036 """
4137 uid : Optional [Cuid ] = None
4238 data : Union [BaseData ]
43- annotations : List [Union [
44- ClassificationAnnotation ,
45- ObjectAnnotation ,
46- VideoObjectAnnotation ,
47- VideoClassificationAnnotation ,
48- ScalarMetric ,
49- ConfusionMatrixMetric
50- ]] = []
39+ annotations : List [Union [ClassificationAnnotation , ObjectAnnotation ,
40+ VideoObjectAnnotation ,
41+ VideoClassificationAnnotation , ScalarMetric ,
42+ ConfusionMatrixMetric ]] = []
5143 extra : Dict [str , Any ] = {}
5244
5345 def object_annotations (self ) -> List [ObjectAnnotation ]:
@@ -63,13 +55,13 @@ def _get_annotations_by_type(self, annotation_type):
6355 ]
6456
6557 def frame_annotations (
66- self
58+ self
6759 ) -> Dict [str , Union [VideoObjectAnnotation , VideoClassificationAnnotation ]]:
6860 frame_dict = defaultdict (list )
6961 for annotation in self .annotations :
7062 if isinstance (
7163 annotation ,
72- (VideoObjectAnnotation , VideoClassificationAnnotation )):
64+ (VideoObjectAnnotation , VideoClassificationAnnotation )):
7365 frame_dict [annotation .frame ].append (annotation )
7466 return frame_dict
7567
0 commit comments