Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 11 additions & 5 deletions src/groundlight/binary_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@
class Label(str, Enum):
YES = "YES"
NO = "NO"
UNSURE = "UNSURE"
UNCLEAR = "UNCLEAR"


VALID_DISPLAY_LABELS = {Label.YES, Label.NO, Label.UNSURE}
VALID_DISPLAY_LABELS = {Label.YES, Label.NO, Label.UNCLEAR}


class DeprecatedLabel(str, Enum):
PASS = "PASS"
FAIL = "FAIL"
NEEDS_REVIEW = "NEEDS_REVIEW"
UNSURE = "__UNSURE"


DEPRECATED_LABEL_NAMES = {DeprecatedLabel.PASS, DeprecatedLabel.FAIL, DeprecatedLabel.NEEDS_REVIEW}
DEPRECATED_LABEL_NAMES = {
DeprecatedLabel.PASS,
DeprecatedLabel.FAIL,
DeprecatedLabel.NEEDS_REVIEW,
DeprecatedLabel.UNSURE,
}


def convert_internal_label_to_display(
Expand All @@ -47,8 +53,8 @@ def convert_internal_label_to_display(
return Label.YES
if upper in {Label.NO, DeprecatedLabel.FAIL}:
return Label.NO
if upper in {Label.UNSURE, DeprecatedLabel.NEEDS_REVIEW}:
return Label.UNSURE
if upper in {Label.UNCLEAR, DeprecatedLabel.NEEDS_REVIEW, DeprecatedLabel.UNSURE}:
return Label.UNCLEAR

logger.warning(f"Unrecognized internal label {label} - leaving it alone as a string.")
return label
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_groundlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def test_add_label_names(gl: Groundlight, image_query_yes: ImageQuery, image_que

# We may want to support something like this in the future, but not yet
with pytest.raises(ValueError):
gl.add_label(iqid_yes, Label.UNSURE)
gl.add_label(iqid_yes, Label.UNCLEAR)


def test_label_conversion_produces_strings():
Expand Down