O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Practical Convolutional Neural Networks

Book Description

One stop guide to implementing award-winning, and cutting-edge CNN architectures

About This Book

  • Fast-paced guide with use cases and real-world examples to get well versed with CNN techniques
  • Implement CNN models on image classification, transfer learning, Object Detection, Instance Segmentation, GANs and more
  • Implement powerful use-cases like image captioning, reinforcement learning for hard attention, and recurrent attention models

Who This Book Is For

This book is for data scientists, machine learning and deep learning practitioners, Cognitive and Artificial Intelligence enthusiasts who want to move one step further in building Convolutional Neural Networks. Get hands-on experience with extreme datasets and different CNN architectures to build efficient and smart ConvNet models. Basic knowledge of deep learning concepts and Python programming language is expected.

What You Will Learn

  • From CNN basic building blocks to advanced concepts understand practical areas they can be applied to
  • Build an image classifier CNN model to understand how different components interact with each other, and then learn how to optimize it
  • Learn different algorithms that can be applied to Object Detection, and Instance Segmentation
  • Learn advanced concepts like attention mechanisms for CNN to improve prediction accuracy
  • Understand transfer learning and implement award-winning CNN architectures like AlexNet, VGG, GoogLeNet, ResNet and more
  • Understand the working of generative adversarial networks and how it can create new, unseen images

In Detail

Convolutional Neural Network (CNN) is revolutionizing several application domains such as visual recognition systems, self-driving cars, medical discoveries, innovative eCommerce and more.You will learn to create innovative solutions around image and video analytics to solve complex machine learning and computer vision related problems and implement real-life CNN models.

This book starts with an overview of deep neural networkswith the example of image classification and walks you through building your first CNN for human face detector. We will learn to use concepts like transfer learning with CNN, and Auto-Encoders to build very powerful models, even when not much of supervised training data of labeled images is available.

Later we build upon the learning achieved to build advanced vision related algorithms for object detection, instance segmentation, generative adversarial networks, image captioning, attention mechanisms for vision, and recurrent models for vision.

By the end of this book, you should be ready to implement advanced, effective and efficient CNN models at your professional project or personal initiatives by working on complex image and video datasets.

Style and approach

An easy to follow concise and illustrative guide explaining the core concepts of ConvNets to help you understand, implement and deploy your CNN models quickly.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Practical Convolutional Neural Networks
  3. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  4. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Deep Neural Networks – Overview
    1. Building blocks of a neural network
    2. Introduction to TensorFlow
      1. Installing TensorFlow
        1. For macOS X/Linux variants
        2. TensorFlow basics
        3. Basic math with TensorFlow
        4. Softmax in TensorFlow
    3. Introduction to the MNIST dataset 
      1. The simplest artificial neural network
        1. Building a single-layer neural network with TensorFlow
    4. Keras deep learning library overview
      1. Layers in the Keras model
    5. Handwritten number recognition with Keras and MNIST
      1. Retrieving training and test data
        1. Flattened data
      2. Visualizing the training data
      3. Building the network
      4. Training the network
      5. Testing
    6. Understanding backpropagation 
    7. Summary
  7. Introduction to Convolutional Neural Networks
    1. History of CNNs
    2. Convolutional neural networks
      1. How do computers interpret images?
      2. Code for visualizing an image 
      3. Dropout
      4. Input layer
      5. Convolutional layer
        1. Convolutional layers in Keras
      6. Pooling layer
    3. Practical example – image classification
      1. Image augmentation
    4. Summary
  8. Build Your First CNN and Performance Optimization
    1. CNN architectures and drawbacks of DNNs
      1. Convolutional operations
      2. Pooling, stride, and padding operations
        1. Fully connected layer
    2. Convolution and pooling operations in TensorFlow
      1. Applying pooling operations in TensorFlow
      2. Convolution operations in TensorFlow
    3. Training a CNN
      1. Weight and bias initialization
      2. Regularization
      3. Activation functions
        1. Using sigmoid
        2. Using tanh
        3. Using ReLU
    4. Building, training, and evaluating our first CNN
      1. Dataset description
        1. Step 1 – Loading the required packages
        2. Step 2 – Loading the training/test images to generate train/test set
        3. Step 3- Defining CNN hyperparameters
        4. Step 4 – Constructing the CNN layers
        5. Step 5 – Preparing the TensorFlow graph
        6. Step 6 – Creating a CNN model
        7. Step 7 – Running the TensorFlow graph to train the CNN model
        8. Step 8 – Model evaluation
    5. Model performance optimization
      1. Number of hidden layers
      2. Number of neurons per hidden layer
      3. Batch normalization
      4. Advanced regularization and avoiding overfitting
        1. Applying dropout operations with TensorFlow
      5. Which optimizer to use?
      6. Memory tuning
      7. Appropriate layer placement
      8. Building the second CNN by putting everything together
        1. Dataset description and preprocessing
        2. Creating the CNN model
        3. Training and evaluating the network
    6. Summary
  9. Popular CNN Model Architectures
    1. Introduction to ImageNet
    2. LeNet
    3. AlexNet architecture
      1. Traffic sign classifiers using AlexNet
    4. VGGNet architecture
      1. VGG16 image classification code example
    5. GoogLeNet architecture
      1. Architecture insights
      2. Inception module
    6. ResNet architecture
    7. Summary
  10. Transfer Learning
    1. Feature extraction approach
      1. Target dataset is small and is similar to the original training dataset
      2. Target dataset is small but different from the original training dataset
      3. Target dataset is large and similar to the original training dataset
      4. Target dataset is large and different from the original training dataset
    2. Transfer learning example
    3. Multi-task learning
    4. Summary
  11. Autoencoders for CNN
    1. Introducing to autoencoders
    2. Convolutional autoencoder
    3. Applications
      1. An example of compression
    4. Summary
  12. Object Detection and Instance Segmentation with CNN
    1. The differences between object detection and image classification
      1. Why is object detection much more challenging than image classification?
    2. Traditional, nonCNN approaches to object detection
      1. Haar features, cascading classifiers, and the Viola-Jones algorithm
        1. Haar Features
        2. Cascading classifiers
        3. The Viola-Jones algorithm
    3. R-CNN – Regions with CNN features
    4. Fast R-CNN – fast region-based CNN
    5. Faster R-CNN – faster region proposal network-based CNN
    6. Mask R-CNN – Instance segmentation with CNN
    7. Instance segmentation in code
      1. Creating the environment
        1. Installing Python dependencies (Python2 environment)
        2. Downloading and installing the COCO API and detectron library (OS shell commands)
      2. Preparing the COCO dataset folder structure
      3. Running the pre-trained model on the COCO dataset
    8. References
    9. Summary
  13. GAN: Generating New Images with CNN
    1. Pix2pix - Image-to-Image translation GAN
      1. CycleGAN 
      2. Training a GAN model
    2. GAN – code example
      1. Calculating loss 
        1. Adding the optimizer
      2. Semi-supervised learning and GAN
    3. Feature matching
      1. Semi-supervised classification using a GAN example
      2. Deep convolutional GAN
        1. Batch normalization
    4. Summary
  14. Attention Mechanism for CNN and Visual Models
    1. Attention mechanism for image captioning
    2. Types of Attention
      1. Hard Attention
      2. Soft Attention
    3. Using attention to improve visual models
      1. Reasons for sub-optimal performance of visual CNN models
      2. Recurrent models of visual attention
        1. Applying the RAM on a noisy MNIST sample
          1. Glimpse Sensor in code
    4. References
    5. Summary
  15. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think