-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
iaa.Grayscale may be more intuitive if it defaulted to alpha=1 #315
Comments
I guess this is similar to the request in aleju/imgaug-doc#7 .
Note sure yet which one of these choices is the best one in the long run. (1) Removing them is annoying for the user, (2) setting defaults that are sensible for augmentation can lead to very confusing bugs, and (3) setting the defaults for non-augmentation looks elegantly, but incurs risk that people train accidentally with bad augmentations. |
How so? I feel like if a user adds an augmenter they intent it to do something. Of course not all augmentations are appropriate for all images, and "sensible values" may just clobber all the image information in some cases. However, the user should expect that augmenters are doing something and if they see weird bugs I would think the natural thing to do is turning off augmenters to find the offending one. I personally like option 2 the best. |
(2) can be confusing if you use augmenters on their own. image = imageio.imread(image_path)
image_gray = Grayscale()(image=image) then you might expect your loaded image to be in grayscale, assuming that the grayscale augmenter is defined as For grayscale that isn't that bad as there is a high chance of hitting an alpha around 0.5, giving away that there is something "wrong" with the augmenter. But e.g. Fliplr at 50% probability does either flip or not flip, making it harder to debug when you aren't aware that it has an associated probability of being active. |
That makes sense. I'm familiar with this use case because I do sometimes use augmenters on their own. I can see how a non-noop defaults may cause confusion for developers. However, this is a catch-22 situation, because noop defaults also cause confusion for developers (i.e. "I used an augmenter, why didn't it do anything?"). Of course, the ultimate solution to both of these issues is documentation (which imgaug does an excellent job at providing), but I think tweaking the exiting defaults may result in a better tradeoff and reduce the total confusion encountered when using a new library. I've been giving this some thought, and I think the best choice might be on a per-augmenter basis. For instance, I don't think there is any "reasonable" default setting for something like All this is well and good, but just stating opinions isn't very useful for the growth of this library. Instead, perhaps its best to move this discussion towards creating a guideline for setting augmenter defaults. Here is my proposal: Modivation: imgaug is a library for stochastic on-the-fly image augmentation targeted towards training deep neural networks. It should be as simple as possible to create augmenters and compose custom augmentation schemes. As a guiding principle most augmenters are given defaults such that they have some small effect. It should be emphasized that while augmenters can be seeded to behave deterministically, they are implicitly random, and thus without explicit intervention, are likely to behave differently in each subsequent run.
// Note: Affine is the only augmenter I can think of that really think of that meets this criterion. PerspectiveTransform seems to me like it should actually have a small perturbing default.
My main point is that I think a user should simply be able to more-or-less blindly construct a list of augmenters without setting any parameters and (1) be able to immediately see them do something and (2) have that something be potentially useful for training a network. I'm currently doing this with the Anyway, let me know what you think. |
These proposals seem very sensible to me. I guess I will try to improve the defaults for the next version according to these guidelines.
So I assume that means that you would be more in favor of gearing the defaults towards augmentation, e.g.
For |
Tradeoffs are the name of the game in Computer Science 😄. And yes, I think the
I looked into the link in the docstring, and I think I have a decent understanding of the algorithm. My main point was that its nice that I don't have to really understand them to use them. While it only took me 5-10 minutes to click through the links, read the article, and grok it, its not always possible to devote that much time. I appreciate the design where I can simply drop it into my |
Yes, it's probably the best possible design choice. Will change it that way.
I see, makes sense! |
I'm writing this issue to propose a minor API change.
When using
iaa.Grayscale
, I was initially calling it with all default parameters and I was confused as to why my images still had color. Upon inspection of the docstring, I discovered thatalpha
defaults to zero, which explained the behavior I was seeing.While this is all perfectly sensible and consistent, my feeling is that it may be more intuitive to have the default parameters for
iaa.Grayscale
actually perform the de-saturation operation rather than defaulting to a no-op.While this is not a huge API change, it is still and API change, and this library is widely used, so I understand concerns about that. However, the library hasn't hit 1.0, yet so if the maintainer(s) think this proposal is sensible, now is the time to do it.
The text was updated successfully, but these errors were encountered: