Skip to content

Commit

Permalink
add square and bbox iun img bounds asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGamill-Sheffield committed Dec 10, 2024
1 parent 45d6046 commit f3f53ff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_unet_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ def test_make_bounding_box_square(
) -> None:
"""Test the make_bounding_box_square method."""
result = make_bounding_box_square(crop_min_row, crop_min_col, crop_max_row, crop_max_col, image_shape)
# check bbox within image bounds
assert result[0] >= 0
assert result[1] >= 0
assert result[2] <= image_shape[0]
assert result[3] <= image_shape[1]
# check if square
assert (result[2] - result[0]) == (result[3] - result[1])
# check bbox coords match
assert result == expected_indices


Expand Down

0 comments on commit f3f53ff

Please sign in to comment.