Shape Matching Shape-Based Recognition Intro Humans can recognize - - PowerPoint PPT Presentation

shape matching
SMART_READER_LITE
LIVE PREVIEW

Shape Matching Shape-Based Recognition Intro Humans can recognize - - PowerPoint PPT Presentation

Shape Matching Shape-Based Recognition Intro Humans can recognize many objects based on shape alone Fundamental cue for many object categories Invariant to photometric variation. Slide from Pedro Felzenszwalb Shapes vs. Intensity


slide-1
SLIDE 1

Shape Matching

slide-2
SLIDE 2

Shape-Based Recognition

  • Humans can recognize many objects

based on shape alone

  • Fundamental cue for many object

categories

  • Invariant to photometric variation.

Intro

Slide from Pedro Felzenszwalb

slide-3
SLIDE 3

Shapes vs. Intensity Values

Similar to a human in terms of shape, but very different in terms of pixel values.

Intro

Images from Belongie et al.

slide-4
SLIDE 4

Applications

  • Shape retrieval
  • Recognizing object categories
  • Fingerprint identification
  • Optical Character Recognition (OCR)
  • Molecular-biology

Intro Western 1909

slide-5
SLIDE 5

Geometric Transformations

  • Often in matching images are allowed to

undergo some geometric transformation

  • Related but not identical shapes can be

deformed into alignment using simple coordinate transformations

  • Find the transformations of one image that

produce good matches to the other image

Intro

Images from Belongie et al.

slide-6
SLIDE 6

Biological Shape

  • Fig. 177. Human skull

0 1 2 3 4 5

d c b a

  • Fig. 179. Skull of chimpanzee.
  • Fig. 180. Skull of baboon.
  • D’Arcy Thompson: On Growth and Form, 1917
  • studied transformations between shapes of organisms

Intro

Slide from Belongie et al.

slide-7
SLIDE 7

Related Problems

  • Shape representation and decomposition
  • Finding a set of correspondences between

shapes

  • Transforming one shape into another
  • Measuring the similarity between shapes
  • Shape localization and model alignment
  • Finding a shape similar to a model in a

cluttered image

Intro

¼

Slide from Pedro Felzenszwalb

slide-8
SLIDE 8

References

Intro

  • Shape Matching and Object Recognition Using Shape Contexts, by S. Belongie,
  • J. Malik, and J. Puzicha. Transactions on Pattern Analysis and Machine Intelligence

(PAMI), 2002.

  • Recognizing Objects in Adversarial Clutter: Breaking a Visual CAPTCHA, by G.

Mori and J. Malik, in Proceedings IEEE Computer Vision and Pattern Recognition (CVPR), 2003.

  • Using the Inner-Distance for Classification of Articulated Shapes, by H. Ling and
  • D. Jacobs, Proceedings of the IEEE Conference on Computer Vision and Pattern

Recognition (CVPR), 2005.

  • Comparing Images Using the Hausdorff Distance, by D. Huttenlocher, G.

Klanderman, and W. Rucklidge, Transactions on Pattern Analysis and Machine Intelligence (PAMI), 1993.

  • A Boundary-Fragment-Model for Object Detection, by A. Opelt, A. Pinz, and A.

Zisserman, Proceedings of the European Conference on Computer Vision (ECCV), 2006.

  • Hierarchical Matching of Deformable Shapes, by P. Felzenszwalb and J. Schwartz,

in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2007

slide-9
SLIDE 9

Outline

  • Shape Distance and Correspondence

➢ Hausdorff Distance

  • Shape Context
  • Inner Distance
  • Hierarchical Approach
  • Hierarchical Matching
  • Machine Learning Approach
  • Boundary Fragment Model

Hausdorff Distance

slide-10
SLIDE 10

Comparing Images Using the Hausdorff Distance

  • D. Huttenlocher, G. Klanderman, and W. Rucklidge

1993 Hausdorff Distance

slide-11
SLIDE 11

Overview

  • Use Hausdorff distance to compare

images to a model

  • Fast and simple approach
  • Tolerant of small position errors
  • Model is only allowed to translate with

respect to the image

  • Can be extended to allow rotation and

scale

Hausdorff Distance

slide-12
SLIDE 12

Hausdorff Distance

  • A means of determining the resemblance
  • f one point set to another
  • Examines the fraction of points in one set

that lie near points in the other set

Hausdorff Distance

h (A; B) = max

a2A

½ min

b2B fd (a; b)g

¾ H (A; B) = max fh (A; B) ; h (B; A)g

slide-13
SLIDE 13

Example

Hausdorff Distance a1 a2 b1 b2 b3 Given two sets of points A and B, find h(A,B)

slide-14
SLIDE 14

Example

Hausdorff Distance a1 a2 b1 b2 b3 Compute the distance between a1 and each bj

slide-15
SLIDE 15

Example

Hausdorff Distance a1 a2 b1 b2 b3 Keep the shortest

slide-16
SLIDE 16

Example

Hausdorff Distance a1 a2 b1 b2 b3 Do the same for a2

slide-17
SLIDE 17

Example

Hausdorff Distance a1 a2 b1 b2 b3 Find the largest of these two distances

slide-18
SLIDE 18

Example

Hausdorff Distance a1 a2 b1 b2 b3 This is h(A,B)

slide-19
SLIDE 19

Example

Hausdorff Distance a1 a2 b1 b2 b3 This is h(B,A)

slide-20
SLIDE 20

Example

Hausdorff Distance a1 a2 b1 b2 b3 H(A,B) = max(h(A,B),h(B,A))

slide-21
SLIDE 21

Example

Hausdorff Distance a1 a2 b1 b2 b3 This is H(A,B)

slide-22
SLIDE 22

Hausdorff Distance

Generalization

  • Hausdorff distance is very sensitive to

even one outlier in A or B

  • Use kth ranked distance instead of the

maximal distance

  • Match if
  • is how many points of the model need to be

near points of the image

  • is how near these points need to be

hk (A; B) = kth

a2A

½ min

b2B fd (a; b)g

¾ hk (A; B) < ± k ±

slide-23
SLIDE 23

Distance Transforms

  • Processing can be sped up by probing a

precomputed Voronoi surface

  • A Voronoi surface defines the distance

from any location in B to the nearest point

  • Can be efficiently computed using dynamic

programming in linear time

Hausdorff Distance

slide-24
SLIDE 24

Example: Matching

Match Edges Model Hausdorff Distance

slide-25
SLIDE 25

Example: Matching

Hausdorff Distance Model Model Image Edges Match

slide-26
SLIDE 26

Outline

  • Shape Distance and Correspondence
  • Hausdorff Distance

➢ Shape Context

  • Inner Distance
  • Hierarchical Approach
  • Hierarchical Matching
  • Machine Learning Approach
  • Boundary Fragment Model

Shape Context

slide-27
SLIDE 27

Shape Matching and Object Recognition Using Shape Contexts

  • S. Belongie, J. Malik, and J. Puzicha

2002 Shape Context

slide-28
SLIDE 28

Overview

1) Solve for correspondences between points

  • n the two shapes
  • Using shape contexts

2) Use the correspondences to estimate an aligning transform

  • Using regularized thin-plate splines

3) Compute the distance between the two shapes

Shape Context

slide-29
SLIDE 29

Related Work: Deformable Templates

  • The Representation and Matching of Pictorial Structures, by

Fischler & Elschlager (1973)

  • Structural image restoration through deformable templates,

by Grenander et al. (1991)

  • Deformable Templates for Face Recognition, by Yuille (1991)
  • Distortion invariant object recognition in the dynamic

linkarchitecture, by von der Malsburg (1993)

Shape Context

Slide from Belongie et al.

slide-30
SLIDE 30

Sampling Points

  • A shape is represented by a set of points

sampled from the edges of the object

Shape Context

slide-31
SLIDE 31

Shape Context: Log-Polar Histograms

Shape Context Count = 4 Count = 12 Count the number of points inside each bin.

Slide from Belongie et al.

slide-32
SLIDE 32

Example: Shape Contexts

a) b) c) d) Shape Context

Images from Belongie et al.

slide-33
SLIDE 33

Point Correspondences

  • Compute matching costs using

Chi Squared distance:

  • Minimize the total cost of matching, such

that matching is 1-to-1

Shape Context

C (pi; pj) C (pi; pj) = 1 2

K

X

k=1

[hi (k) ¡ hj (k)]2 hi (k) + hj (k) H (¼) = X

i

C ¡pi; q¼(i) ¢

[Jonker & Volgenant, 1987]

Slide from Belongie et al.

slide-34
SLIDE 34

Example: Point Correspondences

a) b) c) Shape Context

slide-35
SLIDE 35

Thin Plate Spline Model

  • The name “thin plate spline” refers to a

physical analogy involving the bending of a thin sheet of metal

  • The 2D generalization of the 1D cubic

spline

  • Contains the affine model as a special

case

Shape Context

slide-36
SLIDE 36

Minimizing Bend Energy

  • The Thin Plate Spline interpolation has the

form: where,

  • Select and to minimize the bend

energy:

Shape Context

f (x; y) = a1 + axx + ayy +

n

X

i=1

wiU (jj (xi; yi) ¡ (x; y) jj)

I (f) = Z Z

R2

µ@2f @x2 ¶2 + 2 µ @2f @x@y ¶2 + 2 µ@2f @y2 ¶2 dxdy

U (r) = r2log r2 | {z } | {z }

local non-linear transformations global affine transform

w a

slide-37
SLIDE 37

Example: Matching and Transformation

Shape Context a) b)

Images from Belongie et al.

slide-38
SLIDE 38

Terms in Similarity Score

Shape Context

  • Shape Context difference,
  • Local Image appearance difference,
  • Orientation
  • Gray-level correlation in Gaussian window
  • … (many more possible)
  • Bending energy,

Dsc + 1:6 ¤ Dac + 0:3 ¤ Dbe Dsc Dbe Dac

slide-39
SLIDE 39

Shape Context Results

Query Similarity Scores 0.086 0.108 0.109 0.046 0.107 0.114 0.066 0.073 0.077 0.117 0.121 0.129 0.096 0.147 0.153 Shape Context

Images from Belongie et al.

slide-40
SLIDE 40

Outline

  • Shape Distance and Correspondence
  • Hausdorff Distance
  • Shape Context

➢ Inner Distance

  • Hierarchical Approach
  • Hierarchical Matching
  • Machine Learning Approach
  • Boundary Fragment Model

Inner Distance

slide-41
SLIDE 41

Using the Inner-Distance for Classification

  • f Articulated Shapes
  • H. Ling and D. Jacobs

2005 Inner Distance

slide-42
SLIDE 42

Overview

Inner Distance

  • Its difficult to capture the part structure of

complex shapes with existing shape matching methods

  • Replace euclidean distance with the inner-

distance

  • Insensitive to shape articulations
  • Often more discriminative for complex shapes
  • An extension to shape contexts
slide-43
SLIDE 43

Model of Articulated Objects

1) An object can be decomposed into a number of parts 2) Junctions between parts are relatively small with respect to the parts they connect 3) Articulation on the object is rigid with respect to any part, but can be non-rigid on the junctions 4) An object that has been articulated can be articulated back to its original form

Inner Distance

Images from Ling and Jacobs

slide-44
SLIDE 44

The Inner-Distance

Inner Distance

  • The length of the shortest path between

landmark points within the shape silhouette

  • For convex shapes, the inner-distance

reduces to the Euclidean distance

  • Inner-Distance changes only due do

deformations of the junctions

Images from Ling and Jacobs

slide-45
SLIDE 45

Inner-Distance vs Euclidean Distance

Inner Distance

Images from Ling and Jacobs

slide-46
SLIDE 46

Computing the Inner-Distance

Inner Distance

1) Build a graph on the sampled points

  • For each pair of points x,y.
  • 1. If line segment between them existed entirely

within the object

  • 2. Build an edge connecting x and y with weight

2) Apply a shortest path algorithm on the graph

w = jjx ¡ yjj

slide-47
SLIDE 47

Example: Inner Distance

Inner Distance

slide-48
SLIDE 48

Example: Inner Distance

Inner Distance

3

slide-49
SLIDE 49

Example: Inner Distance

Inner Distance

3 3

slide-50
SLIDE 50

Example: Inner Distance

Inner Distance

3 3 1.4

slide-51
SLIDE 51

Example: Inner Distance

Inner Distance

3 3 2 1.4

slide-52
SLIDE 52

Example: Inner Distance

Inner Distance

3 3 2 2 1.4

slide-53
SLIDE 53

Example: Inner Distance

Inner Distance

3 3 1.4 2 2 2 2 2 2 2 2 3 3 1 1 1 1 1.4 1.4 1.4

slide-54
SLIDE 54

Example: Inner Distance

Inner Distance

a 3 1.4 2 2 2 2 2 2 2 2 3 3 1 1 1 1 1.4 1.4 1.4 3 b

d (a; b) = 4

slide-55
SLIDE 55

Example: Inner Distance

Inner Distance

3 3 1.4 2 2 2 2 2 2 2 2 3 3 1 1 1 1 1.4 1.4 1.4 c d

d (c; d) = 3

slide-56
SLIDE 56

An Extension to Shape Contexts

Inner Distance

  • Redefine the bins with inner-distance
  • Euclidean distance is replaced directly with the

inner-distance

Images from Ling and Jacobs

slide-57
SLIDE 57

Results (MPEG7 dataset)

Inner Distance Algorithm CSS Visual Parts SC Score 75.44% 76.45% 76.51% Algorithm Curve Edit Gen. Model IDSC Score 78.17% 80.03% 85.40%

slide-58
SLIDE 58

Outline

  • Shape Distance and Correspondence
  • Hausdorff Distance
  • Shape Context
  • Inner Distance
  • Hierarchical Approach

➢ Hierarchical Matching

  • Machine Learning Approach
  • Boundary Fragment Model

Shape Tree

slide-59
SLIDE 59

Hierarchical Matching of Deformable Shapes

  • P. Felzenszwalb and J. Schwartz

2007 Shape Tree

slide-60
SLIDE 60

Overview

Shape Tree

  • Use hierarchical representation to capture

shape information at multiple levels of resolution

  • Capture global properties by compositing

adjacent curve matches

slide-61
SLIDE 61

Local vs. Coarse Features

b) a) Shape Tree

Images from Felzenszwalb and Schwartz

slide-62
SLIDE 62

The Shape-Tree

Shape Tree

1 1 1 9 9 9 5 5 5 5 5 3 3 3 2 4 7 7 7 6 8

Images from Felzenszwalb and Schwartz

slide-63
SLIDE 63

Bookstein Coordinates

  • Encode the relative positions of 3 points as

a point in the plane

  • A simple way to represent the relative

location of a midpoint in the shape tree

  • Given 3 points there exists a unique

similarity transformation which maps:

  • P1 to (-0.5, 0)
  • P2 to (0.5, 0)
  • P3 to the Bookstein coordinate

Shape Tree

slide-64
SLIDE 64

Relative Locations

Shape Tree A B C A B C (-0.5,0) (0.5,0)

  • Bookstein coordinates for representing

B | A,C

  • There exists a unique similarity

transformation T taking:

  • A to (-0.5 , 0)
  • C to (0.5 , 0)
  • We are interested in T(B)

Slide from Felzenszwalb and Schwartz

slide-65
SLIDE 65

Deformation model

  • Independently perturb relative locations

stored in a shape-tree

  • Reconstructed curve is perceptually similar to
  • riginal
  • Local and global properties are preserved

Shape Tree

Images from Felzenszwalb and Schwartz

slide-66
SLIDE 66

Distance Between Curves

  • Given curves A and B
  • Can’t compare shape-trees for A and B

built separately

  • Fix shape-tree for A and look for map from

points in A to points in B that doesn’t deform the shape-tree much

  • Efficient DP algorithm, where

Shape Tree

O ¡nm3¢ (n = jAj; m = jBj)

Slide from Felzenszwalb and Schwartz

slide-67
SLIDE 67

Recognition Results

Shape Tree Nearest Neighbor Classification Algorithm Shape-Tree Inner-Distance Shape Context Score 96.28% 94.13% 88.12% Swedish Leaf Dataset (15 species with 75 examples each) Bullseye Score Algorithm Shape-Tree Inner-Distance Score 87.70% 85.40% Algorithm Curve Edit Shape Context Score 78.14% 76.51% MPEG7 Dataset

slide-68
SLIDE 68

Matching in Cluttered Images

  • Given the model curve and the set of

curves in the image

  • Use DP to match each curve in to every

subcurve of

  • Running time is linear on total length of image

contours and cubic in the length of the model

  • Stitch partial matchings together to form

longer matchings

  • Use compositional rule

Shape Tree

M C C M

slide-69
SLIDE 69

Compositional Rule

Shape Tree p q r s a b c M C

If compose Match([a,b], [p,q]) and Match([b,c], [r,s]) Match([a,b],[p,q]) = Match([b,c],[r,s]) = Match([a,c],[p,s]) = jjq ¡ rjj < ¿ m = q + r 2 w1 + w2 + dif ((bja; c) ; (mjp; s)) w1 w2

Slide from Felzenszwalb and Schwartz

slide-70
SLIDE 70

Example: Detection

Input Image Edge Map Contours Detection Shape Tree

Images from Felzenszwalb and Schwartz

slide-71
SLIDE 71

Results

Shape Tree Model

Images from Felzenszwalb and Schwartz

slide-72
SLIDE 72

Outline

  • Shape Distance and Correspondence
  • Hausdorff Distance
  • Shape Context
  • Inner Distance
  • Hierarchical Approach
  • Hierarchical Matching
  • Machine Learning Approach

➢ Boundary Fragment Model

Boundary Fragment Model

slide-73
SLIDE 73

A Boundary-Fragment-Model for Object Detection

  • A. Opelt, A. Pinz, and A. Zisserman

2006 Boundary Fragment Model

slide-74
SLIDE 74

Overview

Boundary Fragment Model

  • Object class detection using object

boundaries instead of salient image features

  • A learning technique to extract

discriminating boundary fragments

  • Use boosting to select discriminative

combinations of boundary fragments (weak detectors) to form a strong detector

slide-75
SLIDE 75

Learning Boundary Fragments

Boundary Fragment Model

  • Given
  • A training image set with the object delineated

by a bounding box

  • A validation image set labeled with whether the
  • bject is absent or present, and the object’s

centroid

  • From the edges of the training images

identify fragments that:

  • Discriminate objects from the target category

from other objects

  • Give a precise estimate of the object centroid
slide-76
SLIDE 76

Example: Good Boundary Fragment +

*

= Correct Centroid = Estimated Centroid Boundary Fragment Model

Images from Opelt et al

slide-77
SLIDE 77

Example: Poor Boundary Fragment +

*

= Correct Centroid = Estimated Centroid Boundary Fragment Model

Images from Opelt et al

slide-78
SLIDE 78

Weak Detectors

Boundary Fragment Model

  • A weak detector is composed of k

(typically 2 or 3) boundary fragments

  • Detection should occur when
  • The k fragments match the image edges
  • The centroids concur
  • For positive images the centroid estimate

agrees with the true object centroid

Images from Opelt et al

slide-79
SLIDE 79

Strong Detector

Boundary Fragment Model

  • Given weak detectors
  • Using AdaBoost
  • In each round find the weak detector that
  • btains the best detection results on the current

weighting

hi H (I) = sign à T X

i=1

hi (I) whi !

slide-80
SLIDE 80

Example: Detection and Segmentation

Original Image All Matched Boundary Fragments Centroid Voting on Subset of Fragments Backprojected Maximum Detection and Segmentation Boundary Fragment Model

Images from Opelt et al

slide-81
SLIDE 81

Example: Detection and Localization

Boundary Fragment Model

Images from Opelt et al

slide-82
SLIDE 82

Results

Boundary Fragment Model Detection Error Algorithm BFM [18] cars-rear 2.25% 6.10% ROC Error Rate Algorithm BFM [12] [22] [25] [2] [3] [14] [26] [28] cars-rear 0.50% 8.80% 8.90% 21.40% 3.10% 2.30% 1.80% 9.80%

  • airplanes

2.60% 6.30% 11.10% 3.40% 4.50% 10.30%

  • 17.10% 5.60%
slide-83
SLIDE 83

Recognizing Objects in Adversarial Clutter: Breaking a Visual CAPTCHA

  • G. Mori and J. Malik

2003 Breaking CAPTCHA

slide-84
SLIDE 84

What is a CAPTCHA?

  • Definition: Completely Automated Public

Turing test to tell Computers and Humans Apart.

  • Used to prevent automated SPAM.
  • Also to read books!

Breaking CAPTCHA

slide-85
SLIDE 85

Applications of CAPTCHAs

  • Preventing blog SPAM
  • Protecting web site registration
  • Protecting email addresses from scrapers
  • Preventing dictionary attacks
  • Online polling
  • Blocking search engines
  • Blocking email SPAM

Breaking CAPTCHA

slide-86
SLIDE 86

Human Assisted OCR

  • Roughly 60 million CAPTCHAs are solved

by humans every day.

  • Equivalent to about 150,000 hours of work.
  • Why not use these CAPTCHAs for hard

OCR tasks?

Breaking CAPTCHA

slide-87
SLIDE 87

Why Break a CAPTCHA?

  • CAPTCHAs help prevent SPAM
  • They also offer challenges to the AI

community

  • A win-win situation:
  • If the CAPTCHA is not broken then SPAM is

blocked

  • If it is broken then an AI problem has been

solved

Breaking CAPTCHA

slide-88
SLIDE 88

Approach 1

  • Detect letters using the Shape Context

approach

  • Extended so that the SC includes the dominant

tangential direction of the edges in each bin

  • Form a directed acyclic graph of the letters

to find candidate words

  • Choose the most likely word based on the

average deformable match cost of the individual letters

Breaking CAPTCHA

Images from Mori and Malik

slide-89
SLIDE 89

Approach 2

  • For harder CAPTCHAs matching on letter

sized regions is to difficult

  • Match on groups of letters instead

Breaking CAPTCHA

Images from Mori and Malik

slide-90
SLIDE 90

Example: EZ-Gimpy

polish sound rice join jewel sock horse mine space canvas weight east store Breaking CAPTCHA

Images from Mori and Malik

slide-91
SLIDE 91

Example: 3 Word CAPTCHA

Breaking CAPTCHA sharp round long sudden apple oven with true sponge future key have

Images from Mori and Malik

slide-92
SLIDE 92

Discussion Points

Conclusion

  • How can shape matching be made more

robust to clutter?

  • What applications are not suitable for

shape matching? Which are?

  • How can methods like Shape Context take

advantage of available training data?

  • How can appearance and shape features

be best combined?

  • What other hard AI problems can be used

as CAPTCHAs?