Skip to content

Commit 95cbc6e

Browse files
author
Val Brodsky
committed
Revert "Remove NDSegments"
This reverts commit a25b066.
1 parent a25b066 commit 95cbc6e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

libs/labelbox/src/labelbox/data/serialization/ndjson/label.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from .objects import (
3939
NDObject,
4040
NDObjectType,
41+
NDSegments,
4142
NDVideoMasks,
4243
)
4344
from .relationship import NDRelationship
@@ -48,6 +49,7 @@
4849
NDPromptClassificationType,
4950
NDConfusionMatrixMetric,
5051
NDScalarMetric,
52+
NDSegments,
5153
NDVideoMasks,
5254
NDRelationship,
5355
NDPromptText,
@@ -131,7 +133,15 @@ def _generate_annotations(
131133
# deserialized objects in the _AnnotationGroupTuple
132134
# object *if* the object can be used in a relationship
133135
for uuid, ndjson_annotation in group.ndjson_annotations.items():
134-
if isinstance(ndjson_annotation, NDVideoMasks):
136+
if isinstance(ndjson_annotation, NDSegments):
137+
annotations.extend(
138+
NDSegments.to_common(
139+
ndjson_annotation,
140+
ndjson_annotation.name,
141+
ndjson_annotation.schema_id,
142+
)
143+
)
144+
elif isinstance(ndjson_annotation, NDVideoMasks):
135145
annotations.append(
136146
NDVideoMasks.to_common(ndjson_annotation)
137147
)

libs/labelbox/src/labelbox/data/serialization/ndjson/objects.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ def lookup_object(
724724
) -> "NDObjectType":
725725
if isinstance(annotation, VideoMaskAnnotation):
726726
result = NDVideoMasks
727+
elif isinstance(annotation, list):
728+
result = NDSegments
727729
else:
728730
result = {
729731
Line: NDLine,

0 commit comments

Comments
 (0)