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
Applied Deep Learning with Keras

You're reading from   Applied Deep Learning with Keras Solve complex real-life problems with the simplicity of Keras

Arrow left icon
Product type Paperback
Published in Apr 2019
Publisher
ISBN-13 9781838555078
Length 412 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Ritesh Bhagwat Ritesh Bhagwat
Author Profile Icon Ritesh Bhagwat
Ritesh Bhagwat
Mahla Abdolahnejad Mahla Abdolahnejad
Author Profile Icon Mahla Abdolahnejad
Mahla Abdolahnejad
Matthew Moocarme Matthew Moocarme
Author Profile Icon Matthew Moocarme
Matthew Moocarme
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

About the Book
About the Authors
Learning Objectives
Audience
Approach
Hardware Requirements
Software Requirements
Conventions
Installation and Setup
Installing the Code Bundle
Additional Resources
1. Introduction to Machine Learning with Keras FREE CHAPTER 2. Machine Learning versus Deep Learning 3. Deep Learning with Keras 4. Evaluate Your Model with Cross-Validation using Keras Wrappers 5. Improving Model Accuracy 6. Model Evaluation 7. Computer Vision with Convolutional Neural Networks 8. Transfer Learning and Pre-Trained Models 9. Sequential Modeling with Recurrent Neural Networks 1. Appendix

Chapter 7: Computer Vision with Convolutional Neural Networks

Activity 13: Amending our Model with Multiple Layers and Use of SoftMax

Solution:

  1. Import the libraries and classes:

    #Import the Libraries

    from keras.models import Sequential from keras.layers import Conv2D from keras.layers import MaxPool2D from keras.layers import Flatten from keras.layers import Dense

  2. Now, initiate the model with a Sequential class:

    #Initiate the classifier

    classifier=Sequential()

  3. Add the first layer of the CNN, followed by the additional layers:

    classifier.add(Conv2D(32,3,3,input_shape=(64,64,3),activation=’relu’))

    classifier.add(Conv2D(32, (3, 3), activation = ‘relu’))

    classifier.add(Conv2D(32, (3, 3), activation = ‘relu’))

    32, (3,3) means that there are 32 feature detectors of size 3x3. As a best practice, always start with 32 and then you can add 64 or 128 later.

  4. Now, add the pooling layer with an image size of 2x2:

    classifier.add(MaxPool2D(2,2))

  5. The...
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