-
Notifications
You must be signed in to change notification settings - Fork 588
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
Support on-disk instance segmentations in SDK #5256
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,7 +409,8 @@ class Detection(_HasAttributesDict, _HasID, _HasMedia, Label): | |
its bounding box, which should be a 2D binary or 0/1 integer numpy | ||
array | ||
mask_path (None): the absolute path to the instance segmentation image | ||
on disk | ||
on disk, which should be a single-channel PNG image where any | ||
non-zero values represent the instance's extent | ||
Comment on lines
+412
to
+413
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the app technically doesn't mind multi-channel, too, but it makes sense that we write an imperative statement about masks being single-channel for clarity. if the app runs into multi-channel pngs for masks, it uses just the first channel There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see. I mostly copied this verbatim from the user guide documentation you had added:
But I was not certain whether single-channel was indeed a recommendation or a hard requirement, so the version here came out sounding more imperative just to be safe. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel free to clarify both instances of this documentation if you want! |
||
confidence (None): a confidence in ``[0, 1]`` for the detection | ||
index (None): an index for the object | ||
attributes ({}): a dict mapping attribute names to :class:`Attribute` | ||
|
@@ -532,8 +533,8 @@ def to_segmentation(self, mask=None, frame_size=None, target=255): | |
""" | ||
if not self.has_mask: | ||
raise ValueError( | ||
"Only detections with their `mask` attributes populated can " | ||
"be converted to segmentations" | ||
"Only detections with their `mask` or `mask_path` attribute " | ||
"populated can be converted to segmentations" | ||
) | ||
|
||
mask, target = _parse_segmentation_target(mask, frame_size, target) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change: Method signature updated
The
_get_media_fields
method signature has changed frominclude_filepath
towhitelist/blacklist
parameters. This is a breaking change that may affect existing code that calls this method.Consider: