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
Add frontend support for loading overlay masks from disk #2358
Add frontend support for loading overlay masks from disk #2358
Conversation
c9dcf4c
to
a778d73
Compare
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.
Looks good! Left some stylistic suggestions. Regardless, I assume this will be refactored some in the async work
const LABELS = new Set(VALID_LABEL_TYPES); | ||
const ALL_VALID_LABELS = new Set(VALID_LABEL_TYPES); | ||
|
||
const LABELS_THAT_CAN_HAVE_OVERLAYS_ON_DISK = new Set([ |
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.
I would propose naming this something like ARRAY_LABELS
and including in @fiftyone/utilities
with the other constants for reuse.
Object.hasOwn(label, overlayField) || | ||
!Object.hasOwn(label, overlayPathField) | ||
) { | ||
// nothing to be done |
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.
I would propose removing
// nothing to be done |
// convert absolute file path to a URL that we can "fetch" from | ||
const overlayPngImageUrl = getSampleSrc(label[overlayPathField] as string); |
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.
Maybe alias or rename getSampleSrc
so it is self-explanatory.
// convert absolute file path to a URL that we can "fetch" from | |
const overlayPngImageUrl = getSampleSrc(label[overlayPathField] as string); | |
const overlayPngImageUrl = expandToURL(label[overlayPathField] as string); |
* Some label types (example: segmentation, heatmap) can have their overlay data stored on-disk, | ||
* we want to impute the relevant mask property of these labels from what's stored in the disk | ||
*/ | ||
const imputeOverlayFromPath = async ( |
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.
Maybe rename to illustrate the comment?
const imputeOverlayFromPath = async ( | |
loadArrayLabels |
Thanks for the comments, @benjaminpkane, will address them in the next unit of segmentation work. |
What changes are proposed in this pull request?
Frontend support for loading overlay masks from disk
How is this patch tested? If it is not, please explain why.
Tested locally.
Release Notes
Is this a user-facing change that should be mentioned in the release notes?
notes for FiftyOne users.
Refer to #2301
What areas of FiftyOne does this PR affect?
fiftyone
Python library changes