Evizero / Augmentor.jl

A fast image augmentation library in Julia for machine learning.
https://evizero.github.io/Augmentor.jl/
Other
138 stars 46 forks source link

Adding non-geometric augmentations #16

Open Paethon opened 6 years ago

Paethon commented 6 years ago

Hi

I wanted to ask whether non-geometric augmentations would fit into Augmentor.jl

Especially things like brightness, contrast, white balance, etc. https://github.com/aleju/imgaug has a quite wide array of image augmentations. All of them is probably a bit overkill, but a few would be useful I think.

If you think this would fit into the package I would start on adding a few additional augmentations.

Evizero commented 6 years ago

Actually, I really want to add these kinds of augmentation strategies. I just didn't get around to doing them yet.

If that is something you'd be interested in contributing I'd be very happy to provide guidance along the way. Probably a first good step is to make a list of possible additions and think about their properties. Surely some are less effort to add than others, especially if some version of it is already available in the JuliaImages ecosystem.

Paethon commented 6 years ago

Thanks! I will have a look into what to add and how it might fit into the package and will come back to you.

barucden commented 3 years ago

Hi, I would like to revive this issue. I am missing blurring and brightness/contrast adjustments. I believe that these two are good to start with:

  1. Brightness & Contrast: parameters a, b so that out[i] = a * img[i] + b * mean(img)
  2. Gaussian blur: kernel size k and standard deviation s

It should be possible to define ranges from which the parameters are picked randomly, too.

My proposal is based on Albumentations as that is the library that I have worked with.

I guess that (1) can be implemented easily, and for (2) we could use ImageFiltering.jl.

Is this acceptable? If so, I can try to come up with an implementation.

johnnychen94 commented 3 years ago

Using ImageFiltering sounds okay to me since it's already in the Project.toml dependency.

barucden commented 3 years ago

Okay, great!

I have some questions regarding the implementation. Let's consider the brightness & contrast adjustment for now.

  1. I guess eager application is straightforward, but I could imagine a lazy one too (create a custom implementation of AbstractArray and define getindex so that it returns the adjusted pixel). Do I implement both approaches, or do I pick just one (eager is simpler here)?
  2. Which internal methods need to be defined for Augmentor to work? Is it only randparam and the appropriate support_* and apply*?
johnnychen94 commented 3 years ago

Do I implement both approaches, or do I pick just one (eager is simpler here)?

It's up to you. If you choose to only implement eager version then please leave a comment and an issue for the lazy version.

create a custom implementation of AbstractArray and define getindex so that it returns the adjusted pixel

FWIW, MappedArrays provides a lazy evaluation purpose, but it's not always type stable.

Which internal methods need to be defined for Augmentor to work?

You can take a look at https://github.com/Evizero/Augmentor.jl/pull/64 for an example.