Convolution Neural Network

 Introduction to CNN

Learning Outcome

5

Recognize real-world applications of CNNs

4

Understand the flow of data through a CNN

3

Identify the key components of a CNN

2

Describe why CNNs are used for image and video data

1

Explain what a Convolutional Neural Network (CNN) is

Name-Recall

Images are made of pixels

Videos are sequences of image frames

OCR and image processing rely on patterns in images

ANNs process numerical data

Images are data - but they have structure

Analogy

  • You realize something uncomfortable:
  •  You know it’s a cat,
  •  but you don’t know how to explain it using rules.

Assume... ! You show an image to the computer

The computer asks:

  • Where exactly is the cat?
  • Which pixels make it a cat?

It doesn’t know which part of the image matters.

“This is a cat.”

Bridge from Analogy to CNN

CNNs are the method we use to teach computers to learn images by experience, not by hard-coded rules.

What if, instead of explaining everything,let the computer learn by looking at many images, just like humans learn by seeing things again and again?

Solution

The Problem is:

  • Images are easy for humans
  •  But very hard to explain step-by-step to a machine.

Bridge from Analogy to CNN

  • Images contain patterns like edges and shapes
  • CNNs are designed to detect these patterns automatically
  • Patterns are combined to recognize objects

CNNs are neural networks built specifically to understand images

What is a CNN?

Definition:

 A Convolutional Neural Network (CNN) is a type of deep neural network primarily used for image and video recognition.

Key Characteristics:

  • Learns features automatically

 

  • Preserves spatial relationships

 

  • Uses specialized layers for images

Unlike traditional ANNs, CNNs can recognize where features appear in an image.

Why Not Use Simple ANN for Images?

Problem with ANNs:

CNN Advantage:

  • Images have thousands of pixels
     
  • Flattening images loses spatial information
     
  • Too many parameter
  • Works directly on image structure

 

  • Fewer parameters

 

  • Better performance on vision tasks

 Convolutional Layer

What It Does:

  • Applies small filters (kernels) to the image

 

  • Detects edges, corners, texture

 Code:

Conv2D(filters=32, kernel_size=(3, 3),
       activation='relu', input_shape=(64, 64, 3))

Each filter looks for a specific pattern in the image.

Activation Function (ReLU)

Purpose:

  • Adds non-linearity

 

  • Helps network learn complex pattern

 Code:

Activation('relu')

ReLU keeps useful signals and removes negative values.

Pooling Layer

Purpose:

  • Reduces image size
     
  • Keeps important features
     
  • Improves efficiency

 Code:

MaxPooling2D(pool_size=(2, 2))

 Pooling summarizes features and reduces computation.

 Flatten Layer

What It Does:

Converts 2D feature maps into 1D data

Flatten()

Flattening prepares data for final decision-making layers.

 Code:

Fully Connected (Dense) Layers

  • Perform classification

 

  • Combine learned feature

Purpose:

 Code:

Dense(128, activation='relu')
Dense(10, activation='softmax')

The final layer gives the probability of each possible class.

CNN Architecture

Convolution → Pooling (repeated)

Flatten

Dense layers

Output

Typical CNN Structure:

 CNNs learn from simple features to complex patterns.

CNN Workflow

 Each stage refines the understanding of the image.

  • Input image                  Flatten

 

  • Convolution layers         Fully connected layers

 

  • Pooling layers              Output prediction

 

Data Flow:

Applications of CNNs

Common Use Cases:

Object detection (YOLO, SSD)

Video frame analysis

Handwriting recognition

Face recognition

Summary

5

They are the foundation of modern vision AI

4

CNNs preserve spatial structure

3

Key layers: Convolution, ReLU, Pooling, Flatten, Dense

2

They automatically learn visual features

1

CNNs are designed for image and video data

Quiz

 Why are CNNs better than simple ANNs for images?
 A. They use more neurons

A. They use more neurons

B.  They preserve spatial information

C. They do not need data

D. They only work on text

Quiz

 Why are CNNs better than simple ANNs for images?
 A. They use more neurons

A. They use more neurons

B.  They preserve spatial information

C. They do not need data

D. They only work on text

Artificial Intelligence-Introduction to CNN

By Content ITV

Artificial Intelligence-Introduction to CNN

  • 30