How to do it...

Now let's proceed to data processing:

  1. We start by defining a generator for the training and testing data. We will use these generators while loading data into our environment and perform real-time data augmentation:
# train generatortrain_augmentor = image_data_generator( rescale = 1/255, rotation_range = 300, width_shift_range = 0.15, height_shift_range = 0.15, shear_range = 0.2, zoom_range = 0.2, horizontal_flip = TRUE, fill_mode = "nearest")# test generatortest_augmentor <- image_data_generator(rescale = 1/255)

Now let's load the training, testing, and validation data into our environment:

# load train datatrain_data <- flow_images_from_directory( train_path, train_augmentor, target_size = c(150, 150), batch_size ...

Get Deep Learning with R Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.