CS312 Module 4

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 21

Module 4

Introduction to Computer Vision


What Is Computer Vision?
• At its core, computer vision is the ability of computers to understand and analyze visual content in the same
way humans do. This includes tasks such as recognizing objects and faces, reading text and understanding
the context of an image or video.
• Computer vision is closely related to artificial intelligence (AI) and often uses AI techniques such as machine
learning to analyze and understand visual data. Machine learning algorithms are used to “train” a computer
to recognize patterns and features in visual data, such as edges, shapes and colors.
• Once trained, the computer can use this knowledge to identify and classify objects in new images and
videos. The accuracy of these classifications can be improved over time through further training and
exposure to more data.
• In addition to machine learning, computer vision may also use techniques such as deep learning, which
involves training artificial neural networks on large amounts of data to recognize patterns and features in a
way that is similar to how the human brain works.
What Is Computer Vision?
• Computer vision is the process of using machines to understand and analyze imagery (both
photos and videos). While these types of algorithms have been around in various forms since the
1960’s, recent advances in Machine Learning, as well as leaps forward in data storage, computing
capabilities, and cheap high-quality input devices, have driven major improvements in how well
our software can explore this kind of content.
• Computer vision is the broad parent name for any computations involving visual content – that
means images, videos, icons, and anything else with pixels involved. But within this parent idea,
there are a few specific tasks that are core building blocks:
• In object classification, you train a model on a dataset of specific objects, and the model classifies new
objects as belonging to one or more of your training categories.
• For object identification, your model will recognize a specific instance of an object – for example,
parsing two faces in an image and tagging one as Person A and one as Person B.
What Is Computer Vision?
• A classical application of computer vision is handwriting recognition for digitizing
handwritten content. Outside of just recognition, other methods of analysis include:
• Video motion analysis uses computer vision to estimate the velocity of objects in a video, or the
camera itself.
• In image segmentation, algorithms partition images into multiple sets of views.
• Scene reconstruction creates a 3D model of a scene inputted through images or video.
• In image restoration, noise such as blurring is removed from photos using Machine Learning
based filters.

• Any other application that involves understanding pixels through software can safely
be labeled as computer vision.
Image classification
Given a group of images, the task is to classify them into a set of
predefined classes using solely a set of sample images that have
already been classified.
As opposed to complex topics like object detection and image
segmentation, which have to localize (or give positions for) the features
they detect, image classification deals with processing the entire image
as a whole and assigning a specific label to it.
Object detection
Object detection, as the name suggests, refers to detection and
localization of objects using bounding boxes.
Object detection looks for class-specific details in an image or a video and
identifies them whenever they appear. These classes can be cars, animals,
humans, or anything on which the detection model has been trained.
This process, other than being time-consuming and largely inaccurate,
has severe limitations on the number of objects that can be detected.
As such, Deep Learning models like YOLO, RCNN, SSD that use millions of
parameters to break through these limitations are popularly employed for
this task.
Object detection is often accompanied by Object Recognition, also known
as Object Classification.
Image segmentation
Image segmentation is the division of an image into subparts or sub-
objects to demonstrate that the machine can discern an object from
the background and/or another object in the same image.
A “segment” of an image represents a particular class of object that the
neural network has identified in an image, represented by a pixel mask
that can be used to extract it.
Face and person recognition
• Facial Recognition is a subpart of object detection where the primary object
being detected is the human face.
• While similar to object detection as a task, where features are detected and
localized, facial recognition performs not only detection, but also recognition
of the detected face.

Facial recognition systems search for


common features and landmarks like
eyes, lips, or a nose, and classify a face
using these features and the positioning
of these landmarks.
Image restoration
Image Restoration refers to the restoration or the reconstruction of
faded and old image hard copies that have been captured and stored in
an improper manner, leading to loss of quality of the image.
Typical image restoration processes involve the
reduction of additive noise via mathematical tools,
while at times, reconstruction requires major changes,
leading to further analysis and the use of image
inpainting.

In Image inpainting, damaged parts of an image are


filled with the help of generative models that make an
estimate of what the image is trying to convey. Often
the restoration process is followed by a colorization
process that colors the subject of the picture (if black
and white) in the most realistic manner possible.
Feature matching
Features in computer vision are regions of an image that tell us the most about a particular object in the image.
While edges are strong indicators of object detail and therefore important features, much more localized and sharp details—like
corners, also serve as features. Feature matching helps us to relate the features of similar region of one image with those of
another image.
The applications of feature matching are found in computer vision tasks like object identification and camera calibration. The task
of feature matching is generally performed in the following order:
1. Detection of features: Detection of regions of interest is generally performed by Image Processing algorithms like Harris
Corner Detection, SIFT, and SURF.
2. Formation of local descriptors: After features are detected, the region surrounding each key point is captured and the local
descriptors of these regions of interest are obtained. A local descriptor is the representation of a point’s local neighborhood
and thus can be helpful for feature matching.
3. Feature matching: The features and their local descriptors are matched in the corresponding images to complete the feature
matching step.
How does computer vision work?
• One of the major open questions in both Neuroscience and Machine Learning is: how
exactly do our brains work, and how can we approximate that with our own algorithms?
• The reality is that there are very few working and comprehensive theories of brain
computation; so despite the fact that Neural Nets are supposed to “mimic the way the
brain works,” nobody is quite sure if that’s actually true.
• Jeff Hawkins has an entire book on this topic called On Intelligence.
• The same paradox holds true for computer vision – since we’re not decided on how the
brain and eyes process images, it’s difficult to say how well the algorithms used in
production approximate our own internal mental processes.
• For example, studies have shown that some functions that we thought happen in the
brain of frogs actually take place in the eyes. We’re a far cry from amphibians, but similar
uncertainty exists in human cognition.
Machines interpret images very simply: as a series of pixels, each with their own set of
color values. Consider the simplified image below, and how grayscale values are converted
into a simple array of numbers:
Think of an image as a giant grid of different squares, or pixels (this image is a very
simplified version of what looks like either Abraham Lincoln or a Dementor).
Each pixel in an image can be represented by a number, usually from 0 – 255. The
series of numbers on the right is what software sees when you input an image. For
our image, there are 12 columns and 16 rows, which means there are 192 input
values for this image.

When we start to add in color, things get more complicated.


Computers usually read color as a series of 3 values – red, green,
and blue (RGB) – on that same 0 – 255 scale. Now, each pixel
actually has 3 values for the computer to store in addition to its
position. If we were to colorize President Lincoln (or Harry Potter’s
worst fear), that would lead to 12 x 16 x 3 values, or 576 numbers.

For some perspective on how computationally expensive this is,


consider this tree:
•Each color value is stored in 8 bits.
•8 bits x 3 colors per pixel = 24 bits per pixel.
•A normal sized 1024 x 768 image x 24 bits per pixel = almost 19M
bits, or about 2.36 megabytes.
• That’s a lot of memory to require for one image, and a lot of pixels for an algorithm to
iterate over. But to train a model with meaningful accuracy – especially when you’re
talking about Deep Learning – you’d usually need tens of thousands of images, and the
more the merrier.
• With the sheer amount of computing power and storage required just to train deep
learning models for computer vision, it’s not hard to understand why advances in those
two fields have driven Machine Learning forward to such a degree.
Business use cases for computer vision
• Computer vision is one of the areas in Machine Learning where core
concepts are already being integrated into major products that we use
every day.
• Google is using maps to leverage their image data and identify street
names, businesses, and office buildings.
• Facebook is using computer vision to identify people in photos, and do a
number of things with that information.
Computer vision and convolutional neural networks
• Much of the progress made in computer vision accuracy over the past few years is due in
part to a special type of algorithm. Convolutional Neural Networks are a subset of Deep
Learning with a few extra added operations, and they’ve been shown to achieve
impressive accuracy on image-associated tasks.
• Convolutional Neural Networks (CNNs or ConvNets) utilize the same major concepts of
Neural Networks, but add in some steps before the normal architecture. These steps are
focused on feature extraction, or finding the best version possible of our input that will
yield the greatest level of understanding for our model. Ideally, these features will be less
redundant and more informative than the original input.
The CNN uses three sorts of filters for feature extraction.
Convolution
During the convolution process (perhaps why it’s called a CNN) the input image pixels are modified by a
filter. This is just a matrix (smaller than the original pixel matrix) that we multiply different pieces of the
input image by the output – often called a Feature Map – will usually be smaller than the original image,
and theoretically be more informative.

ReLU
This futuristic sounding acronym stands for Rectified Linear Unit, which is an easy function to introduce
non-linearity into the feature map. All negative values are simply changed to zero, removing all black from
the image. The formal function is y = max(0, x).

Pooling
In pooling, the image is scanned over by a set width of pixels, and either the max, sum, or average of
those pixels is taken as a representation of that portion of the image. This process further reduces the size
of the feature map(s) by a factor of whatever size is pooled.
All of these operations – Convolution, ReLu, and Pooling – are often applied twice
in a row before concluding the process of feature extraction. The outputs of this
whole process are then passed into a neural net for classification. The final
architecture looks as follows:

If you’ve gotten lost in the details, not to worry. Just remember:

• Convolutional Neural Networks (CNNs) are a special type of Deep Learning


that works really well on computer vision tasks
• A lot of preprocessing work is done on the input images to make them better
optimized for the fully connected layers of the neural net
The Challenges of Computer Vision
Computer vision is a complex field that involves many challenges and difficulties. Some of these challenges include:
1. Data limitations
Computer vision requires large amounts of data to train and test algorithms. This can be problematic in situations where data is limited
or sensitive, and may not be suitable for processing in the cloud. Additionally, scaling up data processing can be expensive and may be
constrained by hardware and other resources.
2. Learning rate
Another challenge in computer vision is the time and resources required to train algorithms. While error rates have decreased over time,
they still occur, and it takes time for the computer to be trained to recognize and classify objects and patterns in images. This process
typically involves providing sets of labeled images and comparing them to the predicted output label or recognition measurements and
then modifying the algorithm to correct any errors.
3. Hardware requirements
Computer vision algorithms are computationally demanding, requiring fast processing and optimized memory architecture for quicker
memory access. Properly configured hardware systems and software algorithms are also necessary to ensure that image-processing
applications can run smoothly and efficiently.
4. Inherent complexity in the visual world
In the real world, subjects may be seen from various orientations and in myriad lighting conditions, and there are an infinite number of
possible scenes in a true vision system. This inherent complexity makes it difficult to build a general-purpose “seeing machine” that can
handle all possible visual scenarios.

Overall, these challenges highlight the fact that computer vision is a difficult and complex field, and that there is still much work to be done in
order to build machines that can see and understand the world in the same way humans do.

You might also like