Computer Vision with CNN: Basic Python, Numpy, Pandas, Matplotlib, Keras Text MLP, VGGNet, ResNet, Custom Model in Colab

## Requirements

- Basic computer knowledge and an interest to learn the Deep Learning using Keras

## Description

Welcome to my new course ‘Deep Learning from the Scratch using Python and Keras’.

As you already know the artificial intelligence domain is divided broadly into deep learning and machine learning. In-fact deep learning is machine learning itself but Deep learning with its deep neural networks and algorithms try to learn high-level features from data without human intervention. That makes deep learning the base of all future self intelligent systems.

And in this course, I am starting from the very basic things to learn like learning the programming language basics and other supporting libraries at first and proceed with the core topic.

Let’s see what are the interesting topics included in this course. At first we will have an introductory theory session about Artificial Intelligence, Machine learning, Artificial Neurons based Deep Learning and Neural Networks.

After that, we are ready to proceed with preparing our computer for python coding by downloading and installing the anaconda package and will check and see if everything is installed fine. We will be using the browser based IDE called Jupyter notebook for our further coding exercises.

I know some of you may not be coming from a python based programming background. The next few sessions and examples will help you get the basic python programming skill to proceed with the sessions included in this course. The topics include Python assignment, flow-control, functions List and Tuples, Dictionaries, Functions etc.

Then we will start with learning the basics of the Python Numpy library which is used to adding support for large, multi-dimensional arrays and matrices, along with a large collection of classes and functions. Then we will learn the basics of matplotlib library which is a plotting library for Python for corresponding numerical expressions in NumPy. And finally the pandas library which is a software library written for the Python programming language for data manipulation and analysis.

After the basics, we will then install the deep learning libraries theano, tensorflow and the API for dealing with these called as Keras. We will be writing all our future codes in keras.

Then before we jump into deep learning, we will have an elaborate theory session about the basic Basic Structure of an Artificial Neuron and how they are combined to form an artificial Neural Network. Then we will see what exactly is an activation function, different types of most popular activation functions and the different scenarios we have to use each of them.

After that we will see about the loss function, the different types of popular loss functions and the different scenarios we have to use each of them.

Like the Activation and loss functions, we have optimizers which will optimize the neural network based on the training feedback. We will also see the details about most popular optimizers and how to decide in which scenarios we have to use each of them.

Then finally we will discuss about the most popular deep learning neural network types and their basic structure and use cases.

Further the course is divided into exactly two halves. The first half is about creating deep learning multi-layer neural network models for text based dataset and the second half about creating convolutional neural networks for image based dataset.

In Text based simple feed forward multi-layer neural network model we will start with a regression model to predict house prices of King County USA. The first step will be to Fetch and Load Dataset from the kaggle website into our program.

Then as the second step, we will do an EDA or an Exploratory Data Analysis of the loaded data and we will then prepare the data for giving it into our deep learning model. Then we will define the Keras Deep Learning Model.

Once we define the model, we will then compile the model and later we will fit our dataset into the compiled model and wait for the training to complete. After training, the training history and metrics like accuracy, loss etc can be evaluated and visualized using matplotlib.

Finally we have our already trained model. We will try doing a prediction of the king county real estate price using our deep learning model and evaluate the results.

That was a text based regression model. Now we will proceed with a text based binary classification model. We will be using a derived version of Heart Disease Data Set from the UCI Machine Learning Repository. Our aim is to predict if a person will be having heart disease or not from the learning achieved from this dataset. The same steps repeat here also.

The first step will be to Fetch and Load Dataset into our program.

Then as the second step, we will do an EDA or an Exploratory Data Analysis of the loaded data and we will then prepare the data for giving it into our deep learning model. Then we will define the Keras Deep Learning Model.

Once we define the model, we will then compile the model and later we will fit our dataset into the compiled model and wait for the training to complete. After training, the training history and metrics like accuracy, loss etc can be evaluated and visualized using matplotlib.

Finally we have our already trained model. We will try doing a prediction for heart disease using our deep learning model and evaluate the results.

After the text based binary classification model. Now we will proceed with a text based multi class classification model. We will be using the Red Wine Quality Data Set from the kaggle website. Our aim is to predict the multiple categories in which a redwine sample can be placed from the learning achieved from this dataset. The same steps repeat here also.

The first step will be to Fetch and Load Dataset into our program.

Then as the second step, we will do an EDA or an Exploratory Data Analysis of the loaded data and we will then prepare the data for giving it into our deep learning model. Then we will define the Keras Deep Learning Model.

Once we define the model, we will then compile the model and later we will fit our dataset into the compiled model and wait for the training to complete. After training, the training history and metrics like accuracy, loss etc can be evaluated and visualized using matplotlib.

Finally we have our already trained model. We will try doing a prediction for wine quality with a new set of data and then evaluate the categorical results.

We may be spending much time, resources and efforts to train a deep learning model. We will learn about the techniques to save an already trained model. This process is called serialization. We will at first serialize a model. Then later load it in another program and do the prediction without having to repeat the training.

That was about text based data. We will now proceed with image based data. In the preliminary session we will have an introduction to Digital Image Basics in which we learn about the composition and structure of a digital image.

Then we will learn about Basic Image Processing using Keras Functions. There are many classes and functions that help with pre processing an image in the Keras library api. We will learn about the most popular and useful functions one by one.

Another important and useful image processing function in keras is Image Augmentation in which slightly different versions of images are automatically created during training. We will learn about single image augmentation, augmentation of images within a directory structure and also data frame image augmentation.

Then another theory session about the basics of a Convolutional neural network or CNN. We will learn how the basic CNN layers like convolution layer, the pooling layer and the fully connected layer works.

There are concepts like Stride Padding and Flattening in convolution for image processing. We will learn them also one by one.

Now we are all set to start with our CNN Model. We will be designing a model that can classify 5 different types of flowers if provided with an image of a flower in any of these categories. We will be at first downloading the dataset from the kaggle website. Then the first step will be to Fetch and Load this Dataset from our computer into our program.

Then as the second step, we have to split this dataset manually for training and then later testing the model. We will arrange them into training and testing folders with each class labelled in separate folders.

Then we will define the Keras Deep Learning Model. Once we define the model, we will then compile the model and later we will fit our dataset into the compiled model and wait for the training to complete. After training, the training history and metrics like accuracy, loss etc can be evaluated and visualized using matplotlib.

Finally we have our already trained model. We will try doing a prediction for five different types of flowers with a new set of image data and then evaluate the categorical results.

There are many techniques which we can use to improve the quality of a model. Especially an image based model. The most popular techniques are doing dropout regularization of the model.

The next technique is doing the optimization and adjustment of the padding and also the filters in the convolution layers.

And finally optimization using image augmentation. We will tweak different augmentation options in this session.

Doing these optimization techniques manually one by one and comparing results is a very tedious task. So we will be using a technique called Hyper parameter tuning in which the keras library itself will switch different optimization techniques that we specify and will report and compare the results without we having to interfere in it.

Even though these techniques and creation of a model from the scratch is fun. Its very time consuming and may take ages if you are planning to design a large model. In this situation a technique called transfer learning can help us.

We will take the world renounced, state of the art, most popular pre-trained deep learning models designed by experts and we will transfer the learning into our model so that we can make use of the architecture of that model into our custom model that we are building.

The popular state of the art model architectures that we are going to use are the VGG16, VGG19 designed by deep learning experts from the University of Oxford and also ResNet50 created in ImageNet challenge to address the vanishing gradient problem.

We will at first download these models using keras and will try simple predictions using these pre-trained models. Later we will try the network training for our flower dataset itself using the VGG16. we will make few changes in the model to incorporate our dataset into it. Since the network architecture is not that simple, in our computer it will take a lot of time to complete the training.

So instead of CPU, we have to use a GPU to enhance parallel processing. We will be using a cloud based Free GPU service provied by goggle called Google Colab. At first we will try training with VGG16 in google colab. We will prepare, zip and upload the dataset into google colab. Then we will extract it using linux comands and then do the training. The training is almost ten times faster compared to the local computer. Once we have the trained model we will serialize the model and will do the prediction.

The same procedure will be repeated for VGG19 and also for ResNet.

And that’s all about the topics which are currently included in this quick course. The code, images, models and weights used in this course has been uploaded and shared in a folder. I will include the link to download them in the last session or the resource section of this course. You are free to use the code in your projects with no questions asked.

Also after completing this course, you will be provided with a course completion certificate which will add value to your portfolio.

So that’s all for now, see you soon in the class room. Happy learning and have a great time.

## Who this course is for:

- Beginner who wants to learn the Basic to Advanced Deep Learning