0% found this document useful (0 votes)
9 views

Day8(CNN)

A Convolutional Neural Network (CNN) is a specialized feed-forward neural network designed for analyzing visual data, particularly images, by utilizing layers such as convolutional, pooling, and fully connected layers. Unlike traditional Artificial Neural Networks (ANNs), CNNs automatically learn spatial hierarchies and features from unstructured data, making them superior for tasks like image classification and object detection. The document also discusses transfer learning and fine-tuning techniques to enhance CNN performance using pre-trained models.

Uploaded by

sowmisoms0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Day8(CNN)

A Convolutional Neural Network (CNN) is a specialized feed-forward neural network designed for analyzing visual data, particularly images, by utilizing layers such as convolutional, pooling, and fully connected layers. Unlike traditional Artificial Neural Networks (ANNs), CNNs automatically learn spatial hierarchies and features from unstructured data, making them superior for tasks like image classification and object detection. The document also discusses transfer learning and fine-tuning techniques to enhance CNN performance using pre-trained models.

Uploaded by

sowmisoms0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

Deep Learning - CNN

What is Convolutional Neural


Network?
A convolutional neural network is a feed-forward neural
network that is generally used to analyze visual images by
processing data with grid-like topology. It’s also known as
a ConvNet.
A convolutional neural network is used to detect and
classify objects in an image.
ANN VS CNN
• Input Type:
• ANN : Works with structured data like tabular data, numeric or categorical values etc
• CNN: Works with unstructured data where relationship between pixels is important like
images, videos

• Layer Types:
• ANN: Consists mainly of fully connected (dense) layers.
• CNN: Includes convolutional layers (which apply filters to extract features), pooling
layers (to downsample the data), and sometimes dense layers at the end for
classification or regression.
Feature Extraction:

• ANN: Requires manual feature engineering or relies on


hidden layers to capture important relationships
between features. It’s not optimized for spatial
relationships in data.

• CNN: Automatically learns spatial hierarchies in the


data (such as edges, textures, and shapes in images)
through convolutional filters. The first layers of a CNN
might detect simple features (like edges), while deeper
layers capture more complex patterns (like shapes or
objects).
Performance:

• ANN: Can perform well on simpler, lower-dimensional


data but struggles with high-dimensional data like
images without preprocessing or feature extraction.
• CNN: Specifically built for tasks like image
processing, where spatial patterns matter. CNNs are
state-of-the-art in tasks such as object
detection, image classification, and image
segmentation.
Example Use Case:
• ANN: Predicting the price of a house based on
features like square footage, number of bedrooms,
etc.
• CNN: Recognizing a dog in an image by detecting
shapes and patterns in pixel values.
neural network that identifies two types of flowers: Orchid and
Rose.
To depict how CNN
recognizes an image
The four important layers in CNN are:

Layers in a • Convolution layer

Convolution • ReLU layer


• Pooling layer
al Neural • Fully connected layer
Network • ReLU layer/ Activation Layer
• Flattening
• Output Layer
Convolution Layer

This is the first step in the process of


extracting valuable features from an image. A
convolution layer has several filters that
perform the convolution operation. Every
image is considered as a matrix of pixel
values
Consider the following 5x5 image
whose pixel values are either 0
or 1. There’s also a filter matrix
with a dimension of 3x3.
Slide the filter matrix over the
image and compute the dot
product to get the convolved
feature matrix.
ReLU layer

ReLU stands for the rectified


linear unit. Once the feature
maps are extracted, the next
step is to move them to a ReLU
layer.
The original image is
scanned with multiple
convolutions and ReLU
layers for locating the
features.
Pooling Layer

Pooling is a down-sampling
operation that reduces the
dimensionality of the feature
map. The rectified feature map
now goes through a pooling
layer to generate a pooled
feature map.
The pooling layer uses various filters to
identify different parts of the image like edges,
corners, body, feathers, eyes, and beak.
how the structure
of the convolution
neural network
looks so far:
The next step in the process is
called flattening. Flattening is
used to convert all the resultant
2-Dimensional arrays from
pooled feature maps into a
single long continuous linear
vector.
The flattened matrix is fed as input to the fully
connected layer to classify the image.
how exactly CNN recognizes
a bird:
o The activation layer introduces nonlinearity into the
network by applying an activation function to the output
of the previous layer.
Activation
Layer o This is crucial for the network to learn complex patterns.
Common activation functions, such as ReLU, Tanh, and
Leaky ReLU, transform the input while keeping the
output size unchanged.
o After the convolution and pooling operations, the
feature maps still exist in a multi-dimensional format.
Flattening converts these feature maps into a one-
Flattening dimensional vector. This process is essential because it
prepares the data to be passed into fully connected
layers for classification or regression tasks.
Output Layer

o In the output layer, the final result from the fully connected layers is
processed through a logistic function, such as sigmoid or softmax. These
functions convert the raw scores into probability distributions, enabling the
model to predict the most likely class label.
Applications of CNN

Image Classification

Object Detection

Image Segmentation

Video Analysis
What Is Transfer
Learning?

• The reuse of a pre-trained model on a


new problem is known as transfer
learning in machine learning. A
machine uses the knowledge learned
from a prior assignment to increase
prediction about a new task in transfer
learning.
Transfer learning involves using
knowledge gained from one task to
enhance understanding in another. It
automatically shifts weights from a
network that performed task B to a
network performing task A.
What is fine-tuning?
o Fine-tuning is a training technique that consists of the reuse of
predefined and pre-trained CNN (convolutional neural network)
Architectures.

o Fine-tuning in a Convolutional Neural Network (CNN) is a


process
that uses the weights of a pre-trained network to train a new
network. It can be useful when you want to reduce training time,
avoid overfitting, or don't have a lot of data.
Use Case
Implementation Using
CNN

• CIFAR-10 dataset from the


Canadian Institute For Advanced
Research to classify images across
10 categories using CNN.
Practical Implementation

Training a simple Convolutional Neural Network


(CNN) to classify CIFAR images using keras .

You might also like