-
Notifications
You must be signed in to change notification settings - Fork 583
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
[FR] Support non-binary/grayscale masks in fo.Detection
#4961
Comments
I had a look at the Looker package which takes care of this. So roughly:
FWIW, I have tested this quick-n-dirty patch which is enough in our case (but this is a poor man solution): --- a/app/packages/looker/src/numpy.ts
+++ b/app/packages/looker/src/numpy.ts
@@ -158,6 +158,13 @@ function parse(array: Uint8Array): OverlayMask {
rawData.byteLength / ArrayType.BYTES_PER_ELEMENT
);
+ // Binarize mask with a hard coded threshold (= 127)
+ if (ArrayType === Uint8Array) {
+ for (let i = 0; i < typedData.length; i++) {
+ typedData[i] = typedData[i] >= 127 ? 255 : 0;
+ }
+ }
+
return {
arrayType: typedData.constructor.name,
buffer: typedData.buffer, Ideally, it would be great if the cc @brimoor does that make sense? Could we achieve something similar via the plugins framework? |
cc @benjaminpkane @sashankaryal: I'm onboard with supporting floating point instance masks. What do you think? |
I defer to @sashankaryal |
I'm open to it. With the work we did in #5120, it should be an easy lift. I'll own it. |
That's great! Just to be clear re: continuous masks, and to avoid any ambiguity w.r.t. "floating point" instance masks. In our case, we are currently storing masks with As stated above, we would greatly benefit from 1st class citizen support of such masks within the Looker package and on the UI side:
Hope that helps. |
Proposal Summary
Currently
fo.Detection
supports:In practice it is possible to store a [0, 1] float numpy array (i.e. a continuous mask), since there doesn't seem to be checks in place to prevent that. This is very useful when using/training segmentation models that operate on such continuous masks (i.e. non binary/thresholded masks) like MVANet, RMBG-1.4, BiRefNet, etc.
I was wondering if supporting continuous mask would be feasible in Fiftyone, because continuous masks currently are thresholded (at 0) in the UI, which often makes visualizing them difficult. Having the ability to enable, disable and change the threshold value in the UI would be very useful.
Note: Using continuous masks probably breaks some methods such as
to_polyline
andto_segmentation
, though I don't use them often so I don't know.What areas of FiftyOne does this feature affect?
fiftyone
Python libraryWillingness to contribute
The FiftyOne Community welcomes contributions! Would you or another member of your organization be willing to contribute an implementation of this feature?
The text was updated successfully, but these errors were encountered: