tensorflow-deep-learning icon indicating copy to clipboard operation
tensorflow-deep-learning copied to clipboard

plotting augmented_img broken

Open sched088 opened this issue 3 years ago • 1 comments

When plotting augmented_img we obtain the same image as the original random image. This was confirmed by rerunning the original class notebook.

sched088 avatar Jul 01 '22 04:07 sched088

view a random image and compare it with augmented images

import matplotlib.pyplot as plt import matplotlib.image as mpimg import os import random target_class = random.choice(train_data_1_percent.class_names) target_dir = os.path.join(train_path_1per, target_class) random_image = random.choice(os.listdir(target_dir)) random_image_path = os.path.join(target_dir, random_image)

read and plot in the random image

img = mpimg.imread(random_image_path) plt.imshow(img) plt.title(f"Original image: {target_class}") plt.axis(False);

plot augmented image

augmented_img = data_augmentation(img, training=True) plt.figure() plt.imshow(tf.squeeze(augmented_img)/255.) plt.title(f"Augmented image: {target_class}") plt.axis(False);

yhunlu avatar Apr 03 '23 21:04 yhunlu