Skip to content

Instantly share code, notes, and snippets.

View Dizoner16's full-sized avatar
🎯
Trying hard

Dizoner Dizoner16

🎯
Trying hard
View GitHub Profile
@jiemojiemo
jiemojiemo / gist:0f7768418d15aeb267ea457503d07611
Created May 17, 2018 07:11
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