Code Monkey home page Code Monkey logo

Comments (10)

daitakahashi avatar daitakahashi commented on July 23, 2024 2

I mean the example in the documentation may not work if we use an ImageOnlyTransform, e.g., GaussianBlur, instead of the HorizontalFlip (note: I haven't tried yet).

from albumentations.

ternaus avatar ternaus commented on July 23, 2024 1

It does not look right to me eigher.

from albumentations.

ayasyrev avatar ayasyrev commented on July 23, 2024 1

I encountered it when I compiling an example case of this issue.

This is not OK. Will fix it,

from albumentations.

ternaus avatar ternaus commented on July 23, 2024

Thanks.

Applying transforms, without wrapping with Compose, typically leads to enexpected bugs => better to always wrap with compose.

At the same time adding is_check_args parameter to transforms looks quite doable, and if user knows that they are doing - why not have such functionality?

Will work on this.

from albumentations.

ayasyrev avatar ayasyrev commented on July 23, 2024

Do you use single transform or inside Compose?
Single transform don`t check keys - just ignores unused keys.

from albumentations.

daitakahashi avatar daitakahashi commented on July 23, 2024

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.

from albumentations.

daitakahashi avatar daitakahashi commented on July 23, 2024

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.

from albumentations.

daitakahashi avatar daitakahashi commented on July 23, 2024

I feel that checking against _available_keys seems to be too restrictive as _available_keys depends on transforms inside and key-permissive nature of those transforms.

from albumentations.

ayasyrev avatar ayasyrev commented on July 23, 2024

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.

The reason why you get error here - Blur is ImageOnly transform, so masks not processed here and add some additional key for mask make not many sense. But as mask is special case, I'll add this possibility.

from albumentations.

daitakahashi avatar daitakahashi commented on July 23, 2024

@ayasyrev Yes, Blur() is imageonly, I understand it. I'm concerning a case of trying out several combinations of transformations to a predefined dataset (I often do such experiments, so my concern may be biased). Anyway, I want the transforms not to crash regardless of the data format and algorithms inside.
A.Compose([A.Flip(p=0), A.Blur()]) will work for most of data if we declare key-target pairs by add_targets(), because Flip knows mask, bboxes, and keypoints. But this doesn't look nice.

from albumentations.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.