-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Fill colors for tensor affine transforms #2887
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
Comments
FYI it is possible to let torchvision implementation support different fill colors than 0 despite |
Thanks! it could be a good enough workaround for now. |
@voldemortX following @fmassa 's idea, it could be also possible to append this data mask to the input image as additional channel and apply grid_sample once. We think that such solution can be added to torchvision. If you would like to work on that, it would be helpful 👍 . |
I can try it out, but thinking more on it i'm a bit confused right now. shouldn't the easiest way be replacing the 0 afterwards? |
What do you mean by replacing the 0 ? |
Oh right, I understand now, the original image could have 0. |
I can try it tomorrow or something (UTC-8), but I have not contributed any code before, is unit tests required for a patch like this? |
Sounds good ! Let me describe how I'd do that and put some links on the code to modify a bit later. Yes, tests are required. To start contributing, please read this draft CONTRIBUTING guide. EDIT:
|
Ok, thanks. |
Said feature is now supported. |
🚀 Feature
Support fill color other than 0 for tensor affine transforms (rotate, affine).
Motivation
It is important for pixel-wise tasks (e.g. segmentation) to have different fill color for ignored label (e.g. 255).
Pitch
Different fill colors are supported for tensors like already supported for PIL images in affine transformations.
Specifically, for rotate() and affine() in transforms/functional_tensor.py.
Alternatives
None at the moment.
Additional context
The requested feature was not supported in the recently completed tensor/PIL unification process #2292 probably due to pytorch grid_sampler(), which is what the implementations based on, does not seem to support fill colors other than 0.
@vfdev-5
The text was updated successfully, but these errors were encountered: