Skip to Content
Deep Learning with Keras
book

Deep Learning with Keras

by Antonio Gulli, Sujit Pal
April 2017
Intermediate to advanced
318 pages
7h 40m
English
Packt Publishing
Content preview from Deep Learning with Keras

Improving the CIFAR-10 performance with data augmentation

Another way to improve the performance is to generate more images for our training. The key intuition is that we can take the standard CIFAR training set and augment this set with multiple types of transformations including rotation, rescaling, horizontal/vertical flip, zooming, channel shift, and many more. Let us see the code:

from keras.preprocessing.image import ImageDataGeneratorfrom keras.datasets import cifar10import numpy as npNUM_TO_AUGMENT=5#load dataset(X_train, y_train), (X_test, y_test) = cifar10.load_data()# augumentingprint("Augmenting training set images...")datagen = ImageDataGenerator(rotation_range=40,width_shift_range=0.2,height_shift_range=0.2,zoom_range=0.2, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Advanced Deep Learning with Keras

Advanced Deep Learning with Keras

Rowel Atienza, Neeraj Verma, Valerio Maggio
Deep Learning with TensorFlow 2 and Keras - Second Edition

Deep Learning with TensorFlow 2 and Keras - Second Edition

Antonio Gulli, Dr. Amita Kapoor, Sujit Pal

Publisher Resources

ISBN: 9781787128422Supplemental Content