nurasaki
nurasaki

Reputation: 109

Randomness in Keras/Tensorflow RandomFlip (data augmentation)

In Keras/Tensorflow, the RandomFlip layer used in data augmentation, it us supposed that the operation is applied randomly to each image as it passes through the layer during training.

https://devdocs.io/tensorflow~2.3/keras/layers/experimental/preprocessing/randomflip

I want to know about the randomness of the operation, theres is a seed parameter for reproducibility, but I can't find any other information in the documentation. Asking ChatGPT, I got the following answer:

How RandomFlip Works:

Randomness: 
The RandomFlip layer applies the specified flipping operation (horizontal, vertical, or both) randomly to each image in the batch it processes.

Probability: 
By default, the probability that each image will be flipped is 0.5, or 50%. 
This means that on average, half of the images in any given batch during training will be flipped according to the specified mode.

I'm asking here: Is there any official documentation that confirms this information? How can I change the probability factor?

Here is a similar question: How to set possbility to tf.keras.layers.RandomFlip?

But I would like to know wether the default probability is 50% or not.

If it is really a 50%, then the proposed solution to the given question seems to apply the randomness twice (p, for the paramter + 50% as the default value), so the final factor is p*50%.

Thanks

Upvotes: 0

Views: 217

Answers (0)

Related Questions