Header Ads

Microsoft Cognitive Toolkit: Installation on Windows 7

Deep learning is one of the most anticipated mechanism of artificial intelligence/machine learning domains. But, it require costly GPU enabled resources for the implementation of its algorithm.
However, as technology grows, facilitation for development also grows. Microsoft introduced cognitive toolkit an open source toolkit access to everyone for solving deep learning and many more AI/machine learning related problems. The cognitive toolkit also provides CPU only version that facilitates scientists to experiment their deep learning models on a regular PC/Laptop machines fulfilling the basic hardware requirement.

Today, I will demonstrate the installation of Microsoft Cognitive Toolkit on windows 7 SP1. I will further demonstrate successful verification of Microsoft Cognitive Toolkit installation on windows 7 via visual studio & python. You can do scripting in Microsoft Cognitive Toolkit via Cognitive Toolkit (CNTK) with C#/.NET API, but, I will recommend scripting with python as python provides much rich libraries in the AI/Machine Learning domain than C# which is fairly new in the game and will gradually mature surely.


Following are some prerequisites before you proceed any further in this tutorial:
  1. Upgrade Windows Power Shell to latest version.
  2. Install Visual Studio 2017.
  3. Install Python tools for Visual Studio.
  4. Download of Microsoft Cognitive Toolkit Latest Release for windows.
  5. Knowledge of Python programming.
You can download the complete source code for this tutorial or you can follow the step by step discussion below. The sample code is developed in Microsoft Visual Studio 2017 Professional & Python 3.x version. The sample code is taken from Microsoft Cognitive Toolkit Tutorials. Also, windows CPU only version of cognitive toolkit is being used in this article.

Download Now!

Windows Power Shell Upgrade

Before we start Microsoft Cognitive Toolkit installation. It is important to ensure that the windows power shell is up to date. I am demonstrating the installation for windows 7 SP1 and windows 7 SP1 default version for power shell is 2. Perform following steps to upgrade & verify your power shell version i.e.

1) Open windows power shell as administrator from windows search feature or via Star->Accessories->Windows Powershell as shown below i.e.


2) Type "$PSVersionTable" command and press enter. Then look the value of "PSVersion" as shown below. If its not the latest version according to the "Upgrading existing Windows PowerShell" table then perform below steps otherwise skip this section.

3) Download latest windows power shell version from "Upgrading existing Windows PowerShell" table according to your windows 7 bit i.e. 64 or 32, mine is 64 bit so I downloaded "Win7AndW2K8R2-KB3191566-x64" package.

4) Unzip the "Win7AndW2K8R2-KB3191566-x64" package and double click the ".MSU" installer as shown below i.e.

5) When installation completes then restart your system and perform the step-1 above to verify your windows power shell version.

Microsoft Cognitive Toolkit Installation

Let's install the cognitive toolkit (CNTK). Ensure that you have downloaded cognitive toolkit (CNTK) for windows CPU only latest version if your machine do not have GPU supported otherwise you can download the latest GPU version. Ensure that you have installed Visual Studio 2017 on your machine as below versions of visual studio will not work with CNTK and ensure that you have installed Python tools for Visual Studio on your machine. Now, perform following steps to install Microsoft Cognitive Toolkit on windows 7 SP1 i.e.

1) Extract the contents of the downloaded CNTK on your C or root of your selected drive as shown below i.e.

2) Open command prompt (cmd) as administrator via windows search feature or from accessories->Command Prompt i.e.


3) Now type "cd C:\CNTK-2-5-1\Scripts\install\windows" command and press enter as shown below. Where as "C:\CNTK-2-5-1" is the path where I have extracted my CNTK i.e.

4) Now, type "Install.bat" command and hit enter as shown below i.e.

Type "1" and press enter when you are shown following message as shown below i.e.

Type "y" and press enter when you are shown following message as shown below i.e.

5) Wait for a while as installation process is processing. When installation process successfully completes then you will see following message as shown below i.e.

Verify Microsoft Cognitive Toolkit via Visual Studio 2017 Python Environment

Now, at this point Microsoft Cognitive Toolkit is successfully installed on your machine. So, let's verify our installation. Download the provided python source code with this article and perform below steps i.e.

1) Open visual studio 2017 and go to "Tools->Python->Python Environments". You will see multiple python environments, so, don't panic CNTK has installed the require python environments as needed. You can also see your global python environment which you have setup while installing Python tools for Visual Studio. Our concern environment is the one which is for CNTK as shown below i.e.

2) Now, create new python project for existing python code and name it "NumpyInterop" as shown below i.e.

3) On the proceeding wizard provide the path of the "FeedForwardNet.py" python code file folder which you have downloaded for this tutorial and click "Next" as shown below i.e.

4) Now, choose CNTK python environment and also select the code file and click "Next" as shown below i.e.

5) Provide the path where you want to save your visual studio project file and click "Finish" as shown below i.e.

6) Your visual studio python project is successfully created and you can also see that your selected python environment for CNTK is the interpreter for your project execution. Now, "Start" project execution as shown below or via "Build-> Start" i.e.

7) Your project executes successfully and verifies successful installation of Microsoft Cognitive Toolkit on windows 7 SP1. You will see following output i.e.


In this article, you will learn to install Microsoft Cognitive Toolkit on windows 7 SP1 with CPU only environment. You will also learn to execute CNTK code on visual studio & python environment. You will also learn to upgrade your machine's windows power shell.

1 comment: