Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def flip_images(X_imgs):
- X_flip = []
- tf.reset_default_graph()
- X = tf.placeholder(tf.float32, shape = (IMAGE_SIZE, IMAGE_SIZE, 3))
- tf_img1 = tf.image.flip_left_right(X)
- tf_img2 = tf.image.flip_up_down(X)
- tf_img3 = tf.image.transpose_image(X)
- with tf.Session() as sess:
- sess.run(tf.global_variables_initializer())
- for img in X_imgs:
- flipped_imgs = sess.run([tf_img1, tf_img2, tf_img3], feed_dict = {X: img})
- X_flip.extend(flipped_imgs)
- X_flip = np.array(X_flip, dtype = np.float32)
- return X_flip
- flipped_images = flip_images(X_imgs)
Add Comment
Please, Sign In to add comment