Skip to content

Instantly share code, notes, and snippets.

@Prasad9
Last active October 21, 2017 03:41
Show Gist options
  • Select an option

  • Save Prasad9/b042cb649c62d7ee13e6a25bdc17f103 to your computer and use it in GitHub Desktop.

Select an option

Save Prasad9/b042cb649c62d7ee13e6a25bdc17f103 to your computer and use it in GitHub Desktop.

Revisions

  1. Prasad9 revised this gist Oct 21, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion flip_images.py
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,4 @@ def flip_images(X_imgs):
    X_flip = np.array(X_flip, dtype = np.float32)
    return X_flip

    flipped_images = flip_images(X_data)
    flipped_images = flip_images(X_imgs)
  2. Prasad9 revised this gist Oct 20, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion flip_images.py
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,4 @@ def flip_images(X_imgs):
    X_flip = np.array(X_flip, dtype = np.float32)
    return X_flip

    flipped_images = flip_images(X_data)
    flipped_images = flip_images(X_data)
  3. Prasad9 created this gist Oct 20, 2017.
    16 changes: 16 additions & 0 deletions flip_images.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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_data)