Tài liệu hay nhất về cách tiếp cận DEEPLEARNING cho người mới bắt đầu, từ cơ bản tới nâng cao bao gồm cả code, gồm 3 phần đây là phần một Starter Bundle, phần 2 Practitioner Bundle, phần 3 ImageNet Bundle
Deep Learning for Computer Vision with Python Starter Bundle Dr Adrian Rosebrock 1st Edition (1.1.0) Copyright c 2017 Adrian Rosebrock, PyImageSearch.com P UBLISHED BY P Y I MAGE S EARCH PYIMAGESEARCH COM The contents of this book, unless otherwise indicated, are Copyright c 2017 Adrian Rosebrock, PyimageSearch.com All rights reserved Books like this are made possible by the time invested by the authors If you received this book and did not purchase it, please consider making future books possible by buying a copy at https://www.pyimagesearch.com/deep-learning-computer-visionpython-book/ today First printing, September 2017 To my father, Joe; my wife, Trisha; and the family beagles, Josie and Jemma Without their constant love and support, this book would not be possible Contents Introduction 15 1.1 I Studied Deep Learning the Wrong Way This Is the Right Way 15 1.2 Who This Book Is For 17 1.2.1 1.2.2 Just Getting Started in Deep Learning? 17 Already a Seasoned Deep Learning Practitioner? 17 1.3 Book Organization 1.3.1 1.3.2 1.3.3 1.3.4 Volume #1: Starter Bundle Volume #2: Practitioner Bundle Volume #3: ImageNet Bundle Need to Upgrade Your Bundle? 1.4 Tools of the Trade: Python, Keras, and Mxnet 1.4.1 1.4.2 What About TensorFlow? 18 Do I Need to Know OpenCV? 19 1.5 Developing Our Own Deep Learning Toolset 19 1.6 Summary 20 What Is Deep Learning? 21 2.1 A Concise History of Neural Networks and Deep Learning 22 2.2 Hierarchical Feature Learning 24 2.3 How "Deep" Is Deep? 27 2.4 Summary 30 Image Fundamentals 31 3.1 Pixels: The Building Blocks of Images 3.1.1 Forming an Image From Channels 34 17 17 18 18 18 18 31 3.2 The Image Coordinate System 34 3.2.1 3.2.2 Images as NumPy Arrays 35 RGB and BGR Ordering 36 3.3 Scaling and Aspect Ratios 36 3.4 Summary 38 Image Classification Basics 39 4.1 What Is Image Classification? 4.1.1 4.1.2 4.1.3 A Note on Terminology 40 The Semantic Gap 41 Challenges 42 4.2 Types of Learning 4.2.1 4.2.2 4.2.3 Supervised Learning 45 Unsupervised Learning 46 Semi-supervised Learning 47 4.3 The Deep Learning Classification Pipeline 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 A Shift in Mindset Step #1: Gather Your Dataset Step #2: Split Your Dataset Step #3: Train Your Network Step #4: Evaluate Feature-based Learning versus Deep Learning for Image Classification What Happens When my Predictions Are Incorrect? 4.4 Summary Datasets for Image Classification 53 5.1 MNIST 53 5.2 Animals: Dogs, Cats, and Pandas 54 5.3 CIFAR-10 55 5.4 SMILES 55 5.5 Kaggle: Dogs vs Cats 56 5.6 Flowers-17 56 5.7 CALTECH-101 57 5.8 Tiny ImageNet 200 57 5.9 Adience 58 5.10 ImageNet 58 40 45 48 48 50 50 51 51 51 52 52 5.10.1 What Is ImageNet? 58 5.10.2 ImageNet Large Scale Visual Recognition Challenge (ILSVRC) 58 5.11 Kaggle: Facial Expression Recognition Challenge 59 5.12 Indoor CVPR 60 5.13 Stanford Cars 60 5.14 Summary 60 Configuring Your Development Environment 63 6.1 Libraries and Packages 6.1.1 6.1.2 6.1.3 6.1.4 Python Keras Mxnet OpenCV, scikit-image, scikit-learn, and more 6.2 Configuring Your Development Environment? 64 6.3 Preconfigured Virtual Machine 65 6.4 Cloud-based Instances 65 6.5 How to Structure Your Projects 65 6.6 Summary 66 Your First Image Classifier 67 7.1 Working with Image Datasets 7.1.1 7.1.2 7.1.3 7.1.4 Introducing the “Animals” Dataset The Start to Our Deep Learning Toolkit A Basic Image Preprocessor Building an Image Loader 7.2 k-NN: A Simple Classifier 7.2.1 7.2.2 7.2.3 7.2.4 7.2.5 A Worked k-NN Example k-NN Hyperparameters Implementing k-NN k-NN Results Pros and Cons of k-NN 7.3 Summary Parameterized Learning 81 8.1 An Introduction to Linear Classification 8.1.1 8.1.2 8.1.3 8.1.4 Four Components of Parameterized Learning Linear Classification: From Images to Labels Advantages of Parameterized Learning and Linear Classification A Simple Linear Classifier With Python 8.2 The Role of Loss Functions 8.2.1 8.2.2 8.2.3 What Are Loss Functions? 88 Multi-class SVM Loss 89 Cross-entropy Loss and Softmax Classifiers 91 8.3 Summary Optimization Methods and Regularization 95 9.1 Gradient Descent 9.1.1 9.1.2 9.1.3 9.1.4 9.1.5 9.1.6 The Loss Landscape and Optimization Surface The “Gradient” in Gradient Descent Treat It Like a Convex Problem (Even if It’s Not) The Bias Trick Pseudocode for Gradient Descent Implementing Basic Gradient Descent in Python 63 63 64 64 64 67 67 68 69 70 72 74 75 75 78 79 80 82 82 83 84 85 88 94 96 96 97 98 98 99 100 9.1.7 Simple Gradient Descent Results 104 9.2 Stochastic Gradient Descent (SGD) 9.2.1 9.2.2 9.2.3 Mini-batch SGD 106 Implementing Mini-batch SGD 107 SGD Results 110 9.3 Extensions to SGD 9.3.1 9.3.2 9.3.3 Momentum 111 Nesterov’s Acceleration 112 Anecdotal Recommendations 113 9.4 Regularization 9.4.1 9.4.2 9.4.3 9.4.4 What Is Regularization and Why Do We Need It? Updating Our Loss and Weight Update To Include Regularization Types of Regularization Techniques Regularization Applied to Image Classification 9.5 Summary 10 Neural Network Fundamentals 121 10.1 Neural Network Basics 106 111 113 113 115 116 117 119 121 10.1.1 Introduction to Neural Networks 10.1.2 The Perceptron Algorithm 10.1.3 Backpropagation and Multi-layer Networks 10.1.4 Multi-layer Networks with Keras 10.1.5 The Four Ingredients in a Neural Network Recipe 10.1.6 Weight Initialization 10.1.7 Constant Initialization 10.1.8 Uniform and Normal Distributions 10.1.9 LeCun Uniform and Normal 10.1.10 Glorot/Xavier Uniform and Normal 10.1.11 He et al./Kaiming/MSRA Uniform and Normal 10.1.12 Differences in Initialization Implementation 122 129 137 153 163 165 165 165 166 166 167 167 10.2 Summary 168 11 Convolutional Neural Networks 169 11.1 Understanding Convolutions 11.1.1 11.1.2 11.1.3 11.1.4 11.1.5 11.1.6 Convolutions versus Cross-correlation The “Big Matrix” and “Tiny Matrix" Analogy Kernels A Hand Computation Example of Convolution Implementing Convolutions with Python The Role of Convolutions in Deep Learning 11.2 CNN Building Blocks 11.2.1 11.2.2 11.2.3 11.2.4 11.2.5 11.2.6 11.2.7 Layer Types Convolutional Layers Activation Layers Pooling Layers Fully-connected Layers Batch Normalization Dropout 170 170 171 171 172 173 179 179 181 181 186 186 188 189 190 ... a deep learning for computer vision consultant/contractor, or even start your own computer vision- based company that leverages deep learning So grab your highlighter Find a comfortable spot And... trying semester I could clearly see the value of deep learning for computer vision, but I had nothing to show for my effort, except for a stack of deep learning papers on my desk that I understood... Mark Twain Welcome to Deep Learning for Computer Vision with Python This book is your guide to mastering deep learning applied to practical, real-world computer vision problems utilizing the Python