Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions fastlabel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2517,12 +2517,16 @@ def export_semantic_segmentation(
When start_index is 0, all pixels are assumed to have annotations
because they become the same color as the background(Optional).
"""
if len(classes) == 0:

# Copy classes to target_classes
# so that it is not added as a default argument.
target_classes = classes.copy()
if len(target_classes) == 0:
for task in tasks:
for annotation in task["annotations"]:
classes.append(annotation["value"])
classes = list(set(classes))
classes.sort()
target_classes.append(annotation["value"])
target_classes = list(set(target_classes))
target_classes.sort()

tasks = converters.to_pixel_coordinates(tasks)
for task in tasks:
Expand All @@ -2531,7 +2535,7 @@ def export_semantic_segmentation(
output_dir=output_dir,
pallete=pallete,
is_instance_segmentation=False,
classes=classes,
classes=target_classes,
start_index=start_index,
)

Expand Down