Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Machine Learning for OpenCV 4
Machine Learning for OpenCV 4

Machine Learning for OpenCV 4: Intelligent algorithms for building image processing apps using OpenCV 4, Python, and scikit-learn , Second Edition

Arrow left icon
Profile Icon Sharma Profile Icon Michael Beyeler (USD) Profile Icon Vishwesh Ravi Shrimali Profile Icon Michael Beyeler
Arrow right icon
€8.99 €29.99
eBook Sep 2019 420 pages 2nd Edition
eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Sharma Profile Icon Michael Beyeler (USD) Profile Icon Vishwesh Ravi Shrimali Profile Icon Michael Beyeler
Arrow right icon
€8.99 €29.99
eBook Sep 2019 420 pages 2nd Edition
eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Machine Learning for OpenCV 4

A Taste of Machine Learning

So, you have decided to enter the field of machine learning. That's great!

Nowadays, machine learning is all around us—from protecting our email, to automatically tagging our friends in pictures, to predicting what movies we like. As a form of artificial intelligence, machine learning enables computers to learn through experience; to make predictions about the future using collected data from the past. On top of that, computer vision is one of today's most exciting application fields of machine learning, with deep learning and convolutional neural networks driving innovative systems such as self-driving cars and Google's DeepMind.

However, fret not; your application does not need to be as large-scale or world-changing as the previous examples in order to benefit from machine learning. In this chapter, we will talk about why machine...

Technical requirements

You can refer to the code for this chapter at the following link: https://github.com/PacktPublishing/Machine-Learning-for-OpenCV-Second-Edition/tree/master/Chapter01.

Here is a short summary of the software and hardware requirements:

  • OpenCV version 4.1.x (4.1.0 or 4.1.1 will both work just fine).
  • Python version 3.6 (any Python version 3.x will be fine).
  • Anaconda Python 3 for installing Python and the required modules.
  • You can use any OS—macOS, Windows, and Linux-based OS—with this book. We recommend you have at least 4 GB RAM in your system.
  • You don't need to have a GPU to run the code provided with this book.

Getting started with machine learning

Machine learning has been around for at least 60 years. Growing out of the quest for artificial intelligence, early machine learning systems inferred the hand-coded rules of if...else statements to process data and make decisions. Think of a spam filter whose job is to parse incoming emails and move unwanted messages to a spam folder as shown here in the following diagram:

We could come up with a blacklist of words that, whenever they show up in a message, would mark an email as spam. This is a simple example of a hand-coded expert system. (We will build a smarter one in Chapter 7, Implementing a Spam Filter with Bayesian Learning.)

These expert decision rules can become arbitrarily complicated if we are allowed to combine and nest them in what is known as a decision tree (Chapter 5, Using Decision Trees to Make a Medical Diagnosis). Then...

Problems that machine learning can solve

Most machine learning problems belong to one of the following three main categories:

  • In supervised learning, we have what is referred to as the label for a data point. Now, this can be the class of an object that is captured in the image, a bounding box around a face, the digit present in the image, or anything else. Think of it as a teacher who teaches but also tells you what the correct answer is to a problem. Now, the student can try to devise a model or an equation that takes into account all the problems and their correct answers and finds out the answer to a problem that does (or does not) have a correct answer. The data that goes into learning the model is called the training data and the data on which the process/model is tested is called test data. These predictions come in two flavors, such as identifying new photos with the...

Getting started with Python

Python has become the common language for many data science and machine learning applications, thanks to its great number of open source libraries for processes such as data loading, data visualization, statistics, image processing, and natural language processing. One of the main advantages of using Python is the ability to interact directly with the code, using a Terminal or other tools such as the Jupyter Notebook, which we'll look at shortly.

If you have mostly been using OpenCV in combination with C++, I would strongly suggest that you switch to Python, at least for the purpose of studying this book. This decision has not been made out of spite! Quite the contrary: I have done my fair share of C/C++ programming—especially in combination with GPU computing via NVIDIA's Compute Unified Device Architecture (CUDA)—and I like...

Getting started with OpenCV

Being the avid user of OpenCV that I believe you are, I probably don't have to convince you about the power of OpenCV.

Built to provide a common infrastructure for computer vision applications, OpenCV has become a comprehensive set of both classic and state-of-the-art computer vision and machine learning algorithms. According to their own documentation, OpenCV has a user community of more than 47,000 people and has been downloaded over seven million times. That's pretty impressive! As an open source project, it is very easy for researchers, businesses, and government bodies to utilize and modify already available code.

That being said, a number of open source machine learning libraries have popped up as part of the recent machine learning boom that provide far more functionality than OpenCV. A prominent example is scikit-learn, which provides...

Installation

Before we get started, let's make sure that we have all the tools and libraries installed that are necessary to create a fully functioning data science environment. After downloading the latest code for this book from GitHub, we are going to install the following software:

  • Python's Anaconda distribution, based on Python 3.6 or higher
  • OpenCV 4.1
  • Some supporting packages
Don't feel like installing stuff? You can also visit https://mybinder.org/v2/gh/PacktPublishing/Machine-Learning-for-OpenCV-Second-Edition/master, where you will find all the code for this book in an interactive, executable environment and 100% free and open source, thanks to the Binder project.

Getting the latest code for this book

...

Applications of machine learning

Machine learning, artificial intelligence, deep learning, and data science are four terms that I believe are going to change the way we have always looked at things. Let's see if I can convince you why I believe so.

From making a computer learn how to play Go and defeat the world champion of the very same game to using the same branch to detect whether a person has a tumor or not just by seeing their brain's CT Scan, machine learning has left its mark in every single domain. One of the projects that I worked on was using machine learning to determine the residual life cycle of boiler water wall tubes in thermal power plants. The proposed solution was successful in saving a huge amount of money by using the tubes more efficiently. If you thought that machine learning applications are limited to engineering and medical science, then you...

What's new in OpenCV 4.0?

So, we come to the last section of the very first chapter. I will keep it short and to the point since you as a reader can safely skip it. The topic of our discussion is OpenCV 4.0.

OpenCV 4.0 is a result of three and a half years of hard work and bug fixes by OpenCV and was finally released in November 2018. In this section, we will look at some of the major changes and new features in OpenCV 4.0:

  • With the OpenCV 4.0 release, OpenCV has officially become a C++11 library. This means that you have to make sure that a C++11 compliant compiler is present in your system when you are trying to compile OpenCV 4.0.
  • In continuation of the previous point, a lot of C APIs have been removed. Some of the modules that have been affected include Video IO module (videoio), Object Detection module (objdetect), and others. File IO for XML, YAML, and JSON have also...

Summary

In this chapter, we talked about machine learning at a high abstraction level: what it is, why it is important, and what kinds of problems it can solve. We learned that machine learning problems come in three flavors: supervised learning, unsupervised learning, and reinforcement learning. We talked about the prominence of supervised learning, and that this field can be further divided into two subfields: classification and regression. Classification models allow us to categorize objects into known classes (such as animals into cats and dogs), whereas regression analysis can be used to predict continuous outcomes of target variables (such as the sales price of used cars).

We also learned how to set up a data science environment using the Python Anaconda distribution, how to get the latest code of this book from GitHub, and how to run code in a Jupyter Notebook.

With these...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Gain insights into machine learning algorithms, and implement them using OpenCV 4 and scikit-learn
  • Get up to speed with Intel OpenVINO and its integration with OpenCV 4
  • Implement high-performance machine learning models with helpful tips and best practices

Description

OpenCV is an opensource library for building computer vision apps. The latest release, OpenCV 4, offers a plethora of features and platform improvements that are covered comprehensively in this up-to-date second edition. You'll start by understanding the new features and setting up OpenCV 4 to build your computer vision applications. You will explore the fundamentals of machine learning and even learn to design different algorithms that can be used for image processing. Gradually, the book will take you through supervised and unsupervised machine learning. You will gain hands-on experience using scikit-learn in Python for a variety of machine learning applications. Later chapters will focus on different machine learning algorithms, such as a decision tree, support vector machines (SVM), and Bayesian learning, and how they can be used for object detection computer vision operations. You will then delve into deep learning and ensemble learning, and discover their real-world applications, such as handwritten digit classification and gesture recognition. Finally, you’ll get to grips with the latest Intel OpenVINO for building an image processing system. By the end of this book, you will have developed the skills you need to use machine learning for building intelligent computer vision applications with OpenCV 4.

Who is this book for?

This book is for Computer Vision professionals, machine learning developers, or anyone who wants to learn machine learning algorithms and implement them using OpenCV 4. If you want to build real-world Computer Vision and image processing applications powered by machine learning, then this book is for you. Working knowledge of Python programming is required to get the most out of this book.

What you will learn

  • Understand the core machine learning concepts for image processing
  • Explore the theory behind machine learning and deep learning algorithm design
  • Discover effective techniques to train your deep learning models
  • Evaluate machine learning models to improve the performance of your models
  • Integrate algorithms such as support vector machines and Bayes classifier in your computer vision applications
  • Use OpenVINO with OpenCV 4 to speed up model inference

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 06, 2019
Length: 420 pages
Edition : 2nd
Language : English
ISBN-13 : 9781789537192
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 06, 2019
Length: 420 pages
Edition : 2nd
Language : English
ISBN-13 : 9781789537192
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 102.97
Qt 5 and OpenCV 4 Computer Vision Projects
€32.99
OpenCV 4 Computer Vision Application Programming Cookbook
€32.99
Machine Learning for OpenCV 4
€36.99
Total 102.97 Stars icon
Banner background image

Table of Contents

17 Chapters
Section 1: Fundamentals of Machine Learning and OpenCV Chevron down icon Chevron up icon
A Taste of Machine Learning Chevron down icon Chevron up icon
Working with Data in OpenCV Chevron down icon Chevron up icon
First Steps in Supervised Learning Chevron down icon Chevron up icon
Representing Data and Engineering Features Chevron down icon Chevron up icon
Section 2: Operations with OpenCV Chevron down icon Chevron up icon
Using Decision Trees to Make a Medical Diagnosis Chevron down icon Chevron up icon
Detecting Pedestrians with Support Vector Machines Chevron down icon Chevron up icon
Implementing a Spam Filter with Bayesian Learning Chevron down icon Chevron up icon
Discovering Hidden Structures with Unsupervised Learning Chevron down icon Chevron up icon
Section 3: Advanced Machine Learning with OpenCV Chevron down icon Chevron up icon
Using Deep Learning to Classify Handwritten Digits Chevron down icon Chevron up icon
Ensemble Methods for Classification Chevron down icon Chevron up icon
Selecting the Right Model with Hyperparameter Tuning Chevron down icon Chevron up icon
Using OpenVINO with OpenCV Chevron down icon Chevron up icon
Conclusion Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.