@@ -26,21 +26,18 @@ def rle_decoding(rle_arr: List[int], w: int, h: int) -> np.ndarray:
26
26
return mask .reshape ((w , h )).T
27
27
28
28
29
- def get_annotation_lookup (
30
- annotations : List [Union [ClassificationAnnotation , ObjectAnnotation ,
31
- VideoMaskAnnotation , ScalarMetric ,
32
- ConfusionMatrixMetric , RelationshipAnnotation ]]
33
- ) -> defaultdict [Any , list ]:
29
+ def get_annotation_lookup (annotations ):
34
30
"""Get annotations from Label.annotations objects
35
31
36
32
Args:
37
33
annotations (Label.annotations): Annotations attached to labelbox Label object used as private method
38
34
"""
39
35
annotation_lookup = defaultdict (list )
40
36
for annotation in annotations :
41
- annotation_lookup [getattr (annotation , 'image_id' , None ) or
42
- getattr (annotation , 'name' , None )].append (annotation )
43
- return annotation_lookup
37
+ # Provide a default value of None if the attribute doesn't exist
38
+ attribute_value = getattr (annotation , 'image_id' , None ) or getattr (annotation , 'name' , None )
39
+ annotation_lookup [attribute_value ].append (annotation )
40
+ return annotation_lookup
44
41
45
42
46
43
class SegmentInfo (pydantic_compat .BaseModel ):
0 commit comments