Microsoft Cognitive Toolkit - Installation On Windows 7

Introduction 

 
Deep learning is one of the most anticipated mechanisms of artificial intelligence/machine learning domains. But, it requires costly GPU enabled resources for the implementation of its algorithm.
 
However, as technology grows, facilitation for development also grows. Microsoft introduced a cognitive toolkit, an open-source toolkit, available to everyone for solving deep learning and many more AI/machine learning related problems. The cognitive toolkit also provides a CPU-only version that helps scientists experiment with their deep learning models on a regular PC/Laptop machine 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 it provides many more rich libraries in the AI/Machine Learning domain than C# which is fairly new in the game and will gradually mature surely.
 
qw
  

Prerequisites

 
Following are some prerequisites before you proceed any further in this tutorial,
  1. Upgrade Windows Power Shell to the 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 the cognitive toolkit is being used in this article.
 

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 the following steps to upgrade & verify your power shell version.
 
Step 1
 
Open Windows power shell as administrator from windows search feature or via Star->Accessories->Windows Powershell as shown below.
 
a
  
OR
 
s
  
Step 2
 
Type "$PSVersionTable" command and press enter. Then look at the value of "PSVersion" as shown below. If it's not the latest version according to the "Upgrading existing Windows PowerShell" table then perform below steps otherwise skip this section.
 
d
  
Step 3
 
Download the 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.
 
Step 4
 
Unzip the "Win7AndW2K8R2-KB3191566-x64" package and double click the ".MSU" installer as shown below.
 
f
  
Step 5
 
When the 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 the following steps to install Microsoft Cognitive Toolkit on Windows 7 SP1.
 
Step 1
 
Extract the contents of the downloaded CNTK on your C or root of your selected drive as shown below.
 
g
  
Step 2
 
Open command prompt (cmd) as administrator via windows search feature or from accessories->Command Prompt.
 
h
  
OR
 
j
  
Step 3
 
Now, type "cd C:\CNTK-2-5-1\Scripts\install\windows" command and press enter as shown below. Whereas "C:\CNTK-2-5-1" is the path where I have extracted my CNTK.
 
k
  
Step 4
 
Now, type "Install.bat" command and hit enter as shown below.
 
l
  
Type "1" and press enter when you are shown the following message as shown below.
 
q
  
Type "y" and press enter when you are shown the following message as shown below.
 
w
  
Step 5
 
Wait for a while as the installation process is processing. When the installation process successfully completes then you will see the following message as shown below.
 
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 the below steps.
 
Step 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 required Python environments as needed. You can also see your global Python environment which you have set up while installing Python tools for Visual Studio. Our environment is the one which is for CNTK as shown below
 
r
 
t
 
Step 2
 
Now, create a new Python project for existing python code and name it "NumpyInterop" as shown below.
 
y
  
Step 3
 
In the following, the Wizard provides the path of the "FeedForwardNet.py" Python code file folder which you have downloaded for this tutorial and click "Next" as shown below.
 
u
 
Step 4
 
Now, choose CNTK python environment and also select the code file and click "Next" as shown below i.e.
 
i
 
o
  
Step 5
 
Provide the path where you want to save your Visual Studio project file and click "Finish" as shown below.
 
p
 
Step 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.
 
asdf
 
asd
 
Step 7
 
Your project executes successfully and verifies the successful installation of Microsoft Cognitive Toolkit on Windows 7 SP1. You will see the following output.
 
as
 

Conclusion

 
In this article, you learned to install Microsoft Cognitive Toolkit on Windows 7 SP1 with CPU the only environment. You also learned to execute CNTK code on Visual Studio & Python environments. You also learned to upgrade your machine's Windows power shell. 


Similar Articles