-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Targets that should be ignored #1771
Comments
Thanks. Applying transforms, without wrapping with Compose, typically leads to enexpected bugs => better to always wrap with compose. At the same time adding Will work on this. |
Do you use single transform or inside Compose? |
Ayasyrev is right. I found that I have always wrapped transforms with Compose. So the situation I described in this issue is limited to transforms that are wrapped with Compose. I will update this issue to make sure it. |
By the way, this is a bit unintuitive for me (albumentations 1.4.8). >>> tr = A.Compose([A.Blur()])
>>> tr.add_targets({'mask2': 'mask'})
>>> out = tr(image=np.zeros((2, 2, 3)), mask2=np.zeros((2, 2, 3)))
Traceback (most recent call last):
...
ValueError: Key mask2 is not in available keys.
>>> tr = A.Compose([A.Flip()])
>>> tr.add_targets({'mask2': 'mask'})
>>> out = tr(image=np.zeros((2, 2, 3)), mask2=np.zeros((2, 2, 3)))
>>> I encountered it when I compiling an example case of this issue. |
It does not look right to me eigher. |
I feel that checking against |
This is not OK. Will fix it, |
The reason why you get error here - |
@ayasyrev Yes, |
I mean the example in the documentation may not work if we use an |
Feature description
We need a way to declare a target that will be ignored by
Compose
-wrapped transforms.Motivation and context
Let say, we have a following data and
Compose
-wrapped transforms.What we want to do is applying the transformation on
image
andmask
buttext_description
without manipulating the data.Before #1706,
Compose
simply ignored all unknown keys. As a result, the above code worked "as expected" (as a byproduct of an issue solved by the pr).However, current transforms check args by default.
I expected that we have a way to declare the
text_description
being ignored, e.g.,transform.add_targets({'text_description': 'ignore'})
. But in the current albumentations, this kind of declaration does not work and raises ValueError when it is called.Alternatives
A currently available workaround is setting
is_check_args
of theCompose
object to beFalse
. The workaround skips all argument checks added by #1706.The text was updated successfully, but these errors were encountered: