79
Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE, Univ of Illinois at Urbana Nebojsa Jojic Beckman Institute, University of Illinois at Urbana

Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Joint Estimation of Image Clusters and Image Transformations

Brendan J. FreyComputer Science, University of Waterloo, Canada

Beckman Institute and ECE, Univ of Illinois at Urbana

Nebojsa JojicBeckman Institute, University of Illinois at Urbana

Page 2: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

We’d like to cluster images, but The unknown subjects have unknown positions

Page 3: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

The unknown subjects have unknown positions

unknown rotations unknown scales unknown levels of shearing . . .

Page 4: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Oneapproach

Normalization

PatternAnalysis

Images

Normalizedimages

Labor

Page 5: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Anotherapproach

Apply transformations to each image

PatternAnalysis

Images

Huge dataset

• Assumes transformations are equally likely

• noise gets copied

• analysis is more complex

Page 6: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Yet anotherapproach

Extract transformation-

invariant features

PatternAnalysis

Images

Transformation-invariant data

• Difficult to work with

• May hide useful features

Page 7: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Ourapproach

Joint Normalization

andPattern Analysis

Images

Page 8: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

• A continuous transformation moves an image, , along a continuous curve

• Our clustering algorithm should assign images near this nonlinear manifold to the same cluster

What transforming an image does in the vector space of pixel intensities

Page 9: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Tractable approaches to modeling the transformation manifold

\ Linear approximation

- good locally, bad globally

• Finite-set approximation

- good globally, bad locally

Page 10: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Generative models

• Local invariance: PCA, Turk, Moghaddam, Pentland (96); factor analysis, Hinton, Revow, Dayan, Ghahramani (96); Frey, Colmenarez, Huang (98)

• Layered motion: Black,Jepson,Wang,Adelson,Weiss(93-98)

Learning discrete representations of generative manifolds

• Generative topographic maps, Bishop,Svensen,Williams (98)

Discriminative models

• Local invariance: tangent distance, tangent prop, Simard, Le Cun, Denker, Victorri (92-93)

• Global invariance: convolutional neural networks, Le Cun, Bottou, Bengio, Haffner (98)

Related work

Page 11: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Generative density modeling• The goal is to find a probability model that

– reflects the structure we want to extract

– can randomly generate plausible images,

– represents the data using parameters

• ML estimation is used to find the parameters

• We can use class-conditional likelihoods, p(image|class) for recognition, detection, ...

Page 12: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Mixture of Gaussians

cThe probability that an image comes

from cluster c = 1,2,… is P(c) = c

Page 13: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Mixture of Gaussians

c

z

The probability of pixel intensities z given that the image is from

cluster c is p(z|c) = N(z; c , c)

P(c) = c

Page 14: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Mixture of Gaussians

cP(c) = c

zp(z|c) = N(z; c , c)

• Parameters c, c and c represent the data

• For input z, the cluster responsibilities are

P(c|z) = p(z|c)P(c) / c p(z|c)P(c)

Page 15: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Hand-crafted model

cP(c) = c

zp(z|c) = N(z; c , c)

1= 0.6,

2= 0.4,

Page 16: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

cP(c) = c

zp(z|c) = N(z; c , c)

1= 0.6,

2= 0.4,

Page 17: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

c=1P(c) = c

zp(z|c) = N(z; c , c)

1= 0.6,

2= 0.4,

Page 18: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

c=1P(c) = c

z=

p(z|c) = N(z; c , c)

1= 0.6,

2= 0.4,

Page 19: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

cP(c) = c

zp(z|c) = N(z; c , c)

1= 0.6,

2= 0.4,

Page 20: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

c=2P(c) = c

zp(z|c) = N(z; c , c)

1= 0.6,

2= 0.4,

Page 21: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

c=2P(c) = c

z=

p(z|c) = N(z; c , c)

1= 0.6,

2= 0.4,

Page 22: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Inference

c

z

1= 0.6,

2= 0.4,

Images from data set

Page 23: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Inference

c=1

1= 0.6,

2= 0.4,

Images from data set

z=

c=2

P(c|z)

c0.99

0.01

Page 24: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Inference

1= 0.6,

2= 0.4,

Images from data set

z=

cc=1

c=2

P(c|z)

0.02

0.98

Page 25: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Learning - E step

c

z

1= 0.5,

2= 0.5,

Images from data set

Page 26: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Learning - E step

c=1

Images from data set

z=

c=2

P(c|z)

c0.52

0.48

1= 0.5,

2= 0.5,

Page 27: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Learning - E step

Images from data set

z=

cc=1

c=2

P(c|z)

0.51

0.49

1= 0.5,

2= 0.5,

Page 28: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Learning - E step

Images from data set

z=

cc=1

c=2

P(c|z)

0.48

0.52

1= 0.5,

2= 0.5,

Page 29: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Learning - E step

Images from data set

z=

cc=1

c=2

P(c|z)

0.43

0.57

1= 0.5,

2= 0.5,

Page 30: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Learning - M step

c

1= 0.5,

2= 0.5,

zSet 1 to the average of zP(c=1|z)

Set 2 to the average of zP(c=2|z)

Page 31: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Learning - M step

c

1= 0.5,

2= 0.5,

zSet 1 to the average of zP(c=1|z)

Set 2 to the average of zP(c=2|z)

Page 32: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Learning - M step

c

1= 0.5,

2= 0.5,

zSet 1 to the average of

diag((z-1)T (z-1))P(c=1|z)Set 2 to the average of

diag((z-2)T (z-2))P(c=2|z)

Page 33: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Learning - M step

c

1= 0.5,

2= 0.5,

zSet 1 to the average of

diag((z-1)T (z-1))P(c=1|z)Set 2 to the average of

diag((z-2)T (z-2))P(c=2|z)

Page 34: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: After iterating EM...

c

z

1= 0.6,

2= 0.4,

Page 35: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Adding “transformation” as a discrete latent variable

• Say there are N pixels

• We assume we are given a set of sparse N x N transformation generating matrices G1,…,Gl ,…,GL

• These generate points from point

Page 36: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Transformed Mixture of Gaussians

cThe probability that the image comes

from cluster c = 1,2,… is P(c) = c

Page 37: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Transformed Mixture of Gaussians

c

z

The probability of latent image z

for cluster c is p(z|c) = N(z; c , c)

P(c) = c

Page 38: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Transformed Mixture of Gaussians

lThe probability of transf

l = 1,2,… is P(l) = l

p(z|c) = N(z; c , c)

c

z

P(c) = c

Page 39: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Transformed Mixture of Gaussians

The probability of observed

image x is p(x|z,l) = N(x; Gl z , )

x

P(l) = l l

p(z|c) = N(z; c , c)

c

z

P(c) = c

Page 40: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Transformed Mixture of Gaussians

• l, c, c and c represent the data

• The cluster/transf responsibilities, P(c,l|x), are quite easy to compute

p(x|z,l) = N(x; Gl z , )

x

P(l) = l l

p(z|c) = N(z; c , c)

c

z

P(c) = c

Page 41: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Hand-crafted model

G1 = shift left and up, G2 = I, G3 = shift right and up

x

l

c

zl = 1, 2, 3

1= 0.6, 2= 0.4

1= 2= 3= 0.33

Page 42: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

x

l

c

z

G1 = shift left and up, G2 = I, G3 = shift right and up

Page 43: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

c=1

G1 = shift left and up, G2 = I, G3 = shift right and up

x

l z

Page 44: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

c=1

G1 = shift left and up, G2 = I, G3 = shift right and up

z=

x

l

Page 45: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

l=1

c=1

G1 = shift left and up, G2 = I, G3 = shift right and up

z=

x

Page 46: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

l=1

c=1

G1 = shift left and up, G2 = I, G3 = shift right and up

z=

x=

Page 47: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

x

l

c

z

G1 = shift left and up, G2 = I, G3 = shift right and up

Page 48: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

c=2

G1 = shift left and up, G2 = I, G3 = shift right and up

x

l z

Page 49: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

c=2

G1 = shift left and up, G2 = I, G3 = shift right and up

z=

x

l

Page 50: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

l=3

c=2

G1 = shift left and up, G2 = I, G3 = shift right and up

z=

x

Page 51: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Example: Simulation

l=3

c=2

G1 = shift left and up, G2 = I, G3 = shift right and up

z=

x=

Page 52: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

ML estimation of a Transformed Mixture of Gaussians using EM

x

l

c

z

• E step: Compute P(l|x), P(c|x) and p(z|c,x) for each x in data

• M step: Set

– c = avg of P(c|x)

– l = avg of P(l|x)

– c = avg mean of p(z|c,x)

– c = avg variance of p(z|c,x)

– = avg var of p(x-Gl z|x)

Page 53: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

A Tough Toy Problem

• 4 different shapes

• 25 possible locations• cluttered background

• fixed distraction

• 100 “clusters”

• 200 training cases

Page 54: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Mixture of Gaussians

Mean and first 5principal components

TransformedMixture of Gaussians5 horiz shifts + 5 vert shifts20 iterations of EM

20 iterations of EM

Page 55: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Face ClusteringExamples of 400 outdoor images of 2 people

(44 x 28 pixels)

Page 56: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Mixture of Gaussians

15 iterations of EM (MATLAB takes 1 minute)

Cluster meansc = 1 c = 2 c = 3 c = 4

Page 57: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Transformed mixture of Gaussians• 11 horizontal shifts; 11 vertical shifts

• 4 clusters

• Each cluster has 1 mean and 1 variance for each latent pixel

• 1 variance for each observed pixel

• Training: 15 iterations of EM (MATLAB script takes 10 sec/image)

Page 58: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Initialization

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 59: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

1 iteration of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 60: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

2 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 61: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

3 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 62: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

4 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 63: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

5 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 64: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

6 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 65: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

7 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 66: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

8 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 67: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

9 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 68: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

10 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 69: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

11 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 70: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

12 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 71: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

13 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 72: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

14 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 73: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

15 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 74: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

20 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 75: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

30 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Transformed mixture of Gaussians

Page 76: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Mixture of Gaussians

30 iterations of EM

Cluster meansc = 1 c = 2 c = 3 c = 4

Page 77: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Modeling Written Digits

Page 78: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

A TMG that Captures Writing Angle

• P(l|x) identifies the writing angle in image x

CLUSTERS

TRANSFORMATIONS

Page 79: Joint Estimation of Image Clusters and Image Transformations Brendan J. Frey Computer Science, University of Waterloo, Canada Beckman Institute and ECE,

Wrap-up• MATLAB scripts available at

www.cs.uwaterloo.ca/~frey

• Other domains: audio, bioinformatics, …

• Other latent image models, p(z)– factor analysis (prob PCA) (ICCV99)– mixtures of factor analyzers (NIPS99)– time series (CVPR00)

• Automatic video clustering

• Fast variational inference and learning