Hello everyone welcome to the semicolon. In this series deep learning with Python we will be understanding and implementing a lot of deep
learning algorithms. In this tutorial
we'll go ahead and set up our development environment so that it is easy for us
to implement the deep learning algorithms we learn.
We will be using Tensorflow and thick Keras.
Tensorflow is a open source library
for numerical computations, it was developed by engineers working on the Google brain team
which is Google's machine learning team and
Tensorflow is little less intuitive and
difficult to work for beginners. So to solve this problem and focus on the actual thing which is
architecture of our deep learning model and
understanding these deep learning algorithms
we'll abstract tensorflow with Keras. Now Keras is another open source library
which helps in removing all the complexities of
Tensorflow and similar libraries like Theano.
It runs with either Tensorflow or Theano on the backend and provides us with simple and intuitive APIs for
implementing deep learning algorithms
So to use Tensorflow and Keras we install Anaconda.
Anaconda is a package which provides Python and most of its libraries used for machine learning
pre-installed. So let's go ahead and download Anaconda.
Type Anaconda on Google, click on the first link and then click on download
Since numpy has recently dropped support for Python 2.7. I
suspect the other libraries to follow it in near future. So let's stay future-proof and download Python 3.6
I'll be downloading the 64-bit version
But you have to download it according to your machine specification and once downloaded start the installation
and wait for it to complete
So Anaconda gives us a very easy way to install and manage libraries
It has pip which is Python package manager and also it has Conda
which is kind of installation manager for Anaconda. So Anaconda lets you have different environments just like
sandboxes. So you can install different sets of libraries in different
environments according to your need for now we'll be using a default environment
So while this is being installed, let's look at how we install Tensorflow and Keras on Windows.
I do not have a NVIDIA GPU so I'll be using the CPU version of Tensorflow. The best way is to follow the
instructions given by the official website and Tensorflow says we can install it for anaconda by typing pip3
install upgrade Tensorflow
That's it that simple, but when I type it
Python doesn't recognize pip3 Anaconda doesn't recognize pip3 so
let me just type pip instead of pip3 and we're done.
So this is installing Tensorflow and when the installation is done
we will need some sample code to check if Tensorflow is working. So we can find this code
on it's official website itself, so let's just wait for the installation to finish
and then I'll type the code as shown in the website.
And Remember you don't have to understand any part of this code.
We will just check it if it's working. We won't have to understand
this Tensorflow's code until later in this tutorial
where we will be starting to learn
So not big of a problem
just check if it's working because we need Tensorflow to be working
for Keras to be working and Keras is very simple and intuitive and
once we get hang of it we will be starting with Tensorflow.
In the same Anaconda command prompt type IDLE and
this will open a Python integrated development environment or a Python IDE
where you can type in your code and you see the output.
So once you type the code and see the output you can be sure that your Tensorflow
installation has been completed and it is correctly installed
So for Keras we can type pip install Keras
but sometimes the program with pip it doesn't work because of various compatibility issues
So we use Conda install Keras instead and this works.
So Conda will uninstall the libraries with conflicting version and installed the version required
So for now we can just wait for the installation to complete, and it's this simple for us to install
libraries with Anaconda
Now to check with to check if the installation works, we need some sample code again and
we can get the sample code through the website or let's just import
our library from Keras.
Let's import sequential from Keras models so open command prompt and then type IDLE and
when that when that environment opens type from keras dot models import sequential and
wait for it to complete for the first time this may take a lot of time so and
Oops this has failed, and it says Theano is not installed so
now when you install Keras, you get two choices either Theano or Tensorflow and
Tensorflow has stopped its development because there are many other libraries
that's what they say. So we've chosen Tensorflow over it and
that is why we need to inform Keras that we will be going ahead with Tensorflow
So
this will help us stay future proof
For that we need to follow certain steps
so open My Computer in windows or
if you're using if you're not using windows open the Keras dot JSON file wherever it is located
It is generally in the home folder for Windows. It is in my user
sorry my computer user and
the folder with your PC name. In that open the dot Keras folder
and then open Keras dot JSON file
The Keras dot JSON file is a config file for Keras here
you can change the back end from Theano to Tensorflow and the image dimension ordering is
also set to th
Which is Theano style of image representation in which the color comes first
We can change it to tf later on which will mean representing color last
So images are represented through a 3d matrix of either length width color or color length width
So these formats are accepted by numpy and
after changing it
close the Anaconda command prompt and open it again. Type the same code, and this time it works perfectly oh
this throws an error, but that was due to a typing mistake sorry
Now changing it to keras dot models worked perfectly fine and
there we have it our fully working environment of Tensorflow plus Keras
So we'll be starting on with this environment
using Keras right from the next tutorial when we'll be learning various algorithms and
Later on in this tutorial, in this series we will be using Tensorflow
So I have lots of videos coming up subscribe to the channel for more videos. Thank you.