Cats Versus Dogs – Deep Learning Introduction

Test

Get the introductory slide deck here:
Deep Learning – Convoluted Neural Networks

Relevant code is here:

Cat or Dog

Presentation 2 Update:

Slides: CNN_Rockville2018 -2

Code: Talk 2 Slides

This code will require Tensorflow 1.5 and requisite libraries, which are referred to in the slides. The code is python, but is wrapped in Jyupiter notebooks so you will need to get that. When you are ready, you can get some data sets here:

You can grab datasets from here:

https://www.kaggle.com/c/dogs-vs-cats

 

Installation – From Scratch

You will need Jupyter which requires Python 3, and you will need Tensorflow, which requires a 64-bit version of python. So start by installing python 3 64-bit:

https://www.python.org/downloads/release/python-364/

Note the button on Python’s homepage defaults to a installing a 32-bit version of python.

With Python3 – 64-bit installed, install the needed libraries:

1
pip3 install jupyter

then

1
pip3 install --upgrade tensorflow-gpu

or

1
pip3 install --upgrade tensorflow

per
https://www.tensorflow.org/install/install_windows

Note, the GPU version adds exponential speed, but required additional installations steps. Specifically:

http://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/

That says as long as you have one of these GPUs: https://developer.nvidia.com/cuda-gpus

You can install the needed CUDA Toolkit software:
Note, you need exactly 9.0 not 9.1 for tensorflow 1.5

https://developer.nvidia.com/cuda-toolkit-archive

Then, for the GPU you need cuDNN v7.0.5 for CUDA 9.0

https://developer.nvidia.com/rdp/cudnn-download

Extract it somewhere, and add the /cuda/bin folder to the path.

I then had to add C:/Path/To/NVIDA/bin to my system PATH

So I would stop getting an import error in python3 for:

1
import tensorflow as tf

which you should run in python to make sure it’s working. Next install other python libraries:

1
2
3
4
5
pip3 install h5py

pip3 install keras

python -mpip install -U matplotlib

Now from command line, change directory to location of your files:

eg.

1
cd C:/PATH/TO/Cat-or-Dog

now start the Jupyter Notebook, to interact with the .ipynb files that hold the code:

1
jupyter notebook

This will launch a local server and open a browser tab. Select the first file “Dogs vs Cats – Train a Model TF-Keras Step 1.ipynb”

You can now interact with the code. Notice you will have to change the folder location variables.

You can grab datasets from here:

https://www.kaggle.com/c/dogs-vs-cats

 

https://youtu.be/u87-D-BrnjY

Leave a Reply

Your email address will not be published.