Discover powerful ways to explore deep learning algorithms and solve real-world computer vision problems using Python Key Features • Solve the trickiest of problems in CV by combining the power of deep learning and neural networks • Get the most out of PyTorch 1.x capabilities to perform image classification, object detection, and much more • Train and deploy enterprise-grade, deep learning models for computer vision applications Book Description Developers can gain a high-level understanding of digital images and videos using computer vision techniques. With this book, you'll learn how to solve the trickiest of problems in computer vision (CV) using the power of deep learning algorithms, and leverage the latest features of PyTorch 1.x to perform a variety of computer vision tasks. Starting with a quick overview of the PyTorch library and key deep learning concepts, the book covers common and not-so-common challenges faced while performing image recognition, image segmentation, captioning, image generation, and many other tasks. You'll implement these tasks using various deep learning architectures such as convolutional neural networks (CNNs), recurrent neural networks (RNNs), long-short term memory (LSTM), and generative adversarial networks (GANs). Using a problem-solution approach, you'll solve any issue you might face while fine-tuning the performance of the model or integrating the model into your application. Additionally, you'll even get to grips with scaling the model to handle larger workloads and implement best practices for training models efficiently. By the end of this book, you'll be able to solve any problem relating to training effective computer vision models. What you will learn • Implement a multi-class image classification network using PyTorch • Understand how to fine-tune and change hyperparameters to train deep learning algorithms • Perform various CV tasks such as classification, detection, and segmentation • Implement a neural-style transfer network based on CNN and pre-trained models • Generate new images using generative adversarial networks • Implement video classification models based on RNN and LSTM • Discover best practices for training and deploying deep learning algorithms for CV applications Who This Book Is For Computer vision professionals, data scientists, deep learning engineers, and AI developers looking for quick solutions for various computer vision problems will find this book useful. Intermediate knowledge of computer vision concepts along with Python programming experience is required. Cover Title Page Copyright and Credits About Packt Contributors Table of Contents Preface Chapter 1: Getting Started with PyTorch for Deep Learning Technical requirements Installing software tools and packages How to do it... Installing Anaconda Installing PyTorch Verifying the installation Installing other packages How it works... Working with PyTorch tensors How to do it... Defining the tensor data type Changing the tensor's data type Converting tensors into NumPy arrays Converting NumPy arrays into tensors Moving tensors between devices How it works... See also Loading and processing data How to do it... Loading a dataset Data transformation Wrapping tensors into a dataset Creating data loaders How it works... Building models How to do it... Defining a linear layer Defining models using nn.Sequential Defining models using nn.Module Moving the model to a CUDA device Printing the model summary How it works... Defining the loss function and optimizer How to do it... Defining the loss function Defining the optimizer How it works... See also Training and evaluation How to do it... Storing and loading models Deploying the model How it works... There's more... Chapter 2: Binary Image Classification Exploring the dataset Getting ready How to do it... How it works... Creating a custom dataset How to do it... How it works... Splitting the dataset How to do it... How it works... Transforming the data How to do it... How it works... Creating dataloaders How to do it... How it works... Building the classification model How to do it... How it works... See also Defining the loss function How to do it... How it works... See also Defining the optimizer How to do it... How it works... See also Training and evaluation of the model How to do it... How it works... There's more... Deploying the model How to do it... How it works... Model inference on test data Getting ready How to do it... How it works... See also Chapter 3: Multi-Class Image Classification Loading and processing data How to do it... How it works... There's more... See also Building the model How to do it... How it works... There's more... See also Defining the loss function How to do it... How it works... See also Defining the optimizer How to do it... How it works... See also Training and transfer learning How to do it... How it works... See also Deploying the model How to do it... How it works... Chapter 4: Single-Object Detection Exploratory data analysis Getting ready How to do it... How it works... Data transformation for object detection How to do it... How it works... There's more... See also Creating custom datasets How to do it... How it works... Creating the model How to do it... How it works... Defining the loss, optimizer, and IOU metric How to do it... How it works... Training and evaluation of the model How to do it... How it works... Deploying the model How to do it... How it works... Chapter 5: Multi-Object Detection Creating datasets Getting ready How to do it... Creating a custom COCO dataset Transforming data Defining the Dataloaders How it works... Creating a YOLO-v3 model How to do it... Parsing the configuration file Creating PyTorch modules Defining the Darknet model How it works... Defining the loss function How to do it... How it works... Training the model How to do it... How it works... Deploying the model How to do it... How it works... See also Chapter 6: Single-Object Segmentation Creating custom datasets Getting ready How to do it... Data exploration Data augmentation Creating the datasets How it works... Defining the model How to do it... How it works... Defining the loss function and optimizer How to do it... How it works... Training the model How to do it... How it works... Deploying the model How to do it... How it works... Chapter 7: Multi-Object Segmentation Creating custom datasets How to do it... How it works... Defining and deploying a model How to do it... How it works... See also Defining the loss function and optimizer How to do it... How it works... Training the model How to do it... How it works... Chapter 8: Neural Style Transfer with PyTorch Loading the data Getting ready How to do it... How it works... Implementing neural style transfer How to do it... Loading the pretrained model Defining loss functions Defining the optimizer Running the algorithm How it works... See also Chapter 9: GANs and Adversarial Examples Creating the dataset How to do it... How it works... Defining the generator and discriminator How to do it... How it works... Defining the loss and optimizer How to do it... How it works... Training the models How to do it... How it works... See also Deploying the generator How to do it... How it works... Attacking models with adversarial examples Getting ready How to do it... Loading the dataset Loading the pre-trained model Implementing the attack How it works... There's more... Chapter 10: Video Processing with PyTorch Creating the dataset Getting ready How to do it... Preparing the data Splitting the data Defining the PyTorch datasets Defining the data loaders How it works... Defining the model How to do it... How it works... Training the model How to do it... How it works... Deploying the video classification model How to do it... How it works... Other Books You May Enjoy Index Discover powerful ways to use deep learning algorithms and solve real-world computer vision problems using Python Key Features Solve the trickiest of problems in computer vision by combining the power of deep learning and neural networks Leverage PyTorch 1.x capabilities to perform image classification, object detection, and more Train and deploy enterprise-grade, deep learning models for computer vision applications Book Description Computer vision techniques play an integral role in helping developers gain a high-level understanding of digital images and videos. With this book, you'll learn how to solve the trickiest problems in computer vision (CV) using the power of deep learning algorithms, and leverage the latest features of PyTorch 1.x to perform a variety of CV tasks. Starting with a quick overview of the PyTorch library and key deep learning concepts, the book then covers common and not-so-common challenges faced while performing image recognition, image segmentation, object detection, image generation, and other tasks. Next, you'll understand how to implement these tasks using various deep learning architectures such as convolutional neural networks (CNNs), recurrent neural networks (RNNs), long short-term memory (LSTM), and generative adversarial networks (GANs). Using a problem-solution approach, you'll learn how to solve any issue you might face while fine-tuning the performance of a model or integrating it into your application. Later, you'll get to grips with scaling your model to handle larger workloads, and implementing best practices for training models efficiently. By the end of this CV book, you'll be proficient in confidently solving many CV related problems using deep learning and PyTorch. What you will learn Develop, train and deploy deep learning algorithms using PyTorch 1.x Understand how to fine-tune and change hyperparameters to train deep learning algorithms Perform various CV tasks such as classification, detection, and segmentation Implement a neural style transfer network based on CNNs and pre-trained models Generate new images and implement adversarial attacks using GANs Implement video classification models based on RNN, LSTM, and 3D-CNN Discover best practices for training and deploying deep learning algorithms for CV applications Who this book is for Computer vision professionals, data scientists, deep learning engineers, and AI developers looking for quick solutions for various computer vision problems will find this book useful. Intermediate-level knowledge of computer vision concepts, along with Python programming experience is required.Michael Avendi is a principal data scientist with vast experience in deep learning, computer vision, and medical imaging analysis. He works on the research and development of data-driven algorithms for various imaging problems, including medical imaging applications. His research papers have been published in major medical journals, including the Medical Imaging Analysis journal. Michael Avendi is an active Kaggle participant and was awarded a top prize in a Kaggle competition in 2017. This book enables you to solve the trickiest of problems in computer vision using deep learning algorithms and techniques. You will learn to use several different algorithms for different CV problems such as classification, detection, segmentation, and more using Pytorch. Packed with best practices in training and deployment of CV applications.