Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jiemojiemo/0f7768418d15aeb267ea457503d07611 to your computer and use it in GitHub Desktop.
Save jiemojiemo/0f7768418d15aeb267ea457503d07611 to your computer and use it in GitHub Desktop.
Tensorflow Add Gaussian Noise
def add_gaussian_noise(image):
# image must be scaled in [0, 1]
with tf.name_scope('Add_gaussian_noise'):
noise = tf.random_normal(shape=tf.shape(image), mean=0.0, stddev=(50)/(255), dtype=tf.float32)
noise_img = image + noise
noise_img = tf.clip_by_value(noise_img, 0.0, 1.0)
return noise_img
@Dizoner16
Copy link

You helped me a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment