Skip to content

Commit c613012

Browse files
authored
Create image_flipping.py
1 parent 55bf72d commit c613012

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

image_processing/image_flipping.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
def image_flipping(images):
3+
"""
4+
One technique of data augmentation
5+
randomly flip the image horizontally from left to right
6+
"""
7+
images = tf.reshape(images, [-1, 32, 32, 3])
8+
distorted_image = tf.map_fn(lambda img: tf.image.random_flip_left_right(img), images)
9+
distorted_image = tf.reshape(distorted_image, [-1, 32*32*3])
10+
return distorted_image
11+
12+

0 commit comments

Comments
 (0)