Skip to content

Conversation

@Anirudh2112
Copy link
Contributor

Description

This PR fixes the restriction on negative offsets in the move_masks function. Previously, the function would raise a ValueError for negative offset values, but similar functions like move_detections and move_oriented_boxes support negative offsets. This change makes the behavior consistent across all movement functions.

Fixes #1715

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this change been tested

Added comprehensive unit tests covering:

  • Positive offset (existing behavior)
  • Negative offset (new behavior)
  • Zero offset
  • Partial out of bounds (positive)
  • Partial out of bounds (negative)
  • Multiple masks with different patterns

Example test case:

masks = np.array([[[True, True], [True, True]]])
offset = np.array([-1, -1])
resolution_wh = (3, 3)
result = move_masks(masks=masks, offset=offset, resolution_wh=resolution_wh)

@CLAassistant
Copy link

CLAassistant commented Dec 14, 2024

CLA assistant check
All committers have signed the CLA.

@SkalskiP
Copy link
Collaborator

Hi @Anirudh2112; thank you so much for your interest in Supervision and this specific task. I took the liberty of making a few changes to the solution you designed because I noticed it wasn’t working correctly with mixed offsets, for example, [-2, 2].

@SkalskiP SkalskiP merged commit dbade52 into roboflow:develop Dec 16, 2024
21 checks passed
@Anirudh2112
Copy link
Contributor Author

@SkalskiP, thank you for reviewing and improving the solution! This was a great learning experience for me in terms of handling edge cases and comprehensive testing. I'll be sure to consider such mixed cases in future contributions.

@SkalskiP
Copy link
Collaborator

@Anirudh2112 great to hear that; I can't wait to see your future contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

move_masks only supports movement in positive direction

3 participants