Specifying the probability of applying an augmentation layer
See original GitHub issueShort Description The idea is to specify the probability rate at which a generic augmentation layer will be applied to the inputs. This can be achieved in two ways:
- Having a
RanomApply
layer which accepts the Augmentation Layer and the probability rate. The augmentation layer will be applied in accordance to the probability provided.
Pseudocode:
custom_random_flip = RandomApply(
layer=RandomFlip(),
rate=0.8
)
This would signify that we want our custom_random_flip
layer to be applied with a probability of 0.8
.
- Accepting a
rate
argument for all the augmentation layers prefixedRandom
. The suggestion is based on the assumption that these layers have a withoutRandom
counterpart, which does not need any probability rate. TheRandom<AUGMENATION_LAYER>
would accept therate
argument which would define with what probability should this layer be applied to the inputs.
Existing Implementations
- PyTorch transform RandomApply
- PyToch transform RandomHorizontalFlip with the
p
arguments.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Data augmentation | TensorFlow Core
This tutorial demonstrates data augmentation: a technique to increase the diversity of your training set by applying random (but realistic) transformations, ...
Read more >Image Augmentation with Keras Preprocessing Layers and tf ...
In this post, you will discover how you can use the Keras preprocessing layer as well as the tf. image module in TensorFlow...
Read more >Setting probabilities for transforms in an augmentation pipeline
Each augmentation inside Compose has a probability of being applied. p2 sets the probability of applying RandomRotate90 . In the example above, p2...
Read more >Tensorflow: Custom data augmentation - Stack Overflow
I'm trying to define a custom data augmentation layer. My goal is to call the existing tf.keras.layers.RandomZoom, with a probability.
Read more >Data Augmentation in Python: Everything You Need to Know
Write our own augmentation pipelines or layers using tf.image. ... and define a function that will visualize an image and then apply the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
An extension of this could be to allow the users to specify a list of augmentation transforms and the ability to set their probabilities. If individual probabilities are not specified default will be picked.
Just a minor nit for other participants:
RandomFlip in
keras.layers
applies flipping with a 50-50 chance already.I think you mean that
RandomApply
works similar toMaybeApply
, butRandomApply
works on the entire batch, whileMaybeApply
works on individual inputs within the batch?I think
RandomApply
would be interesting addition 😃