Deep Learning Environment set-up: From a viewpoint of a Beginner…A Step by step Guide

This is the world of AI. Everyone is trying getting into this field. This article is for those who want to do their hands dirty and try something by themselves. This is a step by step guide to explain you how to start with any Deep learning project which covers the following steps:

Setting Up an AWS GPU Instance

GPUs, Graphics Processing Units, are specialized processors originally created for computer graphics tasks. Modern GPUs contain a lot of simple processors (cores) and are highly parallel, which makes them very effective in running some algorithms. First of all, we need to understand why we need a GPU, especially for Deep Learning. In each and every article related to deep learning we always read that deep learning model training requires a lot of computational efforts. That is true. But one can only train the model using GPU is not True. The model can be trained on your laptop. But training a model on your laptop is like this:

So, if you want not to spend too much time in getting your model done …. you need a GPU. A very good article on this is here. NVIDIA GPUs are considered to be best for Deep Learning models because almost every Deep Learning framework supports NVIDIA GPUs. There are two options of using NVIDIA GPUs. One is we can buy graphics card and install it on our laptop and then manually set it as the default processor. But this seems to be costly especially for the beginners. The next option is using the GPUs in virtual environment like AWS EC2(Amazon Cloud Elastic Compute) instance. For that all you need a valid AWS account. Below are the steps that we need to take to set up a GPU Instance on AWS:

Create an account on AWS cloud here. You can also AWS free Tier which includes 750 hours of Linux and Windows t2.micro instances each month for one year.

select availability zone (Note that price varies according to the zone)

Protect against accidental termination (optional)

add storage — 120 GB (Depending on requirement. But if you are still in learning phase, 120 GB is more than enough)

add tags such as name and env…

select security group

launch and choose key

You will get a SSH key which you have to use every time to connect to the AWS instance from terminal. And you find this key in your downloads or your preferred directory. And you are done with setting the virtual environment for your deep learning model. The next step is to install NVIDIA GPU in this virtual environment. The steps are the following:

Connect to the instance

Navigate to the directory/downloads where you have stored your SSH key and use below command to connect to your instance in terminal:

Great… all set to start with your first deep learning model training ! !

cuDNN

Now, register an account on NVIDIA’s Accelerated Computing Developer Program and download cuDNN (latest version) to your local machine. In my case this is cuDNN 9.0. Upload all the files on AWS instance using the following commandUpload the files on AWS instance and install them in docker with the help of following commands

For the purpose of understanding let’s take an example of building an Object Detection model. For this purpose, we will look into the open source libraries. Fortunately, we are living the world of knowledge sharing. Google’s Tensorflow is one of the best open source library which not only provides the the best framework for deep learning framework but also the trained model zoo for different purpose. Lets clone the tensorflow models git repository in our docker: