0% found this document useful (0 votes)
14 views

Deep Learning for Computer Vision Image Classification Object Detection and Face Recognition in Python Jason Brownlee instant download

The document is a promotional material for the eBook 'Deep Learning for Computer Vision: Image Classification, Object Detection, and Face Recognition in Python' by Jason Brownlee, which covers foundational concepts and practical applications in computer vision using Python. It includes links to download the eBook and other related resources. Additionally, it contains disclaimers about the educational purpose of the content and copyright information.

Uploaded by

gaparadrarga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Deep Learning for Computer Vision Image Classification Object Detection and Face Recognition in Python Jason Brownlee instant download

The document is a promotional material for the eBook 'Deep Learning for Computer Vision: Image Classification, Object Detection, and Face Recognition in Python' by Jason Brownlee, which covers foundational concepts and practical applications in computer vision using Python. It includes links to download the eBook and other related resources. Additionally, it contains disclaimers about the educational purpose of the content and copyright information.

Uploaded by

gaparadrarga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Deep Learning for Computer Vision Image

Classification Object Detection and Face


Recognition in Python Jason Brownlee download

https://ebookmeta.com/product/deep-learning-for-computer-vision-
image-classification-object-detection-and-face-recognition-in-
python-jason-brownlee/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

Deep Learning for Computer Vision: Image


Classification, Object Detection, and Face Recognition
in Python Jason Brownlee

https://ebookmeta.com/product/deep-learning-for-computer-vision-
image-classification-object-detection-and-face-recognition-in-
python-jason-brownlee-2/

Computer Vision: Object Detection In Adversarial Vision


1st Edition Bhowmik

https://ebookmeta.com/product/computer-vision-object-detection-
in-adversarial-vision-1st-edition-bhowmik/

Learn OpenCV with Python by Examples Implement Computer


Vision Algorithms Provided by OpenCV with Python for
Image Processing Object Detection and Machine Learning
2nd Edition James Chen
https://ebookmeta.com/product/learn-opencv-with-python-by-
examples-implement-computer-vision-algorithms-provided-by-opencv-
with-python-for-image-processing-object-detection-and-machine-
learning-2nd-edition-james-chen/

Find Your Way Home (Small Town Dreams #1) 1st Edition
Jackie Ashenden

https://ebookmeta.com/product/find-your-way-home-small-town-
dreams-1-1st-edition-jackie-ashenden/
When the King Comes Home 1st Edition Caroline
Stevermer.

https://ebookmeta.com/product/when-the-king-comes-home-1st-
edition-caroline-stevermer/

Ferment : A Guide to the Ancient Art of Culturing


Foods, from Kombucha to Sourdough Holly Davis

https://ebookmeta.com/product/ferment-a-guide-to-the-ancient-art-
of-culturing-foods-from-kombucha-to-sourdough-holly-davis/

Phoenix Reborn An Alpha Pack Novella J D Tyler

https://ebookmeta.com/product/phoenix-reborn-an-alpha-pack-
novella-j-d-tyler/

Migrating ASP.NET Microservices to ASP.NET Core: By


Example 1st Edition Iris Classon

https://ebookmeta.com/product/migrating-asp-net-microservices-to-
asp-net-core-by-example-1st-edition-iris-classon/

Pediatric Mental Health: A Compendium of AAP Clinical


Practice Guidelines and Policies 1st Edition American
Academy Of Pediatrics (Aap)

https://ebookmeta.com/product/pediatric-mental-health-a-
compendium-of-aap-clinical-practice-guidelines-and-policies-1st-
edition-american-academy-of-pediatrics-aap/
The Glorious Bastard. 1st Edition Sadie Bosque.

https://ebookmeta.com/product/the-glorious-bastard-1st-edition-
sadie-bosque/
Deep Learning for
Computer Vision

Image Classification, Object Detection


and Face Recognition in Python

Jason Brownlee
i

Disclaimer
The information contained within this eBook is strictly for educational purposes. If you wish to apply
ideas contained in this eBook, you are taking full responsibility for your actions.
The author has made every effort to ensure the accuracy of the information within this book was
correct at time of publication. The author does not assume and hereby disclaims any liability to any
party for any loss, damage, or disruption caused by errors or omissions, whether such errors or
omissions result from accident, negligence, or any other cause.
No part of this eBook may be reproduced or transmitted in any form or by any means, electronic or
mechanical, recording or by any information storage and retrieval system, without written permission
from the author.

Acknowledgements
Special thanks to my proofreader Sarah Martin and my technical editors Arun Koshy, Andrei
Cheremskoy, and Michael Sanderson.

Copyright

➞ Copyright 2019 Jason Brownlee. All Rights Reserved.


Deep Learning for Computer Vision

Edition: v1.4
Contents

Copyright i

Contents ii

Preface iii

Introductions v
Welcome v

I Foundations 1
1 Introduction to Computer Vision 3
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Desire for Computers to See . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 What Is Computer Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Challenge of Computer Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.5 Tasks in Computer Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.6 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2 Promise of Deep Learning for Computer Vision 9


2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Promises of Deep Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Types of Deep Learning Network Models . . . . . . . . . . . . . . . . . . . . . . 13
2.4 Types of Computer Vision Problems . . . . . . . . . . . . . . . . . . . . . . . . 14
2.5 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3 How to Develop Deep Learning Models With Keras 16


3.1 Keras Model Life-Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.2 Keras Functional Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3 Standard Network Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.4 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

ii
CONTENTS iii

II Image Data Preparation 29


4 How to Load and Manipulate Images With PIL/Pillow 31
4.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.2 How to Install Pillow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.3 How to Load and Display Images . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.4 How to Convert Images to NumPy Arrays and Back . . . . . . . . . . . . . . . . 34
4.5 How to Save Images to File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.6 How to Resize Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.7 How to Flip, Rotate, and Crop Images . . . . . . . . . . . . . . . . . . . . . . . 40
4.8 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.9 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

5 How to Manually Scale Image Pixel Data 45


5.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.2 Sample Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5.3 Normalize Pixel Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.4 Center Pixel Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5.5 Standardize Pixel Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
5.6 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.7 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

6 How to Load and Manipulate Images with Keras 55


6.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.2 Test Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.3 Keras Image Processing API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.4 How to Load an Image with Keras . . . . . . . . . . . . . . . . . . . . . . . . . 57
6.5 How to Convert an Image With Keras . . . . . . . . . . . . . . . . . . . . . . . 58
6.6 How to Save an Image With Keras . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
6.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

7 How to Scale Image Pixel Data with Keras 62


7.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.2 MNIST Handwritten Image Classification Dataset . . . . . . . . . . . . . . . . . 63
7.3 ImageDataGenerator Class for Pixel Scaling . . . . . . . . . . . . . . . . . . . . 64
7.4 How to Normalize Images With ImageDataGenerator . . . . . . . . . . . . . . . 65
7.5 How to Center Images With ImageDataGenerator . . . . . . . . . . . . . . . . . 67
7.6 How to Standardize Images With ImageDataGenerator . . . . . . . . . . . . . . 69
7.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
CONTENTS iv

8 How to Load Large Datasets From Directories with Keras 73


8.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
8.2 Dataset Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
8.3 Example Dataset Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
8.4 How to Progressively Load Images . . . . . . . . . . . . . . . . . . . . . . . . . . 77
8.5 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
8.6 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
8.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

9 How to Use Image Data Augmentation in Keras 82


9.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
9.2 Image Data Augmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
9.3 Sample Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
9.4 Image Augmentation With ImageDataGenerator . . . . . . . . . . . . . . . . . 84
9.5 Horizontal and Vertical Shift Augmentation . . . . . . . . . . . . . . . . . . . . 86
9.6 Horizontal and Vertical Flip Augmentation . . . . . . . . . . . . . . . . . . . . . 89
9.7 Random Rotation Augmentation . . . . . . . . . . . . . . . . . . . . . . . . . . 91
9.8 Random Brightness Augmentation . . . . . . . . . . . . . . . . . . . . . . . . . 92
9.9 Random Zoom Augmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
9.10 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
9.11 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
9.12 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

III Convolutions and Pooling 97


10 How to Use Different Color Channel Ordering Formats 99
10.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
10.2 Images as 3D Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
10.3 Manipulating Image Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.4 Keras Channel Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
10.5 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
10.6 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
10.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

11 How Convolutional Layers Work 108


11.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
11.2 Convolution in Convolutional Neural Networks . . . . . . . . . . . . . . . . . . . 109
11.3 Convolution in Computer Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
11.4 Power of Learned Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
11.5 Worked Example of Convolutional Layers . . . . . . . . . . . . . . . . . . . . . . 112
11.6 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11.7 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
CONTENTS v

12 How to Use Filter Size, Padding, and Stride 121


12.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
12.2 Convolutional Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
12.3 Problem of Border Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
12.4 Effect of Filter Size (Kernel Size) . . . . . . . . . . . . . . . . . . . . . . . . . . 126
12.5 Fix the Border Effect Problem With Padding . . . . . . . . . . . . . . . . . . . 128
12.6 Downsample Input With Stride . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
12.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
12.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
12.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

13 How Pooling Layers Work 133


13.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
13.2 Pooling Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
13.3 Detecting Vertical Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
13.4 Average Pooling Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
13.5 Max Pooling Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
13.6 Global Pooling Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
13.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
13.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
13.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

IV Convolutional Neural Networks 146


14 ImageNet, ILSVRC, and Milestone Architectures 148
14.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
14.2 ImageNet Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
14.3 ImageNet Large Scale Visual Recognition Challenge (ILSVRC) . . . . . . . . . . 149
14.4 Deep Learning Milestones From ILSVRC . . . . . . . . . . . . . . . . . . . . . . 150
14.5 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
14.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

15 How Milestone Model Architectural Innovations Work 155


15.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
15.2 Architectural Design for CNNs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.3 LeNet-5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
15.4 AlexNet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
15.5 VGG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
15.6 Inception and GoogLeNet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
15.7 Residual Network or ResNet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
15.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
15.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
CONTENTS vi

16 How to Use 1x1 Convolutions to Manage Model Complexity 165


16.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
16.2 Convolutions Over Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
16.3 Problem of Too Many Feature Maps . . . . . . . . . . . . . . . . . . . . . . . . 166
16.4 Downsample Feature Maps With 1x1 Filters . . . . . . . . . . . . . . . . . . . . 167
16.5 Examples of How to Use 1x1 Convolutions . . . . . . . . . . . . . . . . . . . . . 167
16.6 Examples of 1x1 Filters in CNN Model Architectures . . . . . . . . . . . . . . . 170
16.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
16.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
16.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

17 How To Implement Model Architecture Innovations 175


17.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
17.2 How to implement VGG Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
17.3 How to Implement the Inception Module . . . . . . . . . . . . . . . . . . . . . . 181
17.4 How to Implement the Residual Module . . . . . . . . . . . . . . . . . . . . . . 185
17.5 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
17.6 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
17.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

18 How to Use Pre-Trained Models and Transfer Learning 190


18.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
18.2 What Is Transfer Learning? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
18.3 Transfer Learning for Image Recognition . . . . . . . . . . . . . . . . . . . . . . 191
18.4 How to Use Pre-Trained Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
18.5 Models for Transfer Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
18.6 Examples of Using Pre-Trained Models . . . . . . . . . . . . . . . . . . . . . . . 196
18.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
18.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
18.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

V Image Classification 205


19 How to Classify Black and White Photos of Clothing 207
19.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
19.2 Fashion-MNIST Clothing Classification . . . . . . . . . . . . . . . . . . . . . . . 208
19.3 Model Evaluation Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
19.4 How to Develop a Baseline Model . . . . . . . . . . . . . . . . . . . . . . . . . . 210
19.5 How to Develop an Improved Model . . . . . . . . . . . . . . . . . . . . . . . . . 219
19.6 How to Finalize the Model and Make Predictions . . . . . . . . . . . . . . . . . 228
19.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
19.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
19.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
CONTENTS vii

20 How to Classify Small Photos of Objects 235


20.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
20.2 CIFAR-10 Photo Classification Dataset . . . . . . . . . . . . . . . . . . . . . . . 236
20.3 Model Evaluation Test Harness . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
20.4 How to Develop a Baseline Model . . . . . . . . . . . . . . . . . . . . . . . . . . 243
20.5 How to Develop an Improved Model . . . . . . . . . . . . . . . . . . . . . . . . . 249
20.6 How to Finalize the Model and Make Predictions . . . . . . . . . . . . . . . . . 265
20.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
20.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
20.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

21 How to Classify Photographs of Dogs and Cats 271


21.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
21.2 Dogs vs. Cats Prediction Problem . . . . . . . . . . . . . . . . . . . . . . . . . . 272
21.3 Dogs vs. Cats Dataset Preparation . . . . . . . . . . . . . . . . . . . . . . . . . 272
21.4 Develop a Baseline CNN Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
21.5 Develop Model Improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
21.6 Explore Transfer Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
21.7 How to Finalize the Model and Make Predictions . . . . . . . . . . . . . . . . . 298
21.8 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
21.9 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
21.10Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304

22 How to Label Satellite Photographs of the Amazon Rainforest 305


22.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
22.2 Introduction to the Planet Dataset . . . . . . . . . . . . . . . . . . . . . . . . . 306
22.3 How to Prepare Data for Modeling . . . . . . . . . . . . . . . . . . . . . . . . . 306
22.4 Model Evaluation Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
22.5 How to Evaluate a Baseline Model . . . . . . . . . . . . . . . . . . . . . . . . . 320
22.6 How to Improve Model Performance . . . . . . . . . . . . . . . . . . . . . . . . . 327
22.7 How to Use Transfer Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
22.8 How to Finalize the Model and Make Predictions . . . . . . . . . . . . . . . . . 346
22.9 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
22.10Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
22.11Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353

VI Object Detection 354


23 Deep Learning for Object Recognition 356
23.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
23.2 What is Object Recognition? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
23.3 R-CNN Model Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
23.4 YOLO Model Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
23.5 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
23.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
CONTENTS viii

24 How to Perform Object Detection With YOLOv3 368


24.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
24.2 YOLO for Object Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
24.3 Experiencor YOLO3 for Keras Project . . . . . . . . . . . . . . . . . . . . . . . 369
24.4 Object Detection With YOLOv3 . . . . . . . . . . . . . . . . . . . . . . . . . . 370
24.5 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
24.6 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
24.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388

25 How to Perform Object Detection With Mask R-CNN 390


25.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
25.2 Mask R-CNN for Object Detection . . . . . . . . . . . . . . . . . . . . . . . . . 391
25.3 Matterport Mask R-CNN Project . . . . . . . . . . . . . . . . . . . . . . . . . . 392
25.4 Object Detection With Mask R-CNN . . . . . . . . . . . . . . . . . . . . . . . . 392
25.5 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
25.6 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
25.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403

26 How to Develop a New Object Detection Model 405


26.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
26.2 How to Install Mask R-CNN for Keras . . . . . . . . . . . . . . . . . . . . . . . 406
26.3 How to Prepare a Dataset for Object Detection . . . . . . . . . . . . . . . . . . 408
26.4 How to Train Mask R-CNN Model for Kangaroo Detection . . . . . . . . . . . . 425
26.5 How to Evaluate a Mask R-CNN Model . . . . . . . . . . . . . . . . . . . . . . 429
26.6 How to Detect Kangaroos in New Photos . . . . . . . . . . . . . . . . . . . . . . 435
26.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
26.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
26.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443

VII Face Recognition 445


27 Deep Learning for Face Recognition 447
27.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
27.2 Faces in Photographs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
27.3 Process of Automatic Face Recognition . . . . . . . . . . . . . . . . . . . . . . . 448
27.4 Face Detection Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
27.5 Face Recognition Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
27.6 Deep Learning for Face Recognition . . . . . . . . . . . . . . . . . . . . . . . . . 452
27.7 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
27.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455

28 How to Detect Faces in Photographs 456


28.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
28.2 Face Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
28.3 Test Photographs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
28.4 Face Detection With OpenCV . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
CONTENTS ix

28.5 Face Detection With Deep Learning . . . . . . . . . . . . . . . . . . . . . . . . . 464


28.6 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
28.7 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
28.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476

29 How to Perform Face Identification and Verification with VGGFace2 478


29.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
29.2 Face Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
29.3 VGGFace and VGGFace2 Models . . . . . . . . . . . . . . . . . . . . . . . . . . 479
29.4 How to Install the keras-vggface Library . . . . . . . . . . . . . . . . . . . . . . 481
29.5 How to Detect Faces for Face Recognition . . . . . . . . . . . . . . . . . . . . . 482
29.6 How to Perform Face Identification With VGGFace2 . . . . . . . . . . . . . . . 486
29.7 How to Perform Face Verification With VGGFace2 . . . . . . . . . . . . . . . . 490
29.8 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
29.9 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
29.10Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494

30 How to Perform Face Classification with FaceNet 495


30.1 Tutorial Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
30.2 Face Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
30.3 FaceNet Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
30.4 How to Load a FaceNet Model in Keras . . . . . . . . . . . . . . . . . . . . . . . 497
30.5 How to Detect Faces for Face Recognition . . . . . . . . . . . . . . . . . . . . . 498
30.6 How to Develop a Face Classification System . . . . . . . . . . . . . . . . . . . . 500
30.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
30.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
30.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515

VIII Appendix 516


A Getting Help 517
A.1 Computer Vision Textbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
A.2 Programming Computer Vision Books . . . . . . . . . . . . . . . . . . . . . . . 517
A.3 Official Keras Destinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
A.4 Where to Get Help with Keras . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
A.5 How to Ask Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
A.6 Contact the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519

B How to Setup Python on Your Workstation 520


B.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
B.2 Download Anaconda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
B.3 Install Anaconda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
B.4 Start and Update Anaconda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
B.5 Install Deep Learning Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
B.6 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
B.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
CONTENTS x

C How to Setup Amazon EC2 for Deep Learning on GPUs 529


C.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
C.2 Setup Your AWS Account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
C.3 Launch Your Server Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
C.4 Login, Configure and Run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
C.5 Build and Run Models on AWS . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
C.6 Close Your EC2 Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
C.7 Tips and Tricks for Using Keras on AWS . . . . . . . . . . . . . . . . . . . . . . 538
C.8 Further Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
C.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539

IX Conclusions 540
How Far You Have Come 541
Preface

We are awash in images such as photographs, videos, YouTube, Instagram, and increasingly
from live video. Every day, I get questions asking how to develop machine learning models for
image data. Working with images can be challenging as it requires drawing upon knowledge
from diverse domains such as digital signal processing, machine learning, statistics, and these
days, deep learning.
I designed this book to teach you step-by-step how to bring modern deep learning methods
to your computer vision projects. I chose the programming language, programming libraries,
and tutorial topics to give you the skills you need.
Python is the go-to language for applied machine learning and deep learning, both in
terms of demand from employers and employees. This is partially because there is renaissance
Python-based tools for machine learning. I have focused on showing you how to use the best of
breed Python tools for computer vision such as PIL/Pillow, as well as the image handling tools
provided with the Keras deep learning library. Key to getting results is speed of development,
and for this reason, we use the Keras deep learning library as you can define, train, and use
complex deep learning models with just a few lines of Python code. There are three key areas
that you must know when working with image data:

❼ How to handle image data. This includes how to load images, load datasets of image data,
and how to scale image data to make it ready for modeling.

❼ How models work. This mainly includes intuitions for how the layers of a convolutional
neural network operate on images and how to configure these layers.

❼ How to use modern models. This includes both innovations in the model architectures as
well as the specific models used on a variety of different computer vision tasks.

These key topics provide the backbone for the book and the tutorials you will work through.
I believe that after completing this book, you will have the skills that you need to both work
through your own computer vision projects and bring modern deep learning methods to bear.

Jason Brownlee
2019

xi
Introductions

xii
Welcome

Welcome to Deep Learning for Computer Vision. Computer vision is the area of study dedicated
to helping computers see and understand the meaning in digital images such as photographs
and videos. It is an old field of study, up until recently dominated by specialized hand-crafted
methods designed by digital signal processing experts and statistical methods. Within the
last decade, deep learning methods have demonstrated state-of-the-art results on challenging
computer vision tasks such as image classification, object detection, and face recognition. This
book is designed to teach you step-by-step how to bring modern deep learning models to your
own computer vision projects.

Who Is This Book For?


Before we get started, let’s make sure you are in the right place. This book is for developers
that know some applied machine learning and some deep learning. Maybe you want or need
to start using deep learning for computer vision on your research project or on a project at
work. This guide was written to help you do that quickly and efficiently by compressing years
of knowledge and experience into a laser-focused course of hands-on tutorials. The lessons in
this book assume a few things about you, such as:

❼ You know your way around basic Python for programming.

❼ You know your way around basic NumPy for array manipulation.

❼ You know your way around basic scikit-learn for machine learning.

❼ You know your way around basic Keras for deep learning.

For some bonus points, perhaps some of the below points apply to you. Don’t panic if they
don’t.

❼ You may know how to work through a predictive modeling problem end-to-end.

❼ You may know a little bit of computer vision background.

❼ You may know a little bit of computer vision such as PIL/Pillow or OpenCV.

This guide was written in the top-down and results-first machine learning style that you’re
used to from MachineLearningMastery.com.

xiii
xiv

About Your Outcomes


This book will teach you how to get results as a machine learning practitioner interested in
using deep learning on your computer vision project. After reading and working through this
book, you will know:

❼ About the promise of neural networks and deep learning methods in general for computer
vision problems.

❼ How to load and prepare image data, such as photographs, for modeling using best-of-breed
Python libraries.

❼ How specialized layers for image data work, including 1D and 2D convolutions, max and
average pooling, and intuitions for the impact that each layer has on input data.

❼ How to configure convolutional layers, including aspects such as filter size, stride, and
pooling.

❼ How key modeling innovations for convolutional neural networks work and how to imple-
ment them from scratch, such as VGG blocks, inception models, and resnet modules.

❼ How to develop, tune, evaluate and make predictions with convolutional neural networks
on standard benchmark computer vision datasets for image classification, such as Fashion-
MNIST and CIFAR-10.

❼ How to develop, tune, evaluate, and make predictions with convolutional neural networks on
entirely new datasets for image classification, such as satellite photographs and photographs
of pets.

❼ How to use techniques such as pre-trained models, transfer learning and image augmenta-
tion to accelerate and improve model development.

❼ How to use pre-trained models and develop new models for object recognition tasks, such
as object localization and object detection in photographs, using techniques like R-CNN
and YOLO.

❼ How to use deep learning models for face recognition tasks, such as face identification
and face verification in photographs, using techniques like Google’s FaceNet and Oxford’s
VGGFace.

This book will NOT teach you how to be a research scientist nor all the theory behind why
specific methods work. For that, I would recommend good research papers and textbooks. See
the Further Reading section at the end of each tutorial for a solid starting point.

How to Read This Book


This book was written to be read linearly, from start to finish. That being said, if you know the
basics and need help with a specific method or type of problem, then you can flip straight to
that section and get started. This book was designed for you to read on your workstation, on
Another Random Scribd Document
with Unrelated Content
“When I consider how my light is spent
Ere half my days, in this dark world and wide,
And that one talent, which is death to hide,
Lodged with me useless, though my soul more bent
To serve therewith my Maker, and present
My true account, lest he, returning, chide;
‘Dost God exact day-labor, light denied?’
I fondly ask: But Patience, to prevent
That murmur, soon replies—‘God doth not need
Either man’s work, or his own gifts; who best
Bear his mild yoke, they serve him best; his state
Is kingly; thousands at his bidding speed
And post o’er land and ocean without rest;
They also serve, who only stand and wait.’”

Wonderful, is it not, that such a sonnet—so full of rare eloquence


and rare philosophy—so full of all that most hallows our infirm
humanity could be written by one—pouring out his execrations on
the head of Salmasius—at strife in his own household—at strife (as
we shall find) with his own daughters? Wonderful, is it not, that
Carlyle could write as he did about the heroism of the humblest as
well as bravest, and yet grow into a rage—over his wife’s shoulders
and at her cost—with a rooster crowing in his neighbor’s yard? Ah,
well, the perfect ones have not yet come upon our earth, whatever
perfect poems they may write.

Change of Kings.
But at last comes a new turn of the wheel to English fortunes.
Cromwell is dead; the Commonwealth is ended; all London is
throwing its cap in the air over the restoration of Charles II. Poor
blind Milton[63] is in hiding and in peril. His name is down among
those accessory to the murder of the King. The ear-cropped Prynne
—who is now in Parliament, and who hates Milton as Milton scorned
Prynne—is very likely hounding on those who would bring the great
poet to judgment. ’Tis long matter of doubt. Past his house near Red
Lion Square the howling mob drag the bodies of Cromwell and
Ireton, and hang them in their dead ghastliness.
Milton, however, makes lucky escape, with only a short term of
prison; but for some time thereafter he was in fear of assassination.
Such a rollicking daredevil, as Scott in his story of Woodstock, has
painted for us in Roger Wildrake (of whom there were many afloat in
those times) would have liked no better fun than to run his rapier
through such a man as John Milton; and in those days he would
have been pardoned for it.
That capital story of Woodstock one should read when they are
upon these times of the Commonwealth. There are, indeed,
anachronisms in it; kings escaping too early or too late, or dying a
little out of time to accommodate the exigencies of the plot; but the
characterization is marvellously spirited; and you see the rakehelly
cavaliers, and the fine old king-ridden knights, and the sour-
mouthed Independents, and the glare and fumes and madness of
the civil war, as you find them in few history pages.
Milton, meanwhile, in his quiet home again, revolves his old
project of a great sacred poem. He taxes every visitor who can, to
read to him in Hebrew, Greek, Latin, Dutch. His bookly appetite is
omnivorous. His daughters have large share of this toil. Poor girls,
they have been little taught, and not wisely. They read what they
read only by rote, and count it severe task-work. Their mother is
long since dead, and a second wife, who lived only for a short time,
dead too. We know very little of that second wife; but she is
embalmed forever in a sonnet, from which I steal this fragment:—
“Methought I saw my late espousèd saint
Brought to me, like Alcestis from the grave;

Her face was veiled, yet to my fancied sight
Love, sweetness, goodness in her person shin’d
So clear as in no face with more delight.
But oh, as to embrace me she inclined
I waked, she fled, and day brought back my night.”

The Miltonian reading and the work goes on, but affection, I fear,
does not dominate the household; the daughters overtasked, with
few indulgences, make little rebellions; and the blind, exacting old
man is as unforgiving as the law. Americans should take occasion to
see the great picture by Munkacsy, in the Lenox Gallery, New York,
of Milton dictating Paradise Lost; it is in itself a poem; a dim Puritan
interior; light coming through a latticed window and striking on the
pale, something cadaverous face of the old poet, who sits braced in
his great armchair, with lips set together, and the daughters, in awed
attention, listening or seeming to listen.
I am sorry there is so large room to doubt of the intellectual and
affectionate sympathy existing between them; nevertheless—that it
did not is soberly true; his own harsh speeches, which are of record,
show it; their petulant innuendoes, which are also of record, show it.
Into this clouded household—over which love does not brood so
fondly as we would choose to think—there comes sometimes, with
helpfulness and sympathy, a certain Andrew Marvell, who had been
sometime assistant to Milton in his official duties, and who takes his
turn at the readings, and sees only the higher and better lights that
shine there; and he had written sweet poems of his own, (to which I
shall return) that have kept his name alive, and that will keep it
alive, I think, forever.
There comes also into this home, in these days, very much to the
surprise and angerment of the three daughters, a third wife to the
old poet, after some incredibly short courtship.[64] She is only seven
years the senior of the daughter Anne; but she seems to have been
a sensible young person, not bookishly given, and looking after the
household, while Anne and Mary and Deborah still wait, after a
fashion, upon the student-wants of the poet. In fits of high
abstraction he is now bringing the “Paradise” to a close—not
knowing, or not caring, maybe, for the little bickerings which rise
and rage and die away in the one-sided home.
I cannot stay to characterize his great poem; nor is there need;
immortal in more senses than one; humanity counts for little in it;
one pair of human creatures only, and these looked at, as it were,
through the big end of the telescope; with gigantic, Godlike figures
around one, or colossal demons prone on fiery floods. It is not a
child’s book; to place it in schools as a parsing-book is an atrocity
that I hope is ended. Not, I think, till we have had some fifty years
to view the everlasting fight between good and evil in this world, can
we see in proper perspective the vaster battle which, under Milton’s
imagination, was pictured in Paradise between the same foes. Years
only can so widen one’s horizon as to give room for the
reverberations of that mighty combat of the powers of light and
darkness.
We talk of the organ-music of Milton. The term has its special
significance; it gives hint of that large quality which opens heavenly
spaces with its billows of sound; which translates us; which gives us
a lookout from supreme heights, and so lifts one to the level of his
“Argument.” There is large learning in his great poem—weighty and
recondite; but this spoils no music; great, cumbrous names catch
sonorous vibrations under his modulating touch, and colossal shields
and spears clash together like cymbals. The whole burden of his
knowledges—Pagan, Christian, or Hebraic, lift up and sink away
upon the undulations of his sublime verse, as heavy-laden ships rise
and fall upon some great ground-swell making in from outer seas.
A bookish color is pervading; if he does not steal flowers from
books, he does what is better—he shows the fruit of them. There
are stories of his debt to Cædmon, and still more authentic, of his
debt to the Dutch poet Vondel,[65] and the old Provençal Bishop of
Vienne,[66] who as early as the beginning of the sixth century wrote
on kindred themes. There is hardly room for doubt that Milton not
only knew, but literally translated some of the old Bishop’s fine Latin
lines, and put to his larger usage some of his epithets.
Must we not admit that—in the light of such developments—when
the Puritan poet boasts of discoursing on

“Things unattempted yet in prose or rhyme,”

that it is due to a little lurking stimulant of that Original Sin which


put bitterness into his Salmasian papers, and an ugly arrogance into
his domestic discipline? But, after all, he was every way greater than
his forerunners, and can afford to admit Cædmon and Vondel and
Avitus, and all other claimants, as supporting columns in the
underlying crypt upon which was builded the great temple of his
song.

Last Days.
The home of Milton in these latter days of his life was often
changed. Now, it was Holborn again; then Jewin Street; then Bunhill
Row; and—one while—for a year or more, when the great plague of
1665 desolated the city, he fled before it to the little village of
Chalfont, some twenty miles distant from London on the Aylesbury
road. There the cottage[67] may still be seen in which he lived, and
the garden in which he walked—but never saw. There, too, is the
latticed window looking on the garden, at which he sat hour by hour,
with the summer winds blowing on him from over honeysuckle beds,
while he brooded, with sightless eyes turned to the sky, upon the
mysteries of fate and foreknowledge.
A young Quaker, Ellwood, perhaps his dearest friend, comes to see
him there, to read to him and to give a helping hand to the old
man’s study; his daughters, too, are at their helpful service; grateful,
maybe, that even the desolation of the plague has given a short
relief from the dingy house in the town and its treadmill labors, and
put the joy of blooming flowers and of singing birds into their
withered hearts.
The year after, which finds them in Bunhill Row again, brings that
great London fire which the Monument now commemorates; they
passing three days and nights upon the edge of that huge tempest
of flame and smoke which devoured nearly two-thirds of London;
the old poet hearing the din and roar and crackle, and feeling upon
his forehead the waves of fierce heat and the showers of cinders—a
scene and an experience which might have given, perhaps, other
color to his pictures of Pandemonium, if his great poem had not
been just now, in these fateful years, completed—completed and
bargained for; £20 were to be paid for it conditionally,[68] in four
payments of £5 each, at a day when London had been decimated by
the plague, and half the city was a waste of ruin and ashes. And to
give an added tint of blackness to the picture, we have to fancy his
three daughters leaving him, as they did, tired of tasks, tired of
wrangling. Anne, the infirm one, who neither read nor wrote, and
Mary, so overworked, and Deborah, the youngest (latterly being very
helpful)—all desert him. They never return. “Undutiful daughters,” he
says to Ellwood; but I think he does not soften toward them, even
when gone. Poor, stern, old man! He would have cut them off by will
from their small shares of inheritance in his estate; but the courts
wisely overruled this. Anne, strangely enough, married—dying
shortly after; Mary died years later, a spinster; and Deborah, who
became Mrs. Clark, had some notice, thirty years later, when it was
discovered that a quiet woman of that name was Milton’s daughter.
But she seems to have been of a stolid make; no poetry, no high
sense of dignity belonging to her; a woman like ten thousand,
whose descendants are now said (doubtfully) to be living
somewhere in India.
But Milton wrought on; his wife Betty, of whom he spoke more
affectionately than ever once of his daughters, humored his poor
fagged appetites of the table. Paradise Regained was in hand; and
later the “Samson Agonistes.” His habits were regular; up at five
o’clock; a chapter of the Hebrew Bible read to him by his daughter
Mary—what time she stayed; an early breakfast, and quiet lonely
contemplation after it (his nephew tells us) till seven. Then work
came, putting Quaker Ellwood to helpful service, or whoever
happened in, and could fathom the reading—this lasting till mid-day
dinner; afterward a walk in his garden (when he had one) for two
hours, in his old gray suit, in which many a time passers-by saw him
sitting at his door. There was singing in later afternoon, when there
was a voice to sing for him; and instrumental music, when his, or a
friendly hand touched the old organ. After supper, a pipe and a glass
of water; always persistently temperate; and then, night and rest.
He attended no church in his later years, finding none in absolute
agreement with his beliefs; sympathizing with the Quakers to a
certain degree, with the orthodox Independents too; but flaming up
at any procrustean laws for faith; never giving over a certain tender
love, I think, for the organ-music and storied splendors of the
Anglican Church; but with a wild, broad freedom of thought chafing
at any ecclesiastic law made by man, that galled him or checked his
longings. His clear, clean intellect—not without its satiric jostlings
and wrestlings—its petulancies and caprices—sought and
maintained, independently, its own relation with God and the
mysterious future.
Our amiable Dr. Channing, with excellent data before him,
demonstrated his good Unitarian faith; but though Milton might have
approved his nice reasonings, I doubt if he would have gone to
church with him. He loved liberty; he could not travel well in double
harness, not even in his household or with the elders. His exalted
range of vision made light of the little aids and lorgnettes which the
conventional teachers held out to him. Creeds and dogmas and
vestments and canons, and all humanly consecrated helps, were but
Jack-o’-lanterns to him, who was swathed all about with the glowing
clouds of glory that rolled in upon his soul from the infinite depths.
In the year 1674—he being then sixty-five years old—on a Sunday,
late at night, he died; and with so little pain that those who were
with him did not know when the end came. He was buried—not in
the great cemetery of Bunhill Fields, close by his house—but beside
his father, in the old parish church of St. Giles, Cripplegate, where he
had been used to go as a boy, and where he had been used to hear
the old burial Office for the Dead—now intoned over his grave
—“Ashes to ashes, dust to dust.” There was no need for the
monument erected to him there in recent years. His poems make a
monument that is read of all the world, and will be read in all times
of the world.
CHAPTER V.
s we launched upon the days of Charles I., in our last talk, we

A had somewhat to say of the King’s advisers, lay and


ecclesiastic; we came to quick sense of the war-clouds, fast
gathering, through which Jeremy Taylor shot his flashes of
pious eloquence; we heard a strain of Suckling’s verse, to which
might have been added other, and may be better, from such Royalist
singers as Carew or Lovelace;[69] but we cannot swoop all the birds
into our net. We had glimpse of the crop-eared Prynne of the
Histriomastix; and from Cowley, that sincere friend of both King and
Queen in the days of their misfortunes, we plucked some “Poetical
Blossoms;” also a charming “Rose,” from the orderly parterres of
that great gardener, and pompous, time-serving man, Edmund
Waller.
Then came Milton with the fairy melodies, always sweet, of
“Comus”—the cantankerous pamphleteering—the soured home-life—
the bloody thrusts at the image of the King, and the grander flight of
his diviner music into the courts of Paradise.

Charles II. and his Friends.


Some fourteen years or so before the death of Milton, the
restoration of Charles II. had come about. He had drifted back upon
the traces of the stout Oliver Cromwell, and of the feebler Richard
Cromwell, on a great tide of British enthusiasm. Independents,
Presbyterians, Church of England men, and Papists were all by the
ears; and it did seem to many among the shrewdest of even the
Puritan workers that some balance-wheel (of whatever metal),
though weighted with royal traditions and hereditary privileges,
might keep the governmental machinery to the steady working of
old days.
So the Second Charles had come back, with a great throwing up
of caps all through the London streets; Presbyterians giving him
welcome because he was sure to snub the Independents; the
Independents giving him welcome because he was sure to snub the
Presbyterians; the Church of England men giving him welcome
because he was sure to snub both (as he did); and finally, the
Papists giving him high welcome because all other ways their hopes
were lean and few.
You know, or should know, what manner of man he was:
accomplished—in his way; an expert swordsman; an easy talker—
capable of setting a tableful of gentlemen in a roar; telling stories
inimitably, and a great many of them; full of grimaces that would
have made his fortune on the stage; saying sweetest things, and
meaning the worst things; a daredevil who feared neither God nor
man; generous, too—most of all in his cups; and liberal—with other
people’s money; hating business with all his soul; loving pleasure
with all his heart; ready always to do kindness that cost him nothing;
laughing at all Puritans and purity; yet winning the maudlin affection
of a great many people, and the respect of none.
Notwithstanding all this, the country gentlemen of England, of
good blood, who had sniffed scornfully at the scent of the beer-vats
which hung about the name of Cromwell, welcomed this clever,
swarthy, black-haired, dissolute Prince, who had a pedigree which
ran back on the father’s side to the royal Bruce of Scotland, and on
the mother’s side to the great Clovis, and to the greater
Charlemagne.
You will find a good glimpse of this scion of royalty in Scott’s story
of Peveril of the Peak. The novel is by no means one of the great
romancer’s best; but it is well worth reading for the clear and vivid
idea it will give one of the social clashings between the reserves of
old Puritanism and the incontinencies of new monarchism; you will
find in it an excellent sample of the gruff, stalwart Cromwellian; and
another of the hot-tempered, swearing cavalier; and still others of
the mincing, scheming, gambling, roystering crew which overran all
the purlieus of the court of Charles. Buckingham was there—that
second Villiers,[70] of whom I had somewhat to say when the elder
Buckingham came up for mention in the days of Charles I.; this
younger Villiers running before the elder in all accomplishments and
all villainies; courtly; of noble bearing; with daintiest of speeches; a
pattern of manly graces; capable of a tender French song, with all
his tones in exultant accord with best of court singers, and of a
comedy that drew all the play-goers of London to the “Rehearsal;”
capable too, of the wickedest of plots and of the foulest of lies. And
yet this Buckingham was one of the best accredited advisers of the
Crown.
To the same court belonged Rochester,[71] his great, fine wig
covering a great, fine brain; he writing harmonious verses about
—“Nothing”—or worse than nothing; and at the last wheedling
Bishop Burnet into the belief that he had changed his courses, and
that if he might rise from that ugly deathbed where the good-
natured, pompous bishop sought him, he would be enrolled among
the moralists. I think it was lucky that he died with such good
impulse flashing at the top of his badnesses.
Dorset belonged to this court, with his pretty verselets, and Sedley
and Etherege; also the Portsmouth and Lady Castelmaine, and the
rest of those venturesome ladies who show their colors of cheek and
bosom, even now, in the well-handled paintings of Sir Peter Lely.
When you go to Hampton Court you can see these fair and frail
beauties by the dozen on the walls of the King William room. Sir
Peter Lely[72] was a rare painter, belonging to these times; a great
favorite of Charles; and he loved such subjects for his brush; he
drew the delicatest hands that were ever put on canvas—too
delicate and too small, unfortunately, to cover the undress of his
figures.
But, at the worst, England was not altogether a Pandemonium in
those days following upon the Restoration. I think, perhaps, the
majority of historians and commentators are disposed to over-color
the orgies; it is so easy to make prodigious effects with strong
sulphurous tints and blazing vermilions. Certain it is that Taine, in
writing of these times, has put an almost malignant touch into his
story, blinking the fact that the trail which shows most of corrupting
phosphorescence came over the Channel with the new King;
forgetting that French breeding was at the bottom of the new tastes,
and that French gold made the blazonry of the chariots in which the
Jezebels rode on their triumphal way through London to—perdition.
Then, again, English vice is more outspoken and less secretive
than that of the over-Channel neighbors. It is now, and has always
been true, that when his Satanic majesty takes possession of a man
(or a woman), he can cover himself in sweeter and more
impenetrable disguise under the pretty perukes and charming
millinery of French art than in a homely British body, out of which
the demon horns stick stark through all the wigs and cosmetics that
art can put upon a man.
It is worth while for us to remember that in this London, when the
elegant Duke of Rochester was beating time with his jewelled hand
to a French gallop, Richard Baxter’s[73] ever-living Saints’ Rest was
an accredited book, giving consolation to many a poor soul wrestling
with the fears of death and of future judgment. It was published,
indeed, somewhat earlier; but its author was still wakeful and
earnest; and many a time his thin, stooping figure might be seen
threading a way through the street crowds to his chapel in
Southwark, where delighted listeners came to hear him, almost upon
the very spot where Shakespeare, eighty years before, had played in
the Globe Theatre.
The eloquent Tillotson, too, in these times—more liberal than
Baxter or Doddridge—was writing upon The Wisdom of Being
Religious and the right Rule of Faith, and by his catholicity and clear-
headedness winning such favor and renown as to bring him later to
the see of Canterbury.
I would have you keep in mind, too, that John Milton was still alive
—his “Samson Agonistes” not being published until Charles II. had
been some twelve years upon the throne—and in quiet seclusion
was cultivating and cherishing that serene philosophy which glows
along the closing line of his greatest sonnet,

“They also serve who only stand and wait!”

Andrew Marvell.
When upon the subject of Milton, I made mention of a certain
poet who used to go and see him in his country retirement, and who
was also assistant to him in his duties as Latin Secretary to the
Council. This was Andrew Marvell,[74] a poet of so true a stamp, and
so true a man, that it is needful to know something more of him.
He was son of a preacher at Kingston-upon-Hull (or, by metonomy,
Hull) in the north of England. In a very singular way, the occasion of
his father’s sudden death by drowning (if current tradition may be
trusted) was also the occasion of the young poet’s entrance upon
greatly improved worldly fortune.
The story of it is this, which I tell to fix his memory better in mind.
Opposite his father’s home, on the other bank of the Humber, lived a
lady with an only daughter, the idol of her mother. This daughter
chanced to visit Hull, that she might be present at the baptism of
one of Mr. Marvell’s children. A tempest came up before night, and
the boatmen declared the crossing of the river to be dangerous; but
the young lady, with girlish wilfulness insisted, notwithstanding the
urgence of Mr. Marvell; who, finding her resolved, went with her;
and the sea breaking over the boat both were lost. The despairing
mother found what consolation she could in virtually adopting the
young Andrew Marvell, and eventually bestowing upon him her
whole fortune.
This opened a career to him which he was not slow to follow upon
with diligence and steadiness. Well-taught, well-travelled, well-
mannered, he went up to London, and was there befriended by
those whose friendship insured success. He was liberal in his politics,
beautifully tolerant in religious matters, kept a level head through
the years of Parliamentary rule, and was esteemed and admired by
both Puritans and Royalists. He used a sharp pen in controversy and
wrote many pamphlets, some of which even now might serve as
models for incisive speech; he was witty with the wittiest; was
caustic, humorous; his pages adrip with classicisms; and he had a
delicacy of raillery that amused, and a power of logic that smote
heavily, where blows were in order. He was for a long time member
of Parliament for Hull, and by his honesties of speech and pen, made
himself so obnoxious to the political jackals about Charles’s court—
that he was said to be in danger again and again of assassination;
he finally died under strong (but unfounded) suspicion of poisoning.
Those who knew him described him as “of middling stature,
strong set, roundish face, cherry-cheeked, hazel-eyed, brown-
haired.”[75]
There are dainty poems of his, which should be read, and which
are worth remembering. Take this, for instance, from his Garden,
which was written by him first in Latin, and then rendered thus:
“What wondrous life is this I lead!
Ripe apples drop about my head;
The luscious clusters of a vine
Upon my mouth do crush their wine;
The nectarine and curious peach
Into my hands themselves do reach;
Stumbling on melons, as I pass,
Ensnared with flowers, I fall on grass.

“Here at the fountain’s sliding foot


Or at some fruit-tree’s mossy root,
Casting the body’s vest aside
My soul into the boughs does glide:
There, like a bird, it sits and sings,
Then whets and claps its silver wings,
And, till prepared for longer flight,
Waves in its plumes the various light.”

And this other bit, from his “Appleton House” (Nuneaton), still
more full of rural spirit:
“How safe, methinks, and strong behind
These trees, have I encamped my mind,
Where beauty aiming at the heart
Bends in some tree its useless dart,
And where the world no certain shot
Can make, or me it toucheth not.

“Bind me, ye woodbines, in your twines,


Curl me about, ye gadding vines,
And, oh, so close your circles lace
That I may never leave this place!
But, lest your fetters prove too weak
Ere I your silken bondage break,
Do you, O brambles, chain me too,
And, courteous briars, nail me through!”

This is better than Rochester’s “Nothing,” and has no smack of Nell


Gwynne or of Charles’s court.

Author of Hudibras.
It is altogether a different, and a far less worthy character that I
now bring to the notice of the reader. The man is Samuel Butler,[76]
and the book Hudibras—a jingling, doggerel poem, which at the time
of its publication had very great vogue in London, and was the
literary sensation of the hour in a court which in those same
years[77] had received the great epic of Milton without any
noticeable ripple of applause.
For myself, I have no great admiration for Hudibras, or for Mr.
Samuel Butler. He was witty, and wise in a way, and coarse, and had
humor; but he was of a bar-room stamp, and although he could
make a great gathering of the court people stretch their sides with
laughter, it does not appear that he had any high sense of honor, or
much dignity of character.
Mr. Pepys (whose memoirs you have heard of, and of whom we
shall have more to tell) says that he bought the book one day in the
Strand because everybody was talking of it—which is the only reason
a good many people have for buying books; and, he continues—that
having dipped into it, without finding much benefit, he sold it next
day in the Strand for half-price. But poor Mr. Pepys, in another and
later entry, says, “I have bought Hudibras again; everybody does
talk so much of it;” which is very like Mr. Pepys, and very like a good
many other buyers of books.
Hudibras is, in fact, a great, coarse, rattling, witty lunge at the
stiff-neckedness and the cropped heads of the Puritans, which the
roistering fellows about the palace naturally enjoyed immensely. He
calls the Presbyterians,
“Such, as do build their faith upon
The holy text of pike and gun;
Decide all controversies
By infallible artillery;
And prove their doctrines orthodox
By apostolic blows and knocks;
Call fire and sword and desolation
A godly, thorough reformation,
Which always must be going on
And still be doing—never done;
As if Religion were intended
For nothing else but to be mended.
A sect whose chief devotion lies
In odd, perverse antipathies,
In falling out with that or this,
And finding somewhat still amiss.

That with more care keep holyday,


The wrong—than others the right way;
Compound for sins they are inclined to
By damning those they have no mind to.

The self same thing they will abhor


One way, and long another—for:

Quarrel with mince-pies and disparage


Their best and dearest friend plum-porridge;
Fat pig and goose itself oppose,
And blaspheme custard thro’ the nose.”

It is not worth while to tell the story of the poem—which, indeed,


its author did not live to complete. Its fable was undoubtedly
suggested by the far larger and worthier work of Cervantes;
Hudibras and Ralpho standing in the place of the doughty Knight of
La Mancha, and Sancho Panza; but there is a world between the
two.
Hudibras had also the like honor of suggesting its scheme and
measure and jingle to an early American poem—that of McFingal, by
John Trumbull—in which our compatriot with less of wit and ribaldry,
but equal smoothness, and rhythmic zest, did so catch the humor of
the Butler work in many of his couplets that even now they pass
muster as veritable parts of Hudibras.[78]
Samuel Butler was the son of a farmer, over in the pretty
Worcestershire region of England; but there was in him little sense
of charming ruralities; they never put their treasures into his verse.
For sometime he was in the household of one of Cromwell’s
generals,[79] who lived in a stately country-hall a little way out of
Bedford; again, he filled some dependency at that stately Ludlow
Castle on the borders of Wales—forever associated with the music of
Milton’s “Comus.” It was after the Restoration that he budded out in
his anti-Puritan lampoon; but though he pandered to the ruling
prejudices of the time, he was not successful in his search for place
and emoluments; he quarrelled with those who laughed loudest at
his buffoonery and died neglected. His name is to be remembered as
that of one of the noticeable men of this epoch, who wrote a poem
bristling all through with coarse wit, and whose memory is kept alive
more by the stinging couplets which have passed from his pen into
common speech than by any high literary merit or true poetic savor.
His chief work in verse must be regarded as a happy, witty
extravaganza, which caused so riotous a mirth as to be mistaken for
valid fame. The poem is a curio of letters—a specimen of literary
bric-à-brac—an old, ingeniously enamelled snuff-box, with dirty
pictures within the lid.

Samuel Pepys.
I had occasion just now to speak of the Pepys Diary, and promised
later and further talk about its author, whom we now put in focus,
and shall pour what light we can upon him.[80]
He was a man of fair personal appearance and great self-approval,
the son of a well-to-do London tailor, and fairly educated; but the
most piquant memorial of his life at Cambridge University is the
“admonition”—which is of record—of his having been on one
occasion “scandalously over-served with drink.” In his after life in
London he escaped the admonitions; but not wholly the “over-
service” in ways of eating and drinking.
Pepys was a not far-off kinsman of Lord Sandwich (whom he
strongly resembled), and it was through that dignitary’s influence
that he ultimately came into a very good position in connection with
the Admiralty, where he was most intrepid in his examination of tar
and cordage, and brought such close scrutiny to his duties as to
make him an admirable official in the Naval Department under
Charles II. For this service, however, he would never have been
heard of, any more than another straightforward, plodding clerk; nor
would he have been heard of for his book about naval matters,
which you will hardly find in any library in the country. But he did
write a Diary, which you will find everywhere.
It is a Diary which, beginning in 1660, the first of Charles’ reign,
covers the ten important succeeding years; within which he saw
regicides hung and quartered, and heard the guns of terrific naval
battles with the Dutch, and braved all the horrors of the Great
Plague from the day when he first saw house-doors with a red cross
marked on them, and the words “Lord, have mercy on us!” to the
time when ten thousand died in a week, and “little noise was heard,
day or night, but tolling of bells.” Page after page of his Diary is also
given to the great fire of the following year—from the Sunday night
when he was waked by his maid to see a big light on the back side
of Mark Lane, to the following Thursday when two-thirds of the
houses and of the churches of London were in ashes.
But Pepys’ Diary is not so valued for its story of great events as for
its daily setting down of little unimportant things—of the plays which
he saw acted—of the dust that fell on the theatre-goers from the
galleries—of what he bought, and what he conjectured, and what his
wife said to him, and what new dresses she had, and how he slept
comfortably through the sermon of Dr. So-and-So—just as you and I
might have done—never having a thought either that his Diary
would ever be printed. He wrote it, in fact, in a blind short-hand,
which made it lie unnoticed and undetected for a great many years,
until at last some prying Cambridge man unriddled his cipher and
wrote out and published Pepys’ Diary to the world. And it is
delightful; it is so true and honest, and straightforward, and gossipy;
and it throws more light upon the every-day life in London in those
days of the Restoration than all the other books ever written.
There have been other diaries which have historic value; there
was Hyde, Earl of Clarendon,[81] with some humor and a lordly
grace, who wrote a History of the Rebellion—more than half diary—
with sentences as long as his pages; but it does not compare with
Pepys’ for flashes of light upon the accidents of life. There was good,
earnest, well-meaning John Evelyn,[82] who had a pretty place called
Says-Court (inherited through his wife) down at Deptford—which
Scott introduces as the residence of Essex in his story of Kenilworth
—who had beautiful trees and flowers there which he greatly loved.
Well, John Evelyn wrote a diary, and a very good one; with perhaps
a better description of the great London fire of 1666 in it than you
will find anywhere else; he gives us, too, a delightful memorial of his
young daughter Mary—who read the Ancients, who spoke French
and Italian, who sang like an angel, who was as gentle and loving as
she was wise and beautiful—whose death “left him desolate;” but
John Evelyn is silent upon a thousand points in respect to which
Pepys bristles all over like a gooseberry bush. Dr. Burnet, too, wrote
a History of his Own Times, bringing great scholarly attainments to
its execution, and a tremendous dignity of authorship; and he would
certainly have turned up his bishop’s nose at mention of Samuel
Pepys; yet Pepys is worth a dozen of him for showing the life of that
day. He is so simple; he is so true; he is so unthinking; he is the
veriest photographer. Hear him for a little—and I take the passages
almost at random:
“November 9, 1660.—Lay long in bed this morning.
“To the office, and thence to dinner at the Hoope
Tavern, given us by Mr. Ady and Mr. Wine the King’s
fishmonger. Good sport with Mr. Talbot, who eats no
sort of fish, and there was nothing else till we sent for
a neat’s tongue.
“Thence I went to Sir Harry Wright’s, where my Lord
was busy at cards, and so I staid below with Mrs.
Carter and Evans, who did give me a lesson upon the
lute, till he came down, and having talked with him at
the door about his late business of money, I went to
my father’s, and staid late talking with my father about
my sister Poll’s coming to live with me—if she would
come and be as a servant (which my wife did seem to
be pretty willing to do to-day); and he seems to take it
very well, and intends to consider of it.”
And again:
“Home by coach, notwithstanding this was the first
day of the King’s proclamation against hackney
coaches coming into the streets to stand to be hired;
yet I got one to carry me home.”
Again:
“11th November, Lord’s Day.—To church into our
new gallery, the first time it was used. There being no
woman this day, we sat in the foremost pew, and
behind us our servants, and I hope it will not always
be so, it not being handsome for our servants to sit so
equal with us. Afterward went to my father’s, where I
found my wife, and there supped; and after supper we
walked home, my little boy carrying a link [torch], and
Will leading my wife. So home and to prayers and to
bed.”
Another day, having been to court, he says:
“The Queene, a very little plain old woman, and
nothing more in any respect than any ordinary woman.
The Princess Henrietta is very pretty, but much below
my expectation; and her dressing of herself with her
haire frizzed short up to her eares did make her seem
so much the less to me. But my wife, standing near
her, with two or three black patches on, and well
dressed, did seem to me much handsomer than she.
Lady Castelmaine not so handsome as once, and
begins to decay; which is also my wife’s opinion.”
One more little extract and I have done:
“Lord’s Day, May 26. After dinner I, by water, alone
to Westminster to the Parish Church, by which I had
the great pleasure of seeing and gazing at a great
many very fine women; and what with that, and
sleeping, I passed away the time till sermon was
done.”
Was there ever anything more ingenuous than that? How
delightfully sure we are that such writing was never intended for
publication!
The great charm of Mr. Pepys and all such diary writing is, that it
gives us, by a hundred little gossipy touches, the actual complexion
of the times. We have no conventional speech to wrestle with, in
order to get at its meaning. The plain white lights of honesty and
common-sense—so much better than all the rhetorical prismatic
hues—put the actual situation before us; and we have an approach
to that realism which the highest art is always struggling to reach.
The courtiers in their great, fresh-curled wigs, strut and ogle and
prattle before us. We scent the perfumed locks of Peter Lely’s ladies,
and the eels frying in the kitchen. We see Mr. Samuel Pepys bowing
to the Princess Henrietta, and know we shall hear of it if he makes a
misstep in backing out of her august presence. How he gloats over
that new plush, or moire-antique, that has just come home for his
wife—cost four guineas—which price shocks him a little, and sends
him to bed vexed, and makes him think he had better have kept by
the old woollen stuff; but, next Lord’s day being bright, and she
wearing it to St. Margaret’s or St. Giles’, where he watches her as
she sits under the dull fire of the sermon—her face beaming with
gratitude, and radiant with red ribbons—he relents, and softens, and
is proud and glad, and goes to sleep! This Pepys stands a good
chance to outlive Butler, and to outlive Burnet, and to outlive
Clarendon, and to outlive John Evelyn.
I may add further to this mention of the old diarist, that at a
certain period of his life he became suspected—and without reason
—of complicity with the Popish plots (of whose intricacies you will
get curious and graphic illustration in Peveril of the Peak); and poor
Pepys had his period of prisonship like so many others in that day.
He also became, at a later time, singularly enough, the President of
the Royal Society of England—a Society formed in the course of
Charles II.s’ reign, and which enrolled such men as Robert Boyle and
Sir Isaac Newton in its early days; and which now enrols the best
and worthiest of England’s scientists.
I do not think they would elect such a man as Samuel Pepys for
President now; yet it would appear that the old gentleman in his
long wig and his new coat made a good figure in the chair, and
looked wise, and used to have the members down informally at his
rooms in York Building, where he made good cheer for them, and
broached his best bin of claret. Nor should it be forgotten that Pepys
had an appreciative ear for the melodies of Chaucer (like very few in
his day), and spurred Dryden to the making of some of his best
imitations.
When he died—it was in the early years of the eighteenth century
—he left his books, manuscripts, and engravings, which were
valuable, to Magdalen College, Cambridge; and there, as I said when
we first came upon his name, his famous Diary, in short-hand, lay
unheard of and unriddled for more than a hundred years.

A Scientist.
Science was making a push for itself in these times. Newton had
discovered the law of gravitation before Charles II. died; the King
himself was no bad dabbler in chemistry.
Robert Boyle, the son of an Earl, and with all moneyed appliances
to help him, was one of the early promoters and founders of the
Royal Society I spoke of; a noticeable man every way in that epoch
of the Ethereges and the Buckinghams and the Gwynnes—devoting
his fortune to worthy works; estimable in private life; dignified and
serene; tall in person and spare—wearing, like every other well-born
Londoner, the curled, long-bottomed wig of France, and making
sentences in exposition of his thought which were longer and stiffer
than his wigs. I give you a sample. He is discussing the eye, and
wants to say that it is wonderfully constructed; and this is the way
he says it:
“To be told that an eye is the organ of sight, and
that this is performed by that faculty of the mind
which, from its function, is called visive, will give a
man but a sorry account of the instruments and
manner of vision itself, or of the knowledge of that
Opificer who, as the Scripture speaks, formed the eye;
and he that can take up with this easy theory of
Vision, will not think it necessary to take the pains to
dissect the eyes of animals, nor study the books of
mathematicians to understand Vision; and accordingly
will have but mean thoughts of the contrivance of the
Organ, and the skill of the Artificer, in comparison of
the ideas that will be suggested of both of them to
him, that being profoundly skilled in anatomy and
optics, by their help takes asunder the several coats,
humors, muscles, of which that exquisite dioptrical
instrument consists; and having separately considered
the size, figure, consistence, texture, diaphaneity or
opacity, situation, and connection of each of them, and
their coaptation in the whole eye, shall discover, by the
help of the laws of optics, how admirably this little
organ is fitted to receive the incident beams of light
and dispose them in the best manner possible for
completing the lively representation of the almost
infinitely various objects of sight.”
What do you think of that for a sentence? If the Fellows of the
Royal Society wrote much in that way (and the Honorable Boyle did
a good deal), is it any wonder that they should have an exaggerated
respect for a man who could express himself in the short, straight
fashion in which Samuel Pepys wrote his Diary?

John Bunyan.
I have a new personage to bring before you out of this hurly-burly
of the Restoration days, and what I have to say of him will close up
our talk for this morning.
I think he did never wear a wig. Buckingham, who courted almost
all orders of men, would not have honored him with a nod of
recognition; nor would Bishop Burnet. I think even the amiable Dr.
Tillotson, or the very liberal Dr. South, would have jostled away from
him in a crowd, rather than toward him. Yet he was more pious than
they; had more humor than Buckingham; and for imaginative power
would outrank every man living in that day, unless we except the
blind old poet Milton. You will guess easily the name I have in mind:
it is John Bunyan.[83] Not a great name then; so vulgar a one indeed
that—a good many years later—the amiable poet Cowper spoke of it
charily. But it is known now and honored wherever English is
spoken.
He was born at Elstow, a mile away from Bedford, amid fat green
meadows, beside which in early May long lines of hawthorn hedges
are all abloom. You will go straight through that pleasant country in
passing from Liverpool to London, if you take, as I counsel you to
do, the Midland Railway; and you will see the lovely rural pictures
which fell under Bunyan’s eye as he strolled along beside the hedge-
rows, from Elstow—a mile-long road—to the grammar-school at
Bedford.
The trees are beautiful thereabout; the grass is as green as
emerald; old cottages are mossy and picturesque; gray towers of
churches hang out a great wealth of ivy boughs; sleek Durham cattle
and trim sheep feed contentedly on the Bedford meadows, and
rooks, cawing, gather into flocks and disperse, and glide down
singly, or by pairs, into the tops of trees that shade country houses.
The aspects have not changed much in all these years; even the
cottage of Bunyan’s tinker father is still there, with only a new front
upon it. The boy received but little schooling, and that at hap-
hazard; but he got much religious teaching from the elders of the
Baptist chapel, or from this or that old Puritan villager. A stern
doctrinal theology overshadowed all his boyish years, full of
threatening, fiery darts, and full of golden streaks of promise.
He was a badish boy—as most boys are; a goodly quantum of
original sin in him; he says, with his tender conscience, that he was
“very bad;” a child of the devil; swearing, sometimes; playing “three
old cat” very often; picking flowers, I dare say, or idly looking at the
rooks of a Sunday. Yet I would engage that the Newhaven High
School would furnish thirty or forty as bad ones as John Bunyan any
day in the year. But he makes good resolves; breaks them again;
finally is convicted, but falters; marries young (and, as would seem,
foolishly, neither bride nor groom being turned of twenty), and she
bringing for sole dower not so much as one dish or spoon, but only
two good books—The Plain Man’s Pathway to Heaven and The
Practice of Piety.
Even before this he had been drafted for service in the battles
which were aflame in England—doubtless fighting for the
Commonwealth, as most of his biographers[84] allege. Very probably,
too, he was under orders of that Sir Samuel Luke, who lived near by,
and who—as I have mentioned—was the butt of much of Samuel
Butler’s Hudibrastic satire.
Next we hear of him as preacher—not properly sanctioned even
by the non-conforming authorities—but opening that intense
religious talk of his upon whatever and whomsoever would come to
hear. Even his friendly Baptist brothers look doubtfully upon his
irregularities; but he sees only the great golden cross before him in
the skies, and hears only the crackle of the flames in the nethermost
depths below. He is bound to save, in what way he can, those who
will be saved, and to warn, in fearfullest way, those who will be
damned.
Hundreds came to hear this working-man who was so dreadfully
in earnest, and who had no more respect for pulpits or liturgies than
for preaching-places in the woods. It was not strange that he
offended against non-conformist acts, nor strange that, after
accession of Charles II. he came to imprisonment for his illegal
pieties. This prison-life lasted for some twelve years, in the which he
still preached to those who would listen within prison walls, and read
his Bible, and wrought at tagged laces (still a great industry of that
district) for the support of his family, a separation from whom—most
of all from his poor blind daughter Mary—was, he says, like “pulling
the flesh from his bones.” Over and over in that reach of prison-life
he might have been free if he would have promised to abstain from
his irregular preachments, or if he would go over seas to America.
But he would not; he could not forbear to warn whomsoever might
hear, of the fiery pit, and of the days when the heavens should be
opened. He loved not the thought of over-ocean crossing; his duties
lay near; and with all his radicalism he never outlived a gracious
liking for British kingly traditions, and for such ranking of men and
powers as belonged to Levitical story.
Finally, under Charles’ Declaration of Indulgence (1672), which
was intended more for the benefit of ill-used Romanists than for
Non-conformists, Bunyan’s prison-doors were laid open, and he went
to his old work of preaching in public places. There may have been,
as his more recent biographers intimate, a later (1675) short
imprisonment;[85] and this, or some portion of the previous prison-
life, was certainly passed in that ancient Bedford jail, which, only a
few years since, was standing on Bedford bridge, hanging over the
waters of the river Ouse—whose slow current we shall find flowing
again in our story of William Cowper.
And if the whole weight of tradition is not to be distrusted, it was
in this little prison over the river, where passers-by might shout a
greeting to him—that John Bunyan fell into the dreamy fashioning of
that book which has made his name known everywhere, and which
has as fixed a place in the great body of English literature as
Shakespeare’s “Hamlet,” or Spenser’s Faery Queen—I mean the
Pilgrim’s Progress.
But how is it, the reader may ask, that this tinker’s son, who had
so far forgotten his school learning that his wife had to teach him
over again to read and write—how is it that he makes a book which
takes hold on the sympathies of all Christendom, and has a literary
quality that ranks it with the first of allegories?[86]
Mr. Pepys told plainly what we wanted him to tell; but he had
nothing but those trifles which give a color to every-day life to tell of.
If he had undertaken to make a story of a page long, involving
imaginative powers, he would have made a failure of it; and if he
had tried to be eloquent he would have given himself away
deplorably. But this poor brazier (as he calls himself in his last will),
with not one-fourth of his knowledge of the world, with not one-
twentieth of his learning (bald as the old diarist was in this line),
with not one-hundredth part of his self-confidence, makes this
wonderful and charming book of which we are talking. How was it?
Well, there was, first, the great compelling and informing Christian
purpose in him: he was of the Bible all compact; every utterance of
it was a vital truth to him; the fire and the brimstone were real; the
Almighty fatherhood was real; the cross and the passion were real;
the teeming thousands were real, who hustled him on either side
and who were pressing on, rank by rank, in the broad road that
leads to the City of Destruction. The man who believes such things
in the way in which John Bunyan believed them has a tremendous
motive power, which will make itself felt in some shape.
Then that limited schooling of his had kept him to a short
vocabulary of the sharpest and keenest and most telling words.
Rhetoric did not lead him astray after flowers; learning did not tempt
him into far-fetched allusions; literary habit had not spoiled his
simplicities. And again, and chiefest of all, there was a great
imaginative power, coming—not from schools, nor from grammar
teachings—but coming as June days come, and which, breathing
over his pages with an almost divine afflatus, lifted their sayings into
the regions of Poetry.
Therefore and thereby it is that he has fused his thought into such
shape as takes hold on human sympathies everywhere, and his
characters are all live creatures. All these two hundred and twenty
years last past the noble Great-heart has been thwacking away at
Giant Grim and thundering on the walls of Doubting Castle with
blows we hear; and poor, timid Christian has been just as many
years, in the sight of all of us, making his way through pitfalls and
quagmires and Vanity Fairs—hard pressed by Apollyon, and
belabored by Giant Despair—on his steady march toward the
Delectable Mountains and the river of Death, and the shining shores
which lie Beyond.
CHAPTER VI.
here were some unsavory names which crept into the opening

T of our last chapter; but they were sweet in the nostrils of


Charles II. Of such were Buckingham, Rochester, Etherege,
Dorset, and the Castelmaine. And we made a little moral
counterpoise by the naming of Baxter’s Saints’ Rest, and of Tillotson,
and of the healthful, noble verse of Andrew Marvell, by which we
wished to impress upon our readers the fact that the whole world of
England in that day was not given over to French court-dances and
to foul-mouthed poets; but that the Puritan leaven was still working,
even in literary ways, and that there were men of dignity,
knowledge, culture, and rank, who never bowed down to such as
the pretty Duchess of Portsmouth.
We had our glimpse of that witty buffoon Samuel Butler, who
made clever antics in rhyme; and I think, we listened with a curious
eagerness to what Samuel Pepys had to say of his play-going, and of
the black patches with which his pretty wife set forth her beauty.
Then came Bunyan, with his great sermonizing in barns and woods,
and that far finer sermonizing which in the days of his jailhood took
shape in the immortal story of Christian and Great-heart. He died
over a grocer’s shop, in Snow Hill, London (its site now all effaced by
the great Holborn Viaduct), whither he had gone on a preaching
bout in the year 1688, only a few months before James II. was
driven from his throne. It is worth going out by the City Road—only
a short walk from Finsbury Square—to the cemetery of Bunhill
Fields, where Bunyan was buried—to see the marble figure of the
tinker preacher stretched upon the monument modern admirers
have built, and to see Christian toiling below, with his burden
strapped to his back.
Three Good Prosers.
In the course of that old Pepys’ Diary—out of which we had our
regalement—there is several times mention of Thomas Fuller;[87]
among others this:
“I sat down reading in Fuller’s English Worthies;
being much troubled that (though he had some
discourse with me about my family and armes) he says
nothing at all. But I believe, indeed, our family were
never considerable.”
Honest Pepys! Shrewd Dr. Fuller, and a man not to be forgotten!
He was a “Cavalier parson” through the Civil-War days; was born
down in Northamptonshire in the same town where John Dryden,
twenty-three years later, first saw the light. He was full of wit, and
full of knowledges; people called him—as so many have been and
are called—“a walking library;” and his stout figure was to be seen
many a time, in the Commonwealth days, striding through Fleet
Street, and by Paul’s Walk, to Cheapside. There is quaint humor in
his books, and quaintness and aptness of language. Coleridge says
he was “the most sensible and least prejudiced great man of his
time.”
Sir Thomas Browne,[88] a doctor, and the author of the Religio
Medici and Urn-Burial, was another delightful author of the Civil-War
times, whose life reached almost through the reign of Charles II.;
yet he was not a war man—in matter of kings or of churches.
Serenities hung over him in all those times wherein cannon
thundered, and traitors (so called) were quartered, and cathedrals
despoiled. He loved not great cities. London never magnetized him;
but after his thorough continental travel and his doctorate at Leyden,
he planted himself in that old, crooked-streeted city of Norwich, in
Norfolk; and there, under the shadow of the stupendous mound and
Keep (which date from the early Henrys) he built up a home, of
which he made a museum—served the sick—reared a family of ten
children, and followed those meditative ways of thought which led
him through sepulchral urns, and the miracles of growth, and the
Holy Scriptures, away from all the “decrees of councils and the
niceties of the schools” to the altitudes he reaches in the Religio
Medici.
I must excerpt something to show the humors of this Norwich
doctor, and it shall be this:
“Light that makes things seen makes some things
invisible. Were it not for darkness, and the shadow of
the earth, the noblest part of Creation had remained
unseen, and the stars in Heaven as invisible as on the
Fourth day when they were created above the horizon
with the Sun, and there was not an eye to behold
them. The greatest mystery of Religion is expressed by
adumbration, and in the noblest part of Jewish types
we find the Cherubim shadowing the Mercy Seat. Life
itself is but the Shadow of Death, and souls departed
but the Shadows of the Living. The sun itself is but the
dark Simulacrum, and light but the shadow of God.”
If there were no other reason for our love of the best writings of
Sir Thomas Browne, it would be for this—that in some scarce
distinguishable way he has inoculated our “Elia” of a later day with
something very like his own quaint egoisms and as quaint garniture
of speech. How Charles Lamb must have enjoyed him, and joyed in
the meditation—of a twilight—on the far-reaching, mystic skeins of
thought which so keen a reader would ravel out from the stores of
the Urn-Burial! And with what delighted sanction the later writer
permits, here and there, the tender solemnities of the elder to shine
through and qualify his own periods; not through imitativeness,
conscious or unconscious, but because the juices from the mellow
fruitage of the old physician have been quietly assimilated by the
stuttering clerk of the India House, and so his thought burgeons—by
very necessity—into that kindred leafage of phrase which lifts and
sways in the gentle breezes of his always gentle purpose.

You might also like