Docsity
Trusted Seller

Computational Vision (CV) - Computer Science, Appunti di Visione Artificiale

Toggle sidebar
bg1
1.
Lesson
27/02/23 -
Introduction
Slides
“00_
cv
_
introduction
”
What
is
computer
vision
Definition
:
Computer
vision
is
about
extracting
a
description
of
the
world
starting
from
images
or
image
sequences
.
And
its
purpose
is
to
find
mathematical
techniques
for
recovering
that
description
.
“
Description
”
is
a
vague
term
,
including
geometry
(
shapes
,
distances
,...),
dynamics
(
motion
,
actions
,
...),
semantics
(
categories
,
properties
, ..).
We
now
have
reliable
techniques
for
accurately
computing
a
3
D
model
of
an
environment
from
thousands
of
partially
overlapping
photographs
.
Computational
vision
It
is
about
designing
algorithms
and
computational
models
able
to
implement
visual
perception
respect
to
the
surrounding
world
and
this
is
connected
to
the
Artificial
Intelligence
AI
.
In
IMAGE
PROCESSING
:
Take
an
image
I
)
in
input
,
process
it
and
get
in
output
the
filtered
image
I
ʼ.
Studied
in
DSIP
course
)
In
COMPUTATIONAL
VISION
:
Take
an
image
I
)
in
input
,
appy
a
Computational
Vision
Algorithm
and
get
in
output
a
description
of
I
.
Description
:
Shape
-
Geometry
Description
:
describe
the
3
D
shape
and
the
geometry
of
the
objects
in
the
image
Dynamics
:
describe
the
perception
of
the
movement
,
it
ʼ
s
possible
by
comparing
subsequent
frames
of
the
same
scene
which
allowed
us
to
see
the
changes
in
it
.
1. Lesson 27/02/23 - Introduction
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Anteprima parziale del testo

Scarica Computational Vision (CV) - Computer Science e più Appunti in PDF di Visione Artificiale solo su Docsity!

1. Lesson 27/02/23 - Introduction

Slides “00_cv_introduction”

What is computer vision

Definition: Computer vision is about extracting a description of the world starting from images or image sequences. And its purpose is to find mathematical techniques for recovering that description. “Description” is a vague term, including geometry (shapes, distances,...), dynamics (motion, actions, ...), semantics (categories, properties, ..). We now have reliable techniques for accurately computing a 3 D model of an environment from thousands of partially overlapping photographs.

Computational vision

It is about designing algorithms and computational models able to implement visual perception respect to the surrounding world and this is connected to the Artificial Intelligence AI.

In IMAGE PROCESSING:

Take an image I) in input, process it and get in output the filtered image Iʼ. Studied in DSIP course)

In COMPUTATIONAL VISION:

Take an image I) in input, appy a Computational Vision Algorithm and get in output a description of I.

Description: Shape - Geometry Description: describe the 3 D shape and the geometry of the objects in the image Dynamics: describe the perception of the movement, itʼs possible by comparing subsequent frames of the same scene which allowed us to see the changes in it.

  1. Lesson 27/02/23 - Introduction 1

This means that weʼre adding the time component in our analysis. It is a description of what the objects are doing, how theyʼre moving. It could be done also in a single image Action Recognition). Semantic: describe the image by adding some labels in natural language words. Description of the image in a semantic way.

Image Formation: “shoot the photo”. This process makes us to loose some informations because weʼre passing from 3 D world to a 2 D plane (image).

Why computer vision is so difficult?

It is because it is an INVERSE PROBLEM, in which we seek to recover some unknowns given insufficient information to fully specify the solution. It is so difficult also beacaause we are tying to model the visual world in all its rich complexity.

It all started (history)

In 1966 Marvin Minsky, one of the fathers of AI, underestimates the visual perception complexity and assigns a project to a summer intern requiring to “solve the vision of a computer”.

What does it means for a computer to “see” something? The computer can acquire images, for example through the camera, but the acquired images are meaningless, until they are processed by computer vision algorithms.

Machine learning and Deep Learning in CV

Machine learning and computer vision are two fields that have become closely related to one another. Machine learning has improved computer vision about recognition and tracking. It offers effective methods for acquisition, image processing, and object focus which are used in computer vision.

Computer Vision application domains

Computer vision is being used today in a wide variety of real-world applications, which include: Optical character recognition OCR reading handwritten postal codes on letters and automatic number plate recognition. Quality Control: rapid parts inspection for quality assurance using stereo vision with specialized illumination to measure tolerances or looking for defects using X-ray vision.

  1. Lesson 27/02/23 - Introduction 2
    1. Lesson 27/02/23 - Introduction

12. Lesson - Human in Image

Human in the image

Main concepts

Human pose estimation HPE problem definition. Examples of HPE algorithms and focus on a famous example of a bottom-up approach: OpenPose. Example applications. Evaluation metrics. Zooming in on semantic features detection (with a reference to semantic feature segmentation).

Human Pose Estimation: problem definition

Human Pose Estimation: is a computer vision technique that aims to determine the positions and orientations of human body parts in an image or video.

Problem: estimating the configuration (pose) of the body.

While classical methods adopt wearable sensors or combinations of markers and motion capture MoCap systems, in Computer Vision this task is addressed using images as Inputs.

Human Pose Estimation: variants

Pose can be estimated in:

Notice: bottom-up approaches can be used as a “richer” alternative to people detectors

Computer Vision Algorithms

Human Pose Estimation following detection (top-down)

Top-down approaches start from the output of a person detector.

A possible strategy to address the task is to define the localization of each feature as a regression task (as we did for object localization).

Human Pose Estimation following detection (towards bottom-up)

An alternative approach is the estimation of heat maps.

Joint Detection: The first step in the bottom-up approach involves detecting individual body joints, such as elbows, knees, or wrists. Instead of directly estimating the joint locations, heat maps are used to indicate the likelihood of each pixel being associated with a specific joint. Heat Map Generation: To generate heat maps, a separate deep learning model is trained for each joint. These models are typically convolutional neural networks CNNs that learn to predict the likelihood of a joint's presence at each pixel location.

The use of heat maps in the bottom-up approach allows for joint detection without explicitly localizing the joints during the initial stage.

Heat maps provide a dense representation of joint probabilities across the entire image, allowing for robust joint detection even in the presence of occlusions or challenging pose variations. They enable accurate and fine-grained localization of individual joints and form a fundamental component of the bottom-up approach in human pose estimation.

Open Pose: Schematic architecture (2)

Two branches: The top branch, shown in beige, predicts the confidence maps of different body parts location such as the right eye, left eye, right elbow and others.

The bottom branch, shown in blue, predicts the part affinity fields, which represents a degree of association between different body parts.

Multi-stage: At step 0 an initial estimation of confidence maps and part affinity fields. In the next steps, the image is concatenated with the initial estimations to obtain refined estimations.

Finally, a greedy inference algorithm produces the final output, with the identification of the pose.

Further details on architecture for OpenPose

What about the loss function?

OpenPose: confidence map

Confidence map is the 2 D representation of the belief that a particular body part can be located. A single body part will be represented on a single map.

So, the number of maps is the same as the total number of the body parts.

The network outputs a heatmap for each body part, indicating the likelihood of a keypoint's presence at different image locations. PAF Computation: Another CNN is used to compute part affinity fields PAFs for each pair of keypoints. The PAFs encode the orientation and direction information between keypoints, allowing the model to establish connections between body parts. PAF Association: PAFs are used to associate keypoints and establish the connections between body parts. A bipartite matching algorithm is applied to find the optimal connections between keypoints based on the PAF information. The matching process assigns part affinity scores to potential limb connections. Skeleton Estimation: After associating keypoints and obtaining the part affinity scores, a graphical model called the "Clique Tree Propagation" algorithm is utilized. The graphical model combines the part affinity scores with the keypoint heatmaps to generate a pose estimation for each person in the image. The model forms a graph structure where nodes represent keypoints, and edges encode the part affinity scores. By considering the connectivity constraints and maximizing the total affinity score, the algorithm generates the final pose skeleton. Refinement: Post-processing steps may be applied to refine the estimated pose skeleton. Techniques such as non-maximum suppression, filtering based on confidence scores, and interpolation can be employed to enhance the accuracy and smoothness of the detected keypoints.

Mediapipe and TensorFlow.js

Both Mediapipe and TensorFlow.js can be used for human pose estimation, allowing developers to build applications that can detect and track the keypoints of a human body in real-time.

Mediapipe: Mediapipe offers a pre-built pose estimation module called "Pose", which utilizes a deep learning model to detect and track human body keypoints. The Pose module can be easily integrated into Mediapipe's pipeline architecture, allowing developers to process video or camera input and obtain pose estimation results in real-time. The Pose module supports multiple pose landmarks, including keypoints for various body parts such as the head, shoulders, elbows, wrists, hips, knees, and ankles. By using the Pose module in Mediapipe, developers can quickly develop applications that perform real-time human pose estimation with minimal effort.

TensorFlow.js: TensorFlow.js provides the capability to deploy pre-trained machine learning models for human pose estimation directly in the browser or Node.js environment. Developers can train or use existing models that are compatible with TensorFlow.js, such as those based on the popular pose estimation models like OpenPose, PoseNet, or AlphaPose. These models are typically trained on large datasets and have been proven to achieve accurate pose estimation results. By leveraging TensorFlow.js, developers can load these models and perform pose estimation on images or video frames using JavaScript. This enables the development of web-based applications that can estimate human poses directly in the browser, without the need for server-side computation.

Example applications

Computer-generated imagery

Computer-generated imagery CGI encompasses a wide range of techniques for creating visual content, and it doesn't necessarily start from human pose estimation. However, if we consider the specific case of using CGI to generate realistic human characters or animations, human pose estimation can play a role. Human Pose Estimation: The first step is to estimate the pose of a human subject, either from real-world data (such as images or videos) or from a digital model. Human pose estimation algorithms analyze the input data and identify the positions and orientations of various body joints, such as the head, shoulders, elbows, wrists, hips, knees, and ankles. Rigging: Once the pose is estimated, a process called rigging is performed. Rigging involves creating a digital skeleton or a hierarchical structure that mimics the bones and joints of a human body. The rigging process establishes relationships between the body joints and enables the manipulation of the character's pose. Animation: With the rigging in place, animators can create movements and animations for the character. They can use keyframing techniques, motion capture data, or procedural animation algorithms to define the motion of the character's body parts. The estimated pose can serve as a starting point for animators to define and refine the character's movements. Skinning: Skinning is the process of attaching the digital character's geometry to the underlying rig. It involves assigning weights to the vertices of the character's 3 D mesh, determining how they are influenced by the movements of the corresponding joints in the rig. Skinning ensures that the character's geometry deforms realistically as the rig is animated. Rendering: Once the character is rigged, animated, and skinned, the final step is rendering. Rendering involves applying lighting, textures, materials, and other visual effects to the character and its surroundings. The scene is then rendered into a 2 D image or a sequence of images, incorporating shadows, reflections, transparency, and other details to create a visually compelling and realistic result.

Evaluation metrics

Semantic Feature Detection

Here we focus on bottom-up approaches.

Sometimes instead than a full pose estimation, one may stop at the feature detection step. Why?

→ Depending on the application we may require several / different types of features. Training the feature detector only is significantly more efficent.

Semantic Feature Detection: a semantic segmentation problem (1)

Semantic features detection can be regarded as a semantic segmentation problem;

Classes are the key-points of interest, plus the background.

This is typically an imbalanced problem, since the number of pixels belonging to the background is significantly higher than the ones belonging to the key-points.

Weighted version of the loss function, with a meaningful strategy for weights computation.

Semantic Feature Detection: a semantic segmentation problem (2)

Annotations do not come for free

A set of annotated data is necessary to train the deep architectures.

Usually, a set of 15 key-points is used for pose-estimation.

Annotating 15 points for a high number of frames can be expensive and time-consuming.

The solution is using transfer-learning: ImageNet pretrained models as backbone (encoder) for the FCNs.

DeepLabCut Algorithm Sketch

DeepLabCut DLC is a popular algorithm used for markerless (without the use of physical markers or sensors attached to the object) pose estimation and tracking in videos or images.

It is widely used in the field of behavioral neuroscience and biomechanics for analyzing animal or human movement.

Here is a high-level sketch of the DeepLabCut algorithm:

https://github.com/Malga-Vision/VisionTool

VisionTool is a python toolbox for pose estimation on videos containing actions. It is powered with a simple and intuititive Graphical User Interface GUI) to allow a complete analysis from annotation to semantic features detection (e.g., joint position estimation).

VisionToolʼs main GUI shows two different interfaces. The first one “Features_Extraction” can be used to perform annotation, training and testing on an imported set of videos. The second one “Pose Estimation” includes the implementation of neural networks architectures to perform action recognition. In its first release, only features extraction is available. Future releases will be focus on the implementation of an actual action recognition submodule including the latest architectures used in the scientific community for the solution of recognition problems.