Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Fix color augmentation in TensorFlow object detection (#3176)
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyRoseman committed May 8, 2020
1 parent fd1f1fe commit 5a89e97
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,11 @@ def color_augmenter(
image = tf.image.adjust_brightness(image, brightness_delta)

# Apply the random adjustment to contrast.
log_sat = np.log(max_saturation)
saturation_delta = interpolate(random_alpha_tf[1], -log_sat, log_sat)
saturation_delta = interpolate(random_alpha_tf[1], 1/max_saturation, max_saturation)
image = tf.image.adjust_saturation(image, saturation_delta)

# Apply random adjustment to saturation.
log_con = np.log(max_contrast)
contrast_delta = interpolate(random_alpha_tf[2], -log_con, log_con)
contrast_delta = interpolate(random_alpha_tf[2], 1/max_contrast, max_contrast)
image = tf.image.adjust_contrast(image, contrast_delta)

image = tf.clip_by_value(image, 0, 1)
Expand Down

0 comments on commit 5a89e97

Please sign in to comment.