0% found this document useful (0 votes)
3 views17 pages

Computer Vision

Uploaded by

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

Computer Vision

Uploaded by

Ayesha Tasam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer Vision

Extracting meaningful information from videos, images and other visual


inputs using computing devices refers to a field of AI.
Human Vision vs. Computer Vision

• Human vision:
– Lifetimes of experience teach us to distinguish objects, judge their distance, detect motion, and
identify any irregularities in an image.
• Computer vision:
– Trains machines to carry out these tasks, enabling them to analyze thousands of products in under
a minute.
Computer Vision Applications

• Tesla: Self-driving cars for hands-free driving


• Google Translate: Translates road signs from one language to another
• Photo Scan: Optical Character Recognition (OCR) or QR code scanning
• Facebook: Facial recognition for automatic tagging
• Boston Dynamics: Creating intelligent robots
What is an Image?
Color Channel

1 channel 1 channel 3 channel


How does computer vision works?

• To solve computer vision tasks, large amounts of data are required.

• The system repeatedly analyzes this data until it can identify patterns and accurately
recognize images.

• Machine learning models allow computers to learn the context of visual data on their
own.

• A commonly used algorithm for computer vision tasks is the convolutional neural
network (CNN).
Convolutional Neural Network

• Convolutional Neural Networks (CNNs) stand out from other neural networks due to
their exceptional ability to process image or visual input signals. A CNN is composed
of three primary layers:
– Convolutional layer
– Pooling layer
– Fully connected layer
Convolutional Layer
• Convolutional layers are the fundamental components of a CNN, primarily
responsible for detecting edges in an image.
• These layers require several key elements: input data, a filter, and a feature map.
Convolution
• Convolution: Express how one shape is modified by another
• Below a 6 × 6 matrix is convolved with a 3 × 3 filter to obtain 4 × 4 matrix

Input Image
Convolutional Layer
• We have seen that convolving an input of 6 × 6 dimension with a 3 × 3 filter results
in 4 × 4 output.

• In general:
– Input: 𝑛 × 𝑛
– Filter size: 𝑓 × 𝑓
– Output: 𝑛 − 𝑓 + 1 × (𝑛 − 𝑓 + 1)

• Disadvantage:
– With each convolutional operation, the image size decreases.

– Corner pixels are used less frequently during convolution compared to central pixels, leading to a
potential loss of information if too much focus is not placed on the corners.
Convolutional Layer (Padding)
• We can pad the image with an additional border (add pixels around the border)
• In general:
– Input: 𝑛 × 𝑛
– Padding: 𝑝
– Filter size: 𝑓 × 𝑓
– Output: 𝑛 + 2𝑝 − 𝑓 + 1 × (𝑛 + 2𝑝 − 𝑓 + 1)
Convolutional Layer (Padding)
• Hence, we have two choice for padding

• Valid Padding:
– It means no padding.
– If we are using valid padding, the output will be 𝑛 − 𝑓 + 1 × (𝑛 − 𝑓 + 1)

• Same Padding:
– Here, we apply padding so that the output size is the same as the input size
– Need to set, 𝑝 = (𝑓 − 1)/2
Convolutional Layer (Stride)
• Stride is how far the filter moves in every step along one direction.
• If we select stride of 2, then we will take two steps – both in the horizontal and
vertical directions.
Convolution Over Multiple Channel
• A color image consists of three channels.
• To process this image, we can apply a 3×3×3 filter, where the filter's depth matches
the number of input channels.
• Using multiple filters allows us to capture various features from the image.
Pooling Layer
• Pooling layers are generally used to reduce the size of the inputs and hence speed up
the computation.
CNN Example
• The network begins with a combination of convolutional and pooling layers,
followed by a few fully connected layers, and concludes with a softmax classifier to
categorize the input.
• Additionally, numerous hyperparameters must be specified within this network.

250

• The formula to calculate the number of parameters in a Conv2D layer is as follows:


Number of Parameters=(kernel_height×kernel_width×input_channels+1)×filters
Some Notes
• Creating a model from scratch can be both time-consuming and
challenging, often complicated by issues such as limited data availability.

• To address these challenges, you can follow these steps:


– Utilize open-source implementations

– Apply transfer learning: leverage a pre-trained network and adapt it to your


specific task

– Implement data augmentation: enhance performance by increasing the dataset size


through techniques like mirroring, random cropping, and rotating

You might also like