Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Python Deep Learning

You're reading from   Python Deep Learning Next generation techniques to revolutionize computer vision, AI, speech and data analysis

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781786464453
Length 406 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (4):
Arrow left icon
 Zocca Zocca
Author Profile Icon Zocca
Zocca
 Spacagna Spacagna
Author Profile Icon Spacagna
Spacagna
Daniel Slater Daniel Slater
Author Profile Icon Daniel Slater
Daniel Slater
 Roelants Roelants
Author Profile Icon Roelants
Roelants
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Python Deep Learning
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
1. Machine Learning – An Introduction FREE CHAPTER 2. Neural Networks 3. Deep Learning Fundamentals 4. Unsupervised Feature Learning 5. Image Recognition 6. Recurrent Neural Networks and Language Models 7. Deep Learning for Board Games 8. Deep Learning for Computer Games 9. Anomaly Detection 10. Building a Production-Ready Intrusion Detection System Index

A convolutional layer example with Keras for cifar10


We can now try to use the same network on the cifar10 dataset. In Chapter 3, Deep Learning Fundamentals, we were getting a low 50% accuracy on test data, and to test the new network we have just used for the mnist dataset, we need to just make a couple of small changes to our code: we need to load the cifar10 dataset (without doing any re-shaping, those lines will be deleted):

(X_train, Y_train), (X_test, Y_test) = cifar10.load_data()

And then change the input values for the first convolutional layer:

model.add(Convolution2D(32, (3, 3), input_shape=(32, 32, 3)))

Running this network for 5 epochs will give us around 60% accuracy (up from about 50%) and 66% accuracy after 10 epochs, but then the network starts to overfit and stops improving performance.

Of course the cifar10 images have 32 x 32 x 3 = 3072 pixels, instead of 28 x 28=784 pixels, so we may need to add a couple more convolutional layers, after the first two:

model.add(Convolution2D...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images