/Machine-Learning-for-OpenCV-Second-Edition

Machine Learning for OpenCV Second Edition, published by Packt

Primary LanguageJupyter NotebookMIT LicenseMIT

Machine Learning for OpenCV 4 Second Edition

Machine Learning for OpenCV 4 Second Edition

This is the code repository for Machine Learning for OpenCV 4 Second Edition , published by Packt.

Intelligent algorithms for building image processing apps using OpenCV 4, Python, and scikit-learn

What is this book about?

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.

This book covers the following exciting features:

  • 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

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. For example, Chapter02.

The code will look like the following:

In [1]: from sklearn.ensemble import BaggingClassifier
... from sklearn.neighbors import KNeighborsClassifier
... bag_knn = BaggingClassifier(KNeighborsClassifier(),
... n_estimators=10)

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

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

Software and Hardware List

Chapter Software required OS required
1-13 OpenCV version 4.1.x, Python version 3.6, Anaconda Python 3 Windows/Linux/macOS

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

Related products

Get to Know the Author(s)

Aditya Sharma is a senior engineer at Robert Bosch working on solving real-world autonomous computer vision problems. At Robert Bosch, he also secured first place at an AI hackathon 2019. He has been associated with some of the premier institutes of India, including IIT Mandi and IIIT Hyderabad. At IIT, he published papers on medical imaging using deep learning at ICIP 2019 and MICCAI 2019. At IIIT, his work revolved around document image super-resolution. He is a motivated writer and has written many articles on machine learning and deep learning for DataCamp and LearnOpenCV. Aditya runs his own YouTube channel and has contributed as a speaker at the NCVPRIPG conference (2017) and Aligarh Muslim University for a workshop on deep learning.

Vishwesh Ravi Shrimali graduated from BITS Pilani, where he studied mechanical engineering, in 2018. Since then, he has been working with BigVision LLC on deep learning and computer vision and is also involved in creating official OpenCV courses. He has a keen interest in programming and AI and has applied that interest in mechanical engineering projects. He has also written multiple blogs on OpenCV and deep learning on LearnOpenCV, a leading blog on computer vision. When he is not writing blogs or working on projects, he likes to go on long walks or play his acoustic guitar.

Michael Beyeler is a postdoctoral fellow in neuroengineering and data science at the University of Washington, where he is working on computational models of bionic vision in order to improve the perceptual experience of blind patients implanted with a retinal prosthesis (bionic eye). His work lies at the intersection of neuroscience, computer engineering, computer vision, and machine learning. He is also an active contributor to several open source software projects, and has professional programming experience in Python, C/C++, CUDA, MATLAB, and Android. Michael received a PhD in computer science from the University of California, Irvine, and an MSc in biomedical engineering and a BSc in electrical engineering from ETH Zurich, Switzerland.

Other books by the authors

Suggestions and Feedback

Click here if you have any feedback or suggestions.

Machine Learning for OpenCV 4 Second Edition

Binder

The content is available on GitHub. The code is released under the MIT license.

Running the Code

There are at least two ways you can run the code:

  • Using Binder (no installation required).
  • Using Jupyter Notebook on your local machine.

The code in this book was tested with Python 3.6.

Using Binder

Binder allows you to run Jupyter notebooks in an interactive Docker container. No installation required!

Launch the project: PacktPublishing/Machine-Learning-for-OpenCV-Second-Edition

Using Jupyter Notebook

You basically want to follow the installation instructions in Chapter 1 of the book.

In short:

  1. Download and install Python Anaconda. On Unix, when asked if the Anaconda path should be added to your PATH variable, choose yes. Then either open a new terminal or run $ source ~/.bashrc.

  2. Fork and clone the GitHub repo:

    • Click the Fork button in the top-right corner of this page.
    • Clone the repo, where YourUsername is your actual GitHub user name:
    $ git clone https://github.com/YourUsername/Machine-Learning-for-OpenCV-Second-Edition
    $ cd Machine-Learning-for-OpenCV-Second-Edition
    
    • Add the following to your remotes:
    $ git remote add upstream https://github.com/PacktPublishing/Machine-Learning-for-OpenCV-Second-Edition
    
  3. Create a conda environment for OpenCV-ML with all required packages:

    $ conda env create -f environment.yml
    
  4. Activate the conda environment. On Linux / Mac OS X:

    $ source activate OpenCV-ML
    

    On Windows:

    $ activate OpenCV-ML
    

    You can learn more about conda environments in the Managing Environments section of the conda documentation.

  5. Launch Jupyter notebook:

    $ jupyter notebook
    

    This will open up a browser window in your current directory. Navigate to the folder Machine-Learning-for-OpenCV-Second-Edition. The README file has a table of contents. Else navigate to the notebooks folder, click on the notebook of your choice, and select Kernel > Restart & Run All from the top menu.

Getting the latest code

If you followed the instructions above and:

  • forked the repo,
  • cloned the repo,
  • added the upstream remote repository,

then you can always grab the latest changes by running a git pull:

$ cd Machine-Learning-for-OpenCV-Second-Edition
$ git pull upstream master

Acknowledgment

This book was inspired in many ways by the following authors and their corresponding publications:

These books all come with their own open-source code - check them out when you get a chance!