Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create masks_to_bboxes that returns tight bounding boxes #63

Merged

Conversation

wkentaro
Copy link
Owner

Why?

  • xmin, ymin will be consistent to xmax, ymax
  • can easily clip by np.clip.
  • bboxes = [[ymin, xmin, ymax, xmax], ...]
width, height = image.shape[:2]

ymin = bboxes[:, 0]
xmin = bboxes[:, 1]
ymax = bboxes[:, 2]
xmax = bboxes[:, 3]

ymin = np.clip(ymin, 0, height - 1)
ymax = np.clip(ymax, 0, height - 1)
xmin = np.clip(xmin, 0, width - 1)
xmax = np.clip(xmax, 0, width - 1)

@wkentaro wkentaro self-assigned this Dec 30, 2023
@wkentaro wkentaro force-pushed the create_masks_to_bboxes_that_returns_tight_bounding_boxes branch from 51e31af to 7a91048 Compare December 30, 2023 07:25
@wkentaro wkentaro merged commit b6bcbdc into main Dec 30, 2023
4 checks passed
@wkentaro wkentaro deleted the create_masks_to_bboxes_that_returns_tight_bounding_boxes branch December 30, 2023 07:27
@wkentaro wkentaro added the fix for pull requests label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix for pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant