Commit 859f94a2 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower Committed by TF Object Detection Team
Browse files

Modify adjust_gamma method to only adjust rgb channels (or a single grayscale...

Modify adjust_gamma method to only adjust rgb channels (or a single grayscale channel), and to call tf.image.adjust_gamma on an image with values between 0 and 1.

PiperOrigin-RevId: 342911345
parent 90810a0e
......@@ -1062,7 +1062,13 @@ def adjust_gamma(image, gamma=1.0, gain=1.0):
image: image which is the same shape as input image.
"""
with tf.name_scope('AdjustGamma', values=[image]):
return tf.image.adjust_gamma(image, gamma, gain)
def _adjust_gamma(image):
image = tf.image.adjust_gamma(image / 255, gamma, gain) * 255
image = tf.clip_by_value(image, clip_value_min=0.0, clip_value_max=255.0)
return image
image = _augment_only_rgb_channels(image, _adjust_gamma)
return image
def random_adjust_brightness(image,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment