55
Tutorial 2 Biological shape descriptors Patrice Koehl and Joel Hass University of California, Davis, USA http://www.cs.ucdavis.edu/~koehl/IMS2017/

Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Tutorial 2 Biological shape descriptors

Patrice Koehl and Joel Hass

University of California, Davis, USA http://www.cs.ucdavis.edu/~koehl/IMS2017/

Page 2: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Deciphering Biological Shapes

-How do we understand shapes?The Mumford experiments

-Shape Descriptors

Page 3: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Deciphering Biological Shapes

-How do we understand shapes?The Mumford experiments

-Shape Descriptors

Page 4: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Regions in the plane

Before moving to our central problem of comparing surfaces in R3, we ask a simpler question:

Problem: How similar are two regions in the plane?

This is already an important problem.

Start with an easy case:

Before moving to the problem of comparing surfaces in R3, we ask a simpler question: Problem: How similar are two regions in the plane?

This is already an important problem.

Question: How close is a square to a circle?

Page 5: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Which of these nine shapes is closest to

?

Which is second closest?

Distance between shapes

Page 6: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Application - Facial Recognition

Start with a 2D photograph. Create some planar regions from a face. Compare their shapes.

Page 7: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Application - Computer Vision“Purring Test” Cat or Dog?

Flip a coin - correct 50% of the time Software fifteen years ago - not much better Today - 99%

Page 8: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Dog or Muffin?

Application - Computer VisionStill a challenge

Page 9: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Application - Computer VisionPuppy or Bagel?

Page 10: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Application - Character RecognitionWhat letter is this?

Page 11: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

How close are these two shapes?

Test Case

Our Goal: Find a mathematical framework to measure the similarity of two shapes.

Can either compare curves or enclosed regions:

Page 12: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Goal for 2D shapes: A metric on curves in the plane

1.d(C1, C2) = 0 C1 is isometric to C2 (isometry)

2. d(C1, C2) = d(C2, C2) (symmetry) 3. d(C1, C3) ≤ d(C1, C2) + d(C2, C3) (triangle inequality)

Page 13: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Why these three metric properties?

1.d(C1, C2) = 0 C1 is isometric to C2 (isometry)

2. d(C1, C2) = d(C2, C2) (symmetry) 3. d(C1, C3) ≤ d(C1, C3) + d(C1, C3) (triangle inequality)

Each property plays an important role in applications.

Page 14: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Isometry: d(C1, C2) = 0 C1 is isometric to C2

Allows for identifying different views of the same object.

We want to consider these to be the same object. Our distance measure should not change if one shape is moved by a Euclidean Isometry.

Page 15: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Symmetry: d(C1, C2) = d(C2, C2)

If I own the square, and you own the circle, we can agree on the distance between them.

The distance between two objects does not depend on the order in which we find them.

C2 C1C2C1

Page 16: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Triangle inequality: d(C1, C3) ≤ d(C1, C2) + d(C2, C3)

This means that noise, or a small error, does not affect distance measurements very much.

Measurements should be stable under small errors.

d(C1, C3) - d(C2, C3) ≤ d(C1, C2)

If C1 and C2 are close, so d(C1, C2) is small, then

the distance of C1 and C2 to a third shape C3 is about the same.

Page 17: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

What is a good metric on the shapes in R2?

David Mumford examined this question.

D. Mumford, 1991 Mathematical Theories of Shape: do they model perception?

There are many natural candidates for metrics giving distances between shapes.

We look at some of these metrics.

Page 18: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Hausdorff metricdH = Maximal distance of a point in one set from the other set, after a rigid motion.

dH(A, B) = min {sup d(x, B ) + sup d(y, A)}

BA What is the Hausdorff distance?

Add the distances of each red dot from the other set.

Gives a metric on {compact subsets of the plane}.

rigid motions x∈A y∈B

Page 19: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Drawbacks: Hausdorff metric

BA dH(A,B) = 0

BA dH(A,B) = 1

BA dH(A,B) = 1

Page 20: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

BA dH(A,B) = 1

Drawbacks: Hausdorff metric

The alignment that minimizes Hausdorff distance may not give the correspondence we want.

Can we fix this with a different metric?

Page 21: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Template metricdistance = Area of non-overlap after rigid motion.

BA dT(A,B) ≈ 0

dT(A, B) = min {Area(A-B) + Area(B-A)} rigid motions

Blue area at left + green area at right

Page 22: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Drawbacks: Template metric

A B

dT(A,B) ≈ 1The area overlap is small.

BA

The area overlap is large. dT(A,B) ≈ 0

Page 23: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Challenge- Intrinsic geometry.

How can we see this?

These shapes are intrinsically close. Not picked up by Hausdorff or template metrics.

Page 24: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Gromov-Hausdorff metric

One way to see that these are close: Bend them in R3, and then use R3-Hausdoff metric. This gives the Gromov-Hausdorff metric.

Page 25: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Optimal transport metricAlso called the Wasserstein or Monge-Kantorovich metric. Distance between two shapes is the cost of moving one shape to the other:

Distance = ∫ (area of subregion) x (distance moved)

BA

Page 26: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Drawback - Optimal Transport

Can be discontinuous

Can be hard to compute

Page 27: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Optimal diffeomorphism metricDefine an energy that measures the stretching between two shapes.

This energy defines a distance between two spaces that are diffeomorphic.

BA

f

dD(A, B) = min {E(f)} diffeomorphisms

Page 28: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Drawback: Optimal diffeomorphism

Requires diffeomorphic shapes

PB

D? ?

Page 29: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Optimal diffeomorphism but allowing some tears.

Maps with tears

PB

Hard to compute.

DB

Page 30: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Mumford ExperimentsTwo groups of subjects, and 15 polygons

a. Pigeons b. Harvard undergraduates

Experiment Conclusion: Human and pigeon perception of shape similarity do not indicate an underlying mathematical metric.

Page 31: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Deciphering Biological Shapes

-How do we understand shapes?The Mumford experiments

-Shape Descriptors

Page 32: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Now look at surfaces and shapes in R3

P1P2

?

How similar are these two shapes?

Page 33: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

?

How do we compare two proteins?

“Feature space”

V1=(a1,b1,…..)

V2=(a2,b2,…..)

P1

P2€

d = V1−V2

Page 34: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Fourier Analysis of Time Signal

Page 35: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Harmonic Representation of Shapes

1. Surface-based shape analysis Spherical harmonics

2. Volume-based shape analysis 3D-Zernike moments

Page 36: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

The challenge of the elephant…Enrico Fermi once said to Freeman Dyson:

“I remember my friend Johnny von Neumann used to say, with four parameters I can fit an elephant, and with five I can make him wiggle his trunk.”

(F. Dyson, Nature (London) 427, 297,2004)

Page 37: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

The challenge of the elephant…

The “best” solution, so far… (Mayer et al, Am. J. Phys. 78, 648-649,2010)

x(t) = Akx cos(kt) + Bk

x sin(kt)( )k=0

K

y(t) = Aky cos(kt) + Bk

y sin(kt)( )k=0

K

k0 0 0 0 0

1 0 50 -60 -30

2 0 18 0 8

3 12 0 0 -10

4 0 0 0 0

5 0 50 0 0

Akx

Bkx

Bky

Aky

Page 38: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

The challenge of the elephant…k=1 k=2

k=3 k=5

Page 39: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

3D: Spherical harmonics

Ylm θ,ϕ( ) =

2l +14π

(l −m)!(l +m)!

Plm cosθ( )eimϕ

f (θ,ϕ) = cl ,mYlm θ,ϕ( )

m=−l

l

∑l=0

+∞

Any function f on the unit-sphere can be expanded into spherical harmonics:

where the basis functions are defined as:

The coefficients cl,m are computed as:

cl.m = f (θ,ϕ) Ylm (θ,ϕ)( )0

π

∫0

2π∫

*sin(θ)dθdϕ

Page 40: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Harmonic Decomposition

= + + + + …

Constant 1st Order 2nd Order 3rd Order

3D: Spherical harmonics

Page 41: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

What are the spherical harmonics Ylm ?

Page 42: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Importance of Rotational Invariance

Shapes are unchanged by rotation

Shape descriptors may be sensitive to rotation: for example, the cl,m are not rotation invariant

Page 43: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Restoring Rotational Invariance

f (x) =a1a2

⎣ ⎢

⎦ ⎥ ≠

b1b2

⎣ ⎢

⎦ ⎥ = f (Rx)

Note that:

However:

f (x) = a12 + a2

2 = b12 + b2

2 = f (Rx)

Invariant spherical harmonics descriptors:

cl,m for all l, m

gl = cl ,m2

m=−l

l

Page 44: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

= + + + + …C0,0

C1,1

C1,0

C1,-1

C2,2

C2,1

C2,0

C2,-1

C2,-2

C3,2

C3,1

C3,0

C3,-1

C3,-2

C3,3

C3,-3

G0G1

G2

G3

Invariant spherical harmonics descriptors

Page 45: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Some issues with Spherical Harmonics

Spherical harmonics are surface-based:

-They require a parametrization of the surface (usually triangulation)

-They are appropriate for star-shaped objects

-They lose content information

Page 46: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

From Surface to Volume● Consider a set of concentric spheres over the object ● Compute harmonic representation of each sphere

independently

=

=

=

+ + + +

+ + + +

+ + + +

Page 47: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Problem: insensitive to internal rotations

Page 48: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

A natural extension to Spherical Harmonics: The 3D Zernike moments

f (θ,ϕ) = cl ,mYlm θ,ϕ( )

m=−l

l

∑l=0

+∞

f (θ,ϕ,r) = cl,mRn,lYlm θ,ϕ( )

m=− l

l

∑l=0

+∞

∑n=0

+∞

Surface-based Volume-based

Ylm θ,ϕ( ) =

2l +14π

(l −m)!(l +m)!

Plm cosθ( )eimϕ

with:

Rnl (r) =Nnlkr

n−2k

k=0

(n− l ) / 2

∑ n − l even

0 n − l odd

⎨ ⎪

⎩ ⎪

and

Page 49: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

How does it work?

Page 50: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Applications

Page 51: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Comparing Old World Monkey Skulls

Page 52: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Old World Monkey Skulls: DNA Tree

Page 53: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

N=5 N=10

N=20 N=40

Original

Page 54: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

Old World Monkey Skulls: Distance Tree

Page 55: Tutorial 2 Biological shape descriptors - web.cs.ucdavis.edukoehl/GeoMapping/Tutorials/Tutorial2.pdf · Regions in the plane Before moving to our central problem of comparing surfaces

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

Fraction of FP

Fra

cti

on

of

TP

N=1

N=5

N=40

N=50

0 10 20 30 40 500.6

0.65

0.7

0.75

0.8

Max. order of Zernike invariants

RO

C a

rea

A) B)

Analysis of the McGill Shape databases 458 objects, in 10 categories