TensorFlow 2.0 Computer Vision Cookbook
eBook - ePub

TensorFlow 2.0 Computer Vision Cookbook

Jesus Martinez

Share book
  1. 542 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

TensorFlow 2.0 Computer Vision Cookbook

Jesus Martinez

Book details
Book preview
Table of contents
Citations

About This Book

Get well versed with state-of-the-art techniques to tailor training processes and boost the performance of computer vision models using machine learning and deep learning techniquesKey Features• Develop, train, and use deep learning algorithms for computer vision tasks using TensorFlow 2.x• Discover practical recipes to overcome various challenges faced while building computer vision models• Enable machines to gain a human level understanding to recognize and analyze digital images and videosBook DescriptionComputer vision is a scientific field that enables machines to identify and process digital images and videos. This book focuses on independent recipes to help you perform various computer vision tasks using TensorFlow. The book begins by taking you through the basics of deep learning for computer vision, along with covering TensorFlow 2.x's key features, such as the Keras and tf.data.Dataset APIs. You'll then learn about the ins and outs of common computer vision tasks, such as image classification, transfer learning, image enhancing and styling, and object detection. The book also covers autoencoders in domains such as inverse image search indexes and image denoising, while offering insights into various architectures used in the recipes, such as convolutional neural networks (CNNs), region-based CNNs (R-CNNs), VGGNet, and You Only Look Once (YOLO). Moving on, you'll discover tips and tricks to solve any problems faced while building various computer vision applications. Finally, you'll delve into more advanced topics such as Generative Adversarial Networks (GANs), video processing, and AutoML, concluding with a section focused on techniques to help you boost the performance of your networks. By the end of this TensorFlow book, you'll be able to confidently tackle a wide range of computer vision problems using TensorFlow 2.x.What you will learn• Understand how to detect objects using state-of-the-art models such as YOLOv3• Use AutoML to predict gender and age from images• Segment images using different approaches such as FCNs and generative models• Learn how to improve your network's performance using rank-N accuracy, label smoothing, and test time augmentation• Enable machines to recognize people's emotions in videos and real-time streams• Access and reuse advanced TensorFlow Hub models to perform image classification and object detection• Generate captions for images using CNNs and RNNsWho this book is forThis book is for computer vision developers and engineers, as well as deep learning practitioners looking for go-to solutions to various problems that commonly arise in computer vision. You will discover how to employ modern machine learning (ML) techniques and deep learning architectures to perform a plethora of computer vision tasks. Basic knowledge of Python programming and computer vision is required.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is TensorFlow 2.0 Computer Vision Cookbook an online PDF/ePUB?
Yes, you can access TensorFlow 2.0 Computer Vision Cookbook by Jesus Martinez in PDF and/or ePUB format, as well as other popular books in Informatica & Visione artificiale e riconoscimento di schemi. We have over one million books available in our catalogue for you to explore.

Information

Chapter 1: Getting Started with TensorFlow 2.x for Computer Vision

One of the greatest features of TensorFlow 2.x is that it finally incorporates Keras as its high-level API. Why is this so important? While it's true that Keras and TensorFlow have had very good compatibility for a while, they have remained separate libraries with different development cycles, which causes frequent compatibility issues. Now that the relationship between these two immensely popular tools is official, they'll grow in the same direction, following a single roadmap and making the interoperability between them completely seamless. In the end, Keras is TensorFlow and TensorFlow is Keras.
Perhaps the biggest advantage of this merger is that by using Keras' high-level features, we are not sacrificing performance by any means. Simply put, Keras code is production-ready!
Unless the requirements of a particular project demand otherwise, in the vast majority of the recipes in this book, we'll rely on TensorFlow's Keras API.
The reason behind this decision is twofold:
  • Keras is easier to understand and work with.
  • It's the encouraged way to develop using TensorFlow 2.x.
In this chapter, we will cover the following recipes:
  • Working with the basic building blocks of the Keras API
  • Loading images using the Keras API
  • Loading images using the tf.data.Dataset API
  • Saving and loading a model
  • Visualizing a model's architecture
  • Creating a basic image classifier
Let's get started!

Technical requirements

For this chapter, you will need a working installation of TensorFlow 2.x. If you can access a GPU, either physical or via a cloud provider, your experience will be much more enjoyable. In each recipe, in the Getting ready section, you will find the specific preliminary steps and dependencies to complete it. Finally, all the code shown in this chapter is available in this book's GitHub repository at https://github.com/PacktPublishing/Tensorflow-2.0-Computer-Vision-Cookbook/tree/master/ch1.
Check out the following link to see the Code in Action video:
https://bit.ly/39wkpGN.

Working with the basic building blocks of the Keras API

Keras is the official high-level API for TensorFlow 2.x and its use is highly encouraged for both experimental and production-ready code. Therefore, in this first recipe, we'll review the basic building blocks of Keras by creating a very simple fully connected neural network.
Are you ready? Let's begin!

Getting ready

At the most basic level, a working installation of TensorFlow 2.x is all you need.

How to do it…

In the following sections, we'll go over the sequence of steps required to complete this recipe. Let's get started:
  1. Import the required libraries from the Keras API:
    from sklearn.model_selection import train_test_split
    from sklearn.preprocessing import LabelBinarizer
    from tensorflow.keras import Input
    from tensorflow.keras.datasets import mnist
    from tensorflow.keras.layers import Dense
    from tensorflow.keras.models import Model
    from tensorflow.keras.models import Sequential
  2. Create a model using the Sequential API by passing a list of layers to the Sequential constructor. The numbers in each layer correspond to the n...

Table of contents