Author Archives: spdoddmit-edu

Setting up Docker and TensorFlow for Windows 7 / Windows 10 Home

Installing Docker

  • Download and run the docker-toolbox installer here.
  • Reboot into your BIOS/UEFI settings and enable Virtualization
  • Run ‘Docker Quickstart shell’. Once the VM starts up, run the hello-world image to ensure Docker is working properly

Installing TensorFlow

  • In the existing Docker shell, pull the TensoFlow docker image:
  • Test running the Docker TensorFlow image:
  • Copy the URL with your login Jupyter login token from the Docker Quickstart shell and go to it in your web browser

If you were able to access the page, Docker and TensorFlow have been installed correctly.

Getting the TensorFlow Tutorials

Note: For this tutorial, we are cloning the TensorFlow-Tutorials repo to the root of our user directory, you can put it anywhere you like, but the rest of the tutorial will assume it is located at:

  • Clone the github repo https://github.com/lexfridman/deepcars to your user directory
  • In Docker Quickstart shell, run the TensorFlow docker image and mount the notebooks.
  • In your browser, navigate to URL provided by Docker
  • Ensure that the notebooks for the tutorials are available (you should see ‘1_python_perceptron.ipynb’ as the first notebook).

Congratulations!  If you were able to access the deepcars Notebooks from within your browser, everything should be working!

Note: We recommend adding the command to run the Docker image and mount the notebooks to a script for easy execution. Simply open notepad and paste in the lines

Save the script as ‘start-tensorflow.sh’ in the root of your user directory and run the script within the Docker shell

Installing OpenCV to the TensorFlow Docker Image

This tutorial will walk you through installing OpenCV into an existing TensorFlow Docker image. OpenCV is a library that provides C/C++, Python, and java interfaces for computer vision applications.  Primarily, we will be using OpenCV to read in images for training and testing networks with TensorFlow.

Download the Required Files and Install OpenCV to Your Docker Image

  • Pull the new version of the deepcars repo from https://github.com/lexfridman/deepcars (if you downloaded the repo as a zip previously, replace your old ‘deepcars-master’ directory with the new one from the zip)
  • Download the Dockerfile for installing OpenCV here (Make sure the files saves with no extension, if your browser appends ‘.txt’ to the file, please delete the extension)
  • Open Powershell (Windows) or a terminal (Mac OS X/Linux) and navigate to the directory where you saved ‘Dockerfile’
  • Rebuild the Docker image with OpenCV and save the image as ‘deepcars’

Updating Your Docker Script

  • Open the script you created in the previous tutorial for starting the TensorFlow docker image in a text editor.
  • Change the line

    to

    or, if you are not using a script, execute the above line from now on to launch your Docker image

Now, when you navigate to the URL given to you by Docker, you should have an an additional notebook titled ‘5_tensorflow_traffic_light_classification.ipynb’ that can be run with OpenCV support.

Setting Up Docker and TensorFlow for Linux

Installing Docker

  • Follow the instruction here for your distro
  • Open terminal and run the docker hello-world image

Installing TensorFlow

  • Open a terminal
  • Pull the tensorflow docker image:
  • Test running the Docker TensorFlow image:
  • Copy the URL with your login Jupyter login token from the terminal and go to it in your web browser

If you were able to access the page, Docker and TensorFlow have been installed correctly.

Getting the TensorFlow Tutorials

Note: For this tutorial, we are cloning the deepcars repo to our home directory, you can put it anywhere you like, but the rest of the tutorial will assume it is located at:

  • Clone the github repo https://github.com/lexfridman/deepcars
  • Open a terminal
  • Run the TensorFlow docker image and mount the notebooks.
  • In your browser, navigate to URL provided by Docker inside of your terminal
  • Ensure that the notebooks for the tutorials are available (you should see ‘1_python_perceptron.ipynb’ as the first notebook).

Congratulations!  If you were able to access the deepcars Notebooks from within your browser, everything should be working!

Note: We recommend adding the command to run the Docker image and mount the notebooks to a script for easy execution. Simply open a your favorite text editor and paste in the lines

Save the script as ‘start-tensorflow.sh’ and run

Then run the script

 

 

Setting Up Docker and TensorFlow for Mac OS X

Installing Docker

  • Download the Docker installer here.
  • Mount ‘Docker.dmg’
  • Copy Docker.app to your Application directory
  • Double click Docker.app and wait for Docker to finish starting up
  • Open terminal and run the docker hello-world image

Installing TensorFlow

  • Open a terminal
  • Pull the tensorflow/docker image:
  • Test running the Docker TensorFlow image:
  • Copy the URL with your login Jupyter login token from the terminal and go to it in your web browser

If you were able to access the page, Docker and TensorFlow have been installed correctly.

Getting the TensorFlow Tutorials

Note: For this tutorial, we are cloning the deepcars repo to our home directory, you can put it anywhere you like, but the rest of the tutorial will assume it is located at:

  • Clone the github repo https://github.com/lexfridman/deepcars
  • Enable sharing of the drive you cloned the deepcars repo to in Docker
    • Right Click on the Docker icon on the top of your screen.
    • Click ‘Settings’
    • Go to ‘File Sharing’ and add your home direcory to the list of shared directories.
    • Click ‘Apply and Restart’
  • Open terminal
  • Run the TensorFlow docker image and mount the notebooks.
  • In your browser, navigate to URL provided by Docker inside of the terminal
  • Ensure that the notebooks for the tutorials are available (you should see ‘1_python_perceptron.ipynb’ as the first notebook).

Congratulations!  If you were able to access the deepcars Notebooks from within your browser, everything should be working!

Note: We recommend adding the command to run the Docker image and mount the notebooks to a script for easy execution. Simply open a your favorite text editor and paste in the lines

Save the script as ‘start-tensorflow.sh’ and run

Then run the script

 

 

Setting up Docker and TensorFlow for Windows 10 Professional

Installing Docker

  • Download the Docker installer here.
  • Run ‘InstallDocker.msi’
  • Launch Docker when the installer finishes
  • If Docker warns you about Hyper-V not being enabled, allow Docker to enable Hyper-V and automatically restart your machine
  • Open PowerShell or ‘cmd.exe’ and run the Docker hello-world image to ensure Docker is working properly

Installing TensorFlow

  • Open PowerShell
  • Pull the tensorflow docker image:
  • Test running the Docker TensorFlow image:
  • Copy the URL with your login Jupyter login token from PowerShell and go to it in your web browser

If you were able to access the page, Docker and TensorFlow have been installed correctly.

Getting the TensorFlow Tutorials

Note: For this tutorial, we are cloning the TensorFlow-Tutorials repo to the root of our C: drive, you can put it anywhere you like, but the rest of the tutorial will assume it is located at:

  • Clone the github repo https://github.com/lexfridman/deepcars
  • Enable sharing of the drive you cloned the deepcars repo to in Docker
    • Right Click on the Docker System Try icon.
    • Click ‘Settings’
    • Go to ‘Shared Drives’ and check the box for the drive deepcars is located on.
    • Click ‘Apply’
  • Open PowerShell
  • Run the TensorFlow docker image and mount the notebooks.
  • In your browser, navigate to URL provided by Docker inside of PowerShell
  • Ensure that the notebooks for the tutorials are available (you should see ‘1_python_perceptron.ipynb’ as the first notebook).

Congratulations!  If you were able to access the deepcars Notebooks from within your browser, everything should be working!

Note: We recommend adding the command to run the Docker image and mount the notebooks to a script for easy execution. Simply open notepad and paste in the line

Save the script as ‘start-tensorflow.PS1’ and right click on the file and click ‘Run with PowerShell’ to start the TensorFlow Docker image.