/opencv-machine-learning

Machine Learning for OpenCV: A practical introduction to the world of machine learning using OpenCV and Python

Primary LanguageJupyter NotebookMIT LicenseMIT

Machine Learning for OpenCV

Google group Binder

This is the Jupyter notebook version of the following book:


Michael Beyeler
Machine Learning for OpenCV: A practical introduction to the world of machine learning and image processing using OpenCV and Python

14 July 2017
Packt Publishing Ltd., London, England
Paperback: 382 pages
ISBN 978-178398028-4

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

Table of Contents

Preface

Foreword by Ariel Rokem

  1. A Taste of Machine Learning

  2. Working with Data in OpenCV

  3. First Steps in Supervised Learning

  4. Representing Data and Engineering Features

  5. Using Decision Trees to Make a Medical Diagnosis

  6. Detecting Pedestrians with Support Vector Machines

  7. Implementing a Spam Filter with Bayesian Learning

  8. Discovering Hidden Structures with Unsupervised Learning

  9. Using Deep Learning to Classify Handwritten Digits

  10. Combining Different Algorithms Into an Ensemble

  11. Selecting the Right Model with Hyper-Parameter Tuning

  12. Wrapping Up

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.5, although older versions of Python should work as well (such as Python 2.7).

Using Binder

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

Launch the project: mbeyeler/opencv-machine-learning

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.

  2. Add Conda-Forge to your trusted channels (to simplify installation of OpenCV on Windows platforms):

    $ conda config --add channels conda-forge
    
  3. Create a conda environment for Python 3 with all required packages:

    $ conda create -n Python3 python=3.5 --file requirements.txt
    
  4. Activate the conda environment. On Linux / Mac OS X:

    $ source activate Python3
    

    On Windows:

    $ activate Python3
    

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

  5. 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/opencv-machine-learning
      
  6. Launch Jupyter notebook:

    $ jupyter notebook
    

    This will open up a browser window in your current directory. Navigate to the folder opencv-machine-learning. 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.

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!