/PyTorch-Computer-Vision-Cookbook

PyTorch Computer Vision Cookbook, Published by Packt

Primary LanguageJupyter NotebookMIT LicenseMIT

PyTorch-Computer-Vision-Cookbook

PyTorch Computer Vision Cookbook

This is the code repository for PyTorch Computer Vision Cookbook, published by Packt.

Over 70 recipes to master the art of computer vision with deep learning and PyTorch 1.x

What is this book about?

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.

This book covers the following exciting features:

  • 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

If you feel this book is for you, get your copy today!

https://www.packtpub.com/

Instructions and Navigations

All of the code is organized into folders.

The code will look like the following:

# define a tensor with specific data type
x = torch.ones(2, 2, dtype=torch.int8)
print(x)
print(x.dtype)
tensor([[1, 1],
 [1, 1]], dtype=torch.int8)
torch.int8

Following is what you need for this book: 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.

With the following software and hardware list you can run all code files present in the book (Chapter 1-10).

Software and Hardware List

Chapter Software required OS required
1 - 10 Python 3.5+, PyTorch 1.x, GPU (preferred) Windows, Mac OS X, and Linux (Any)

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Errata

  • Page 187 (Bullet point 1, second code block):

# Remove empty boxes

targets = [boxes for boxes in targets if boxes is not None] is logically incorrect but it is valid for this example.

Explaination: If there is any target that is None, the function will remove it first, resulting in a list with fewer than 8 elements. Then when we assign the index to every element in the list, the index will not reflect the order of the images, because we have already removed some target. For example:

targets = [bbox0, bbox1, bbox2, None, bbox4, bbox5, bbox6, bbox7]

after removing the None element:

targets = [bbox0, bbox1, bbox2, bbox4, bbox5, bbox6, bbox7]

then we assign them the index which should be (indexes are in the parentheses):

targets = [bbox0 (0), bbox1 (1), bbox2 (2), bbox4 (4), bbox5 (5), bbox6 (6), bbox7 (7)]

but the program now will assign (index are in the parentheses):

targets = [bbox0 (0), bbox1 (1), bbox2 (2), bbox4 (3), bbox5 (4), bbox6 (5), bbox7 (6)]

The reason it is valid here, is, for the dataset used in the chapter, there is no target that is None, so the function will not remove any element from the list.

Related products

Get to Know the Author

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.

Suggestions and Feedback

Click here if you have any feedback or suggestions.