- Let's first load all the necessary libraries:
import numpy as npimport cv2import matplotlib.pyplot as pltimport glob
- Next, we load some sample images that we will use and plot them:
DATA_DIR = 'Data/augmentation/'images = glob.glob(DATA_DIR + '*')plt.figure(figsize=(10, 10))i = 1for image in images: img = cv2.imread(image) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) plt.subplot(3, 3, i) plt.imshow(img) i += 1 plt.show()
Figure 7.1: Example images that we will be using for augmentation
- We start by defining a function to easily plot examples of our augmentations:
def plot_images(image, function, *args): plt.figure(figsize=(10, ...