How to install Tensorflow in Windows.

Bonus: Generate the “Bokeh” effect in your image using Google’s DeepLab3+.

Debanga Raj Neog, Ph.D
Depurr
4 min readMar 31, 2019

--

(The list of all my articles is available at https://debanga.github.io/depurr/)

In this article, I have included the steps that worked for me in installing Tensorflow (CPU version) in my Windows 10 machine. First, we will install Python via a Python distribution library known as “Miniconda”. Second, we will install Tensorflow 1.10.

Note: Before starting the installation process, I would suggest you uninstall any previous version of Python you might have in your machine using the tools in the Windows “control panel”.

I have also included a simple TensorFlow code example that generates a simulated “Bokeh” effect in an image. Have fun!

Bokeh effect generates a blurry background.

1. Install Miniconda

Download and Install Miniconda3 4.5.12. Use this static link from my Google drive.

2. Install Tensorflow

  • Search “Anaconda Prompt” in the windows search bar. Open “Anaconda Prompt” by clicking on it.

Now, you have to type a few commands in the “Anaconda Prompt” and then press enter. Each command will update/install different packages needed to run Tensorflow 1.10 in your machine. Each command may take a few minutes to execute, so be patient.

  • Update conda with the newest version:
  • Create a separate python environment with Tensorflow 1.10 and Python 3.6:

Note: Miniconda3 4.5.12 comes with Python 3.7.1. But, Tensorflow 1.13.1 only supports Python 3.6 or lesser. Therefore, we have to downgrade Python 3.7 to version Python 3.6.

3. Test Tensorflow installation

Every time you start working on a Tensorflow project, you should work inside the (tensorflow_env) environment. Just follow the steps below.

  • Open “Anaconda Prompt” as before. Activate (tensorflow_env) environment by typing and entering the following command:

You should see (tensorflow_env) in the prompt:

  • Enter the python terminal:
  • Import tensorflow:

If the command is successfully executed, tensorflow is properly installed in your machine.

Congratulations! You have successfully installed Tensorflow in your machine.

Bonus

Run a sample Tensorflow code that adds “Bokeh” effect to an image! This code uses Google’s DeepLab3+ to segment the background and adds a blur to simulate Bokeh effect.

  • Change directory to the directory containing the sample code:
  • As you can see below, the folder contains ‘main.py’ and a sample image.
  • now run the following command
  • It should prompt you to select an image, you can either select the sample image included in the sample code or select your own image (I would suggest a portrait image):
  • After you select the image, the processed image will be saved in the current folder with the name “Bookeh.jpg”.
Original (left) and Bokeh (right) images.

If you have any questions or if you have any other suggestions for a blog topic, please feel free to post a comment!

--

--

Debanga Raj Neog, Ph.D
Depurr

Entrepreneur. Computer Vision Expert. Machine Learning Nerd. Buy me a Chimay Blue.