-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Set masks to zero where masks overlap #8213
Conversation
…in draw_segmentation_masks
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/8213
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (32 Unrelated Failures)As of commit 967fd1f with merge base 660868b (): FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Hi @sam-watts! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
In cases where a user might want to display overlapping segmentation masks (eg. ground truth vs. prediction) the current function is not suitable as it overwrites colours, meaning that masks processed first are not fully visible: A simple fix is to use iterative multiplicative blending, which shows decent results even in the presence of multiple overlapping masks: code for examples:
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Outstanding question - do we want to include extra logic in |
Thanks a lot for this nice addition @sam-watts . The code LGTM.
Yes please! In order to keep it simple, I guess we would have to stop randomly generate the test masks, and instead manually generate 2 masks. 2 overlapping squares should do the job? |
FYI @NicolasHug I simplified the code, as it was not working in certain cases. Instead of blending masks we now set areas to zero where there is more than one mask. This has the benefit of also working well when uint8 images are used instead of [0-1] floats Tests now added New version looks like this: |
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.
Thanks a lot @sam-watts ! Just one question about the addition of pillow
to the dev dependencies, but otherwise LGTM!
CONTRIBUTING.md
Outdated
@@ -74,7 +74,7 @@ We don't officially support building from source using `pip`, but _if_ you do, y | |||
#### Other development dependencies (some of these are needed to run tests): | |||
|
|||
``` | |||
pip install expecttest flake8 typing mypy pytest pytest-mock scipy | |||
pip install expecttest flake8 typing mypy pytest pytest-mock scipy pillow |
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.
That shouldn't be needed here as it's already a hard-dependency of torchvision, so it should get installed when you install torchvision from source.
Curious if you encounter any issue here?
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.
hmmm odd. I remember having to install it manually after building from source, as I got a package not installed error from the tests. I'm not familiar with the internals of python setup.py develop
, but I can say that I've used pip install -e .
instead before. There is some discussion on SO about dependencies not being handled correctly with the former, but I'm not sure how much weight to give that.
Happy to remove this though, I may have just done something odd / could be a personal configuration issue
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.
Thanks for the info - let me just remove this so we can move forward with this PR and if we're getting more reports about this I'll investigate. Thank you!
Reviewed By: vmoens Differential Revision: D55062792 fbshipit-source-id: e76e7e5596a619239cf3e01f9fbc7a7d0002504c Co-authored-by: Nicolas Hug <[email protected]> Co-authored-by: Nicolas Hug <[email protected]>
No description provided.