Data input

A quick browse of the images should convince you that you that our images all vary in resolution and size. As you know from Chapter 7, Convolutional Neural Networks, however, we will need these images to be a consistent size for our neural network's input tensor. This is a very real-world problem that you'll often face with computer vision tasks. While it's certainly possible to use a program such as ImageMagick (http://www.imagemagick.org) to batch resize our images, the Keras ImageDataGenerator class can be used to resize images on the fly, which is what we will do.

Inception-V3 expects 299 x 299 x 3 images. We can specify this target size in the data generators, as shown in the following code:

train_datagen = ImageDataGenerator( ...

Get Deep Learning Quick Reference 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.