Introduction To Deep Learning
Introduction To Deep Learning
Dr Gopal Sakarkar
MCA, PhD
Associate Professor
1
Syllabus
Unit Contents Hours
Deep Learning
4.1. Fundamentals of Deep networks and Defining Deep learning
4.2. Deep learning Problem types
4.2.1. ANN
4.2.2. CNN
4.2.3. RNN
4.2.4. GAN
IV 15
4.2.5. NLP
4.3. Building blocks of Deep learning
4.4. Classification and Detection
Algorithms should be taught using Python Library –
Pytorch
Extra Reading: DNN, Transfer Learning, Architectural Principals of Deep networks – AlexNet,
VGG 16, Inception, MobileNet 2
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
Fundamentals of Deep networks and Defining Deep learning
A Convolutional Neural Network (CNN)
• Convolutional Neural Networks are a type of ANNs that are used mainly for working on pixel data to process images or
• CNNs are used in Deep Learning for generative and descriptive tasks that use machine vision and recommendation-
based systems.
• CNN generally relies on two layers, the feature map layer and the feature extraction layer.
Fundamentals of Deep networks and Defining Deep learning
A Convolutional Neural Network (CNN)
• A convolutional neural network is a specific kind of neural network with multiple layers.
• It processes data that has a grid-like arrangement and then extracts important features.
• One huge advantage of using CNNs is that you don't need to do a lot of pre-processing on images.
Fundamentals of Deep networks and Defining Deep learning
A Convolutional Neural Network (CNN)
• The convolutional neural network algorithm's main purpose is to get data into forms that are easier to process
without losing the features that are important for figuring out what the data represents.
• In mathematics, convolution is a mathematical operation on two functions that produces a third function that
• The convolutional neural network algorithm's main purpose is to get data into forms that are easier to process
without losing the features that are important for figuring out what the data represents.
• A big difference between a CNN and a regular neural network is that CNN’s use convolutions to handle the math
•
Fundamentals of Deep networks and Defining Deep learning
Convolutional Neural Networks Working
• Usually with images, a CNN will initially find the edges of the picture.
• Then this slight definition of the image will get passed to the next layer.
• Then that layer will start detecting things like corners and color groups.
• Then that image definition will get passed to the next layer and the cycle continues until a prediction is
made.
• It only returns the most relevant features from the layer in the activation map.
• This is what gets passed to each successive layer until you get the final layer.
Fundamentals of Deep networks and Defining Deep learning
A Convolutional Neural Network (CNN)
• The last layer of a CNN is the classification layer which determines the predicted value based on the
activation map.
• If you pass a handwriting sample to a CNN, the classification layer will tell you what letter is in the
image
Fundamentals of Deep networks and Defining Deep learning
A Convolutional Neural Network (CNN)
• 1D CNN: With these, the CNN kernel moves in one direction. 1D CNNs are usually used on time-series data.
• 2D CNN: These kinds of CNN kernels move in two directions. You'll see these used with image labelling and
processing.
• 3D CNN: This kind of CNN has a kernel that moves in three directions. With this type of CNN, researchers use
• A recurrent neural network (RNN) is a special type of artificial neural network adapted to work for time series
• Ordinary feedforward neural networks are only meant for data points that are independent of each other.
• However, if we have data in a sequence such that one data point depends upon the previous data point, we
need to modify the neural network to incorporate the dependencies between these data points.
• RNNs have the concept of “memory” that helps them store the states or information of previous inputs to
• RNN works on the principle of saving the output of a particular layer and feeding this back to the input in
order to predict the output of the layer.
• Below is how you can convert a Feed-Forward Neural Network into a Recurrent Neural Network
Fundamentals of Deep networks and Defining Deep learning
Recurrent Neural Network (RNN)
• The nodes in different layers of the neural network are compressed to form a single layer of recurrent neural
networks.
• A, B, and C are the parameters of the network.
Fundamentals of Deep networks and Defining Deep learning
Recurrent Neural Network (RNN)
• Here, “x” is the input layer, “h” is the hidden layer, and “y” is the output layer.
• A, B, and C are the network parameters used to improve the output of the model.
• At any given time t, the current input is a combination of input at x(t) and x(t-1).
• The output at any given time is fetched back to the network to improve on the output.
Fundamentals of Deep networks and Defining Deep learning
Why Recurrent Neural Network (RNN)?
RNN were created because there were a few issues in the feed-forward neural network:
The solution to these issues is the RNN. An RNN can handle sequential data, accepting the current input
data, and previously received inputs. RNNs can memorize previous inputs due to their internal memory.
Fundamentals of Deep networks and Defining Deep learning
Working of Recurrent Neural Network (RNN)
• The input layer ‘x’ takes in the input to the neural network and processes it and passes it onto the middle
layer.
• The middle layer ‘h’ can consist of multiple hidden layers, each with its own activation functions and weights
and biases. If you have a neural network where the various parameters of different hidden layers are not
affected by the previous layer, ie: the neural network does not have memory, then you can use a recurrent
neural network.
• The Recurrent Neural Network will standardize the different activation functions and weights and biases so
that each hidden layer has the same parameters. Then, instead of creating multiple hidden layers, it will create
one and loop over it as many times as required.
Fundamentals of Deep networks and Defining Deep learning
Type of Recurrent Neural Network (RNN)
Fundamentals of Deep networks and Defining Deep learning
Generative Adversarial Networks GAN
• The main focus for GAN (Generative Adversarial Networks) is to generate data from scratch, mostly images but other
domains including music.
• Just like the example below, it generates a zebra from a horse. In reinforcement learning, it helps a robot to learn
much faster.
Fundamentals of Deep networks and Defining Deep learning
Generative Adversarial Networks GAN
Generator and discriminator
• GAN composes of two deep networks, the generator, and the discriminator.
• We will first look into how a generator creates images before learning how to train it.
•Generator. Model that is used to generate new plausible examples from the problem domain.
•Discriminator. Model that is used to classify examples as real (from the domain) or fake (generated).
• First, we sample some noise z using a normal or uniform distribution. With z as an input, we use a
generator G to create an image x (x=G(z)).
Fundamentals of Deep networks and Defining Deep learning
Generative Adversarial Networks GAN
• z represents the latent features of the images generated, for example, the colour and the shape.
• In Deep learning classification, we don’t control the features the model is learning.
• We let the training process to learn it. i.e. we do not control which byte in z determines the color
of the hair.
• To discover its meaning, the most effective way is to plot the generated images and examine
ourselves.
Fundamentals of Deep networks and Defining Deep learning
Generative Adversarial Networks GAN
So what is this magic generator GAN?
• The following is the DCGAN(Deep Convolutional Generative Adversarial Networks) which is one of the most popular
• Conceptually, the discriminator in GAN provides guidance to the generator on what images to create.
• Let’s consider a GAN’s application, CycleGAN, that uses a generator to convert real scenery into a Monet style painting.
Fundamentals of Deep networks and Defining Deep learning
The Generator Model
• The generator model takes a fixed-length random vector as input and generates a sample in the domain.
• The vector is drawn from randomly from a Gaussian distribution, and the vector is used to seed the
generative process.
• After training, points in this multidimensional vector space will correspond to points in the problem domain,
• After training, the generator model is kept and used to generate new samples.
Fundamentals of Deep networks and Defining Deep learning
The Discriminator Model
• The discriminator model takes an example from the domain as input (real or generated) and predicts a binary
class label of real or fake (generated).
• The real example comes from the training dataset. The generated examples are output by the generator
model.
• The discriminator is a normal (and well-understood) classification model.
• After the training process, the discriminator model is discarded as we are interested in the generator.
Fundamentals of Deep networks and Defining Deep learning
The Working of GAN Model