1st Edition

Deep Learning in Practice

By Mehdi Ghayoumi Copyright 2022
    218 Pages 86 B/W Illustrations
    by Chapman & Hall

    218 Pages 86 B/W Illustrations
    by Chapman & Hall

    Deep Learning in Practice helps you learn how to develop and optimize a model for your projects using Deep Learning (DL) methods and architectures.

    Key features:

    • Demonstrates a quick review on Python, NumPy, and TensorFlow fundamentals.
    • Explains and provides examples of deploying TensorFlow and Keras in several projects.
    • Explains the fundamentals of Artificial Neural Networks (ANNs).
    • Presents several examples and applications of ANNs.
    • Learning the most popular DL algorithms features.
    • Explains and provides examples for the DL algorithms that are presented in this book.
    • Analyzes the DL network’s parameter and hyperparameters.
    • Reviews state-of-the-art DL examples.
    • Necessary and main steps for DL modeling.
    • Implements a Virtual Assistant Robot (VAR) using DL methods.
    • Necessary and fundamental information to choose a proper DL algorithm.
    • Gives instructions to learn how to optimize your DL model IN PRACTICE.

    This book is useful for undergraduate and graduate students, as well as practitioners in industry and academia. It will serve as a useful reference for learning deep learning fundamentals and implementing a deep learning model for any project, step by step.

    Preface

    Acknowledgements

    About the Author

    1.      Introduction

    1.1 What is Learning?

          1.2 What is Machine Learning?

          1.3 What is Deep Learning?

          1.4 About this Book!

                1.4.1 Introduction

                1.4.2 Python /NumPy

    1.4.3 TensorFlow and Keras fundamentals

    1.4.4 Artificial Neural Networks (ANNs) Fundamentals and Architectures

    1.4.5 Deep Neural Networks (DNNs) Fundamentals and Architectures

    1.4.6 Deep Neural Networks for Images and Audio Data Analysis

    1.4.7 Deep Neural Networks for Virtual Assistant Robots

    1.4.8 What is the best model?

     

    2.      Python/NumPy Fundamentals

          2.1 Python

                 2.1.1 Variables

                 2.1.2 Keywords

                 2.1.3 Operators and Operand

                 2.1.4 Statements and Expressions

                 2.1.5 Sequence

                 2.1.6 For Loop

                 2.1.7 While Loop

                 2.1.8 String

                 2.1.9 List

                 2.1.10 Dictionary               

                 2.1.11 Tuple

                 2.1.12 Sets

                 2.1.13 Function

                 2.1.14 File

                 2.1.15 Object (class)

          2.2 NumPy

                 2.2.1 Create Array

                 2.2.2 ndarray

                 2.2.3 Access Elements

                 2.2.4 Array Slicing

                 2.2.5 Data Type

                 2.2.6 Array Data Check

                 2.2.7 Shape and Reshape Array

                 2.2.8 Array Iterating

                 2.2.9 Joining Array

                 2.2.10 Splitting Array

                 2.2.11 Searching Arrays

                 2.2.12 Sorting Arrays

                 2.2.13 Filter Array

                 2.2.14 Random Numbers

                 2.2.15 Array Vectorization

                 2.2.16 np.zeros and np.ones

                 2.2.17 hstack and vstack

                 2.2.18 Generate Random Numbers

                 2.2.19 Mathematical Functions

                 2.2.20 Dot Product and Matrix Multiplication

                 2.2.21 Determinant

     

    3.      TensorFlow Fundamentals

           3.1 How TensorFlow Works?

           3.2 Tensors

           3.3 TensorFlow

           3.4 Building a NN Using TensorFlow

     3.4.1 Import the Data

     3.4.2 Loading and Normalize the Data

     3.4.3 Build the Model

     3.4.4 Train and Evaluate the Model

           3.5 Building a CNN Using TensorFlow

     3.5.1 Dataset

     3.5.2 Input Layer

     3.5.3 Convolutional and Pooling Layers

     3.5.4 Dense Layer

     3.5.5 Train and Evaluate the Model

     3.5.6 Test the Model

         3.6 Setup and Install Keras

               3.6.1 Create a Virtual Environment

               3.6.2 Activate the Environment

               3.6.3 Python Libraries

               3.6.4 Available Modules

               3.6.5 Import Libraries and Modules

               3.6.6 Train and Predict the Model

        3.7 Implement an Example Using Keras

               3.7.1 MNIST Example

     

    4.      Artificial Neural Networks Fundamentals and Architectures

          4.1 Terminology

                4.1.1 Inputs

                4.1.2 Weights

                4.1.3 Outputs

                4.1.4 Targets

                4.1.5 Activation Function          

                4.1.6 Error

                4.1.7 Training, Testing, and Validation Sets

                4.1.8 Overfitting

                4.1.9 Underfitting

                4.1.10 Confusion Matrix

                4.1.11 Accuracy Metrics

                4.1.12 Balanced and Unbalanced Datasets

                4.1.13 One Hot Encoding

          4.2 Artificial Neural Networks (ANNs)

    4.2.1 Biological Neuron

    4.2.2 Artificial Neuron

          4.3 Activation Functions

    4.3.1 Sigmoid (sig)

    4.3.2 Tanh or Hyperbolic Tangent (tan)

    4.3.3 Rectified Linear Unit (ReLU)

    4.3.4 Leaky ReLU

          4.4 Loss Functions

    4.4.1 Cross-Entropy Loss

    4.4.2 MSE (L2) Loss

          4.5 Optimization Functions

    4.5.1 Learning Rate

    4.5.2 Convex

    4.5.3 Gradient Descent

    4.5.4 Stochastic Gradient Descent

    4.5.5 Adagrad

    4.5.6 Adam

          4.6 Linear and Nonlinear Functions

    4.6.1 Linear Function

    4.6.2 Nonlinear Functions

          4.7 ANNs architectures

    4.7.1 Feed Forward Neural Networks (FFNNs)

             4.7.1.1 FFN Example in TensorFlow

    4.7.2 Backpropagation

    4.7.3 Single-layer perceptron

    4.7.4 Multi-Layer Perceptron (MLP)

             4.7.4.1 MLP Example in TensorFlow

     

    5.      Deep Neural Networks (DNNs)Fundamentals and Architectures

          5.1 Deep Neural Networks (DNNs)

                5.1.1 What is Deep Learning?

                5.1.2 Deep Learning Needs!

                5.1.3 How to deploy DL More Efficiently?

                5.1.4 Vanishing Gradient

                5.1.5 Channel

                5.1.6 Embedding

                5.1.7 Fine-Tuning

                5.1.8 Data Augmentation

                5.1.9 Generalization

                5.1.10 Regularization

                5.1.11 L1 and L2

                5.1.12 Dropout

                5.1.13 End-to-End Learning

          5.2 Deep Learning Applications

          5.3 Deep Learning Algorithms and Architectures

    5.3.1 Convolutional Neural Networks (CNNs)

    5.3.2 Recurrent Neural Networks (RNNs)

    5.3.3 Long Short-Term Memory (LSTM)

    5.3.4 Generative Adversarial Network (GAN)

    5.3.5 Residual Neural Network Learning ResNets

          5.4 Convolutional Neural Networks (CNNs)

    5.4.1 CNN Layers

              5.4.1.1 Convolution Layers

              5.4.1.2 Pooling Layers

              5.4.1.3 Dropout

              5.4.1.4 Batch Normalization

              5.4.1.5 Fully Connected Llayer

    5.4.2 Design a CNN

          5.5 Recurrent Neural Networks (RNNs)

    5.5.1 Recurrent Neural Network Architecture   

    5.5.2 Long Short-Term Memory (LSTM)

    5.5.3 Designing an RNN

             5.5.3.1 Import Libraries

             5.5.3.2 Load and Normalize the Dataset

             5.5.3.3 Build the Model

             5.5.3.4 Train the Model

             5.5.3.5 Evaluate the Model

          5.6 Generative Adversarial Networks (GANs)

    5.6.1 What is a GAN?

    5.6.2 A GAN for Fashion Dataset

             5.6.2.1. Loading Dataset

             5.6.2.2 Data Preprocessing

                         5.6.2.3 Defining the Discriminator Model

                         5.6.2.4 Defining the Generator Model

                         5.6.2.5 Combining the Generator and Discriminator Model

                         5.6.2.6 Create Train Function and Train the Model

                         5.6.2.7 Predict (generate data)

     

    6.      Deep Neural Networks(DNNs) for Images Analysis

          6.1 Deep Learning and Image Analysis

          6.2 Convolutional Neural Networks (CNNs) and Image Analysis

    6.2.1 Filter Parameters

             6.2.1.1 Number and Type of Filters

             6.2.1.2 Filters Size

             6.2.1.3 Stride and Padding Size

    6.2.2 Number of Parameters

             6.2.2.1 Input Layer

             6.2.2.2 Convolutional Layer

             6.2.2.3 Pooling Layer

             6.2.2.4 Fully Connected Layer (FC)

    6.2.3 Imagenet Challenge

    6.2.4 CNN Architecture

             6.2.4.1 LeNet-5 (1998)

             6.2.4.2 AlexNet (2012)

             6.2.4.3 GoogleNet / Inception-v1 (2014)

             6.2.4.4 VGGNet-16 (2014)

             6.2.4.5 Inception-v3 (2015)

             6.2.4.6 ResNet (2015)

             6.2.4.7 Inception-v4 (2016)

          6.3 General Strategy to Implement Model Using CNNs

                6.3.1. Import Libraries

                6.3.2. Load the Data and Create the Data Categories

                6.3.3. Make the Model

                6.3.4. Train the Model

                6.3.5. Test the Mode

          6.4 Object Recognition Using CNNs

     6.4.1. Import Libraries

     6.4.2. Load the Data and Generate a Dataset

     6.4.3. Make the Model

     6.4.4. Train the Model

     6.4.5. Test the Model

          6.5 Image Classification Using CNNs

                6.5.1. Import Libraries

                6.5.2. Load the Data

                6.5.3. Make the Model

                6.5.4. Train the Model

                6.5.5. Test the Model

          6.6 Image Segmentation

                6.6.1. Import Libraries

                6.6.2. Load the Data and Generate a Dataset

                6.6.3. Segmentation Map

                6.6.4. Make the Model

                6.6.5. Train the Model

                6.6.6. Test the Model

          6.7 Object Recognition Using CNNs

                 6.7.1. Import Libraries

                 6.7.2. Load the Data and Generate a Dataset

                 6.7.3. Make the Model

                           6.7.3.1 The Generator Function

                           6.3.7.2 The Discriminator Function

                 6.7.4. Train the Model

                 6.7.5. Generate images

     

    7.      Deep Neural Networks for Virtual Assistant Robot

          7.1 Virtual Assistant Robot

          7.2 Facial Detection and Recognition

    7.2.1 Architecture

    7.2.2 Face Detection

             7.2.2.1 Import Libraries

             7.2.2.2 Dataset

             7.2.2.3 Define CNN Model and Training

             7.2.2.4 Model Training

             7.2.2.5 Evaluate Performance

    7.2.3 Landmark Detection

              7.2.3.1 CNN Model

              7.2.3.2 Model Training

              7.2.3.3 Test the Trained Model

    7.2.4 Spoof Detection

    7.2.5 Encoding the Face

    7.2.6 Training

    7.2.7 Testing

           7.3 Emotion Recognition Using Speech

     7.3.1   Dataset Collection

     7.3.2   Data Preprocessing

                7.3.2.1 Labeling

                7.3.2.2 Feature Extraction

                7.3.2.3 Data Augmentation

     7.3.3   Model Training

     7.3.4   Model Evaluation

     7.3.5   Test the Trained Model

          7.4 Speech to Text

    7.4.1. Feature Extraction

    7.4.2. Deep Neural Networks Modeling

    7.4.3. Decoder

    7.4.4. Predictions Calculation

          7.5 Sentiment Analysis

    7.5.1. Load Dataset

    7.5.2. Create a DAN Network

    7.5.3. Train the Network

    7.5.4. Evaluate the Model

     

    8.      Finding the Best Model

          8.1 Data Preprocessing

          8.2 What is a Good Model?

          8.3 What is the Noise?

    8.3.1 Labeling

    8.3.2 Features

          8.4 What is the Bias?

    8.4.1 Incorrect Classifier

    8.4.2 Incorrect Features

          8.5 What is the Variance?

    8.5.1. New Dataset

          8.6 Bias/Variance

          8.7 How Can We Find the Problems in a Model?

    8.7.1 High Variance

    8.7.2 High Bias

     

    References

    Index

     

     

     

    Biography

    Dr. Mehdi Ghayoumi is a course facilitator at Cornell University and adjunct faculty of Computer Science at the University of San Diego. Prior to this, he was a research assistant professor at SUNY at Binghamton, where he was the Media Core Lab’s dynamic leader. He was also a lecturer at Kent State University, where he received the Teaching Award for two consecutive years in 2016 and 2017. In addition, he has been teaching machine learning, data science, robotic and programming courses for several years.

    Dr. Ghayoumi research interests are in Machine Learning, Machine Vision, Robotics, and Human-Robot Interaction (HRI). His research focuses are on building real systems for realistic environment settings, and his current projects have applications in Human-Robot Interaction, manufacturing, biometric, and healthcare.

    He is a technical program committee member of several conferences, workshops, and editorial board member of several journals in machine learning, mathematics, and robotics, like ICML, ICPR, HRI, FG, WACV, IROS, CIBCB, and JAI. In addition, his research papers have been published at conferences and journals in the fields, including Human-Computer Interaction (HRI), Robotics Science and Systems (RSS), International Conference on Machine Learning and Applications (ICMLA), and others.