Open sched088 opened 2 years ago
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)
img = mpimg.imread(random_image_path) plt.imshow(img) plt.title(f"Original image: {target_class}") plt.axis(False);
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);
When plotting augmented_img we obtain the same image as the original random image. This was confirmed by rerunning the original class notebook.