Creating the image data

The first step is to create the image files. The code for this section is in the Chapter11/gen_cifar10_data.R folder. We will load the CIFAR10 data and save the image files in the data directory. The first step is to create the directory structure. There are 10 classes in the CIFAR10 dataset: we will save 8 classes for building a model and we will use 2 classes in a later section (Transfer learning). The following code creates the following directories under data:

  • cifar_10_images
  • cifar_10_images/data1
  • cifar_10_images/data2
  • cifar_10_images/data1/train
  • cifar_10_images/data1/valid
  • cifar_10_images/data2/train
  • cifar_10_images/data2/valid

This is the structure that Keras expects image data to be stored in. If you use this ...

Get Deep Learning with R for Beginners 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.