Skip to content

Commit

Permalink
Add changed to enable persistence of AL predictions in workflows + tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelPeczek-Roboflow committed Feb 14, 2024
1 parent e2b7c92 commit 69c88aa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inference/core/active_learning/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,5 @@ def is_prediction_registration_forbidden(
roboflow_image_id is None
or persist_predictions is False
or prediction.get("is_stub", False) is True
or len(prediction.get("predictions", [])) == 0
or (len(prediction.get("predictions", [])) == 0 and "top" not in prediction)
)
30 changes: 29 additions & 1 deletion tests/inference/unit_tests/core/active_learning/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def test_is_prediction_registration_forbidden_when_prediction_should_be_rejected
)

# then
assert result is True
assert result is False


def test_is_prediction_registration_forbidden_when_prediction_should_be_registered() -> (
Expand All @@ -754,3 +754,31 @@ def test_is_prediction_registration_forbidden_when_prediction_should_be_register

# then
assert result is False


def test_is_prediction_registration_forbidden_when_classification_output_only_with_top_category_provided() -> (
None
):
# when
result = is_prediction_registration_forbidden(
prediction={"top": "cat"},
persist_predictions=True,
roboflow_image_id="some+id",
)

# then
assert result is False


def test_is_prediction_registration_forbidden_when_detection_output_without_predictions_provided() -> (
None
):
# when
result = is_prediction_registration_forbidden(
prediction={"predictions": []},
persist_predictions=True,
roboflow_image_id="some+id",
)

# then
assert result is True

0 comments on commit 69c88aa

Please sign in to comment.