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

Handle empty polylines #642

Merged
merged 1 commit into from
Jan 1, 2025
Merged

Handle empty polylines #642

merged 1 commit into from
Jan 1, 2025

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Dec 29, 2024

Resolves #641

import numpy as np
import fiftyone as fo

polyline = fo.Polyline(points=[])

detection = polyline.to_detection()
assert np.allclose(detection.bounding_box, [0, 0, 0, 0])

detection = polyline.to_detection(mask_size=(2, 2))
assert np.allclose(detection.bounding_box, [0, 0, 0, 0])
assert np.allclose(detection.mask, [[False, False], [False, False]])

Copy link

@minhtuev minhtuev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks Brian!

In [1]: import numpy as np
   ...: import fiftyone as fo
   ...:
   ...: polyline = fo.Polyline(points=[])
   ...:
   ...: detection = polyline.to_detection()
   ...: assert np.allclose(detection.bounding_box, [0, 0, 0, 0])
   ...:
   ...: detection = polyline.to_detection(mask_size=(2, 2))
   ...: assert np.allclose(detection.bounding_box, [0, 0, 0, 0])
   ...: assert np.allclose(detection.mask, [[False, False], [False, False]])

In [2]:

@brimoor brimoor merged commit 9bff4d4 into develop Jan 1, 2025
@brimoor brimoor deleted the bugfix/iss-641 branch January 1, 2025 22:19
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.

render_bounding_box fail on polyline with no vertex
2 participants