Machine Learning for OpenCV
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:
-
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
. -
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
- Click the
-
Create a conda environment for OpenCV-ML with all required packages:
$ conda env create -f environment.yml
-
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.
-
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 thenotebooks
folder, click on the notebook of your choice, and selectKernel > 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:
- Jake VanderPlas, Python Data Science Handbook: Essential Tools for Working with Data. O'Reilly, ISBN 978-149191205-8, 2016, https://github.com/jakevdp/PythonDataScienceHandbook
- Andreas Muller and Sarah Guido, Introduction to Machine Learning with Python: A Guide for Data Scientists. O'Reilly, ISBN 978-144936941-5, 2016, https://github.com/amueller/introduction_to_ml_with_python
- Sebastian Raschka, Python Machine Learning. Packt, ISBN 978-178355513-0, 2015, https://github.com/rasbt/python-machine-learning-book
These books all come with their own open-source code - check them out when you get a chance!