Home > database >  Random rotation function tensorflow
Random rotation function tensorflow

Time:10-08

data_augumentation=tf.keras.Sequential([
    layers.experimental.preprocessing.RandomFlip("horizantal_and_vertical"),
    layers.experimental.preprocessing.RandomRotation(0.2)
])

could someone let me know what does 0.2 represent in RandomRotation function

CodePudding user response:

From the official docs:

a float represented as fraction of 2 Pi, or a tuple of size 2 representing lower and upper bound for rotating clockwise and counter-clockwise. A positive values means rotating counter clock-wise, while a negative value means clock-wise. When represented as a single float, this value is used for both the upper and lower bound. For instance, factor=(-0.2, 0.3) results in an output rotation by a random amount in the range [-20% * 2pi, 30% * 2pi]. factor=0.2 results in an output rotating by a random amount in the range [-20% * 2pi, 20% * 2pi].

This way, this parameter defines rotation angle range as a fraction of 2 * Pi radians. In your exact case rotation angle range will be: from -0.4 * pi to 0.4 * pi

  • Related