dictionaries –mixtures of gaussians...

20
Vision as Bayesian Inference Dictionaries – Mixtures of Gaussians – Mini‐Epitomes. Alan Yuille JHU

Upload: others

Post on 16-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Dictionaries – Mixtures of Gaussians 

– Mini‐Epitomes.

Alan YuilleJHU

Page 2: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Local Image Patches

• Analyze properties of local image patches. • Get a lot of image patches.• Apply techniques:(i) Dictionaries – k‐means.(ii) Mini‐epitomes.

Lecture 04‐04

Page 3: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

2

( ) ( )i ix i

E I x b x

2ˆ argmin ( ) ( ) argmin ( ) ( )i i i ix xI x b x I x b x

with constant only one  0i

2( ) 1ib x 2ˆ ˆmin ( ) ( )i ii x

i I x b x

Extreme Sparsity Matched Filters

Set of basis function:Represent each image by one basis function only

( )ib x

Algorithm estimate 

Set

Choose 

ˆ argmin E

Lecture 04‐05

Set ˆ ˆii

0j otherwise

Page 4: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Lecture 04‐06

Minimize

How to minimize? 

Convert this to k‐means clustering

2( ) 1ib x

2

1, ( ) ( )| | i i

x iE b I x b x

with constraint that only one     is non‐zero for each μ

i

Requires normalizing each image                                      so that  2( )( )( )

x

I xI xI x

2( ) 1

xI x

Implies that the best 1i

k‐means

parameter 

space

Page 5: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

• Deterministic 𝑘‐means1. Initialize a partition

• E.g. Randomly choose points 𝑥 and put them into set, 𝐷 ,𝐷 ,… , 𝐷 ‐ so that all datapoints are in exactly one set

2. Compute the mean of each cluster 𝐷 ,𝑚 ∑ 𝑥∈

3. For 𝑖 1, … ,𝑁, compute 𝑑 𝑥 𝑥 𝑚• Assign 𝑥 to cluster 𝐷s.t.

4. Repeat steps 2 & 3 until converge

Supplement: ‐means Algorithm

0 : 1,...,aD a k

* argmin ( ),..., ( )a i k ia d x d x

Lecture 04‐08

Page 6: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

• Soft version of 𝑘‐means: The EM algorithm• A ‘softer’ version of 𝑘‐means – the Expectation‐Maximization (EM) algorithm. • Assign datapoints 𝑥 to each cluster with probability  𝑃 ,… , 𝑃1. Initialize a partition

• E.G. randomly choose 𝑘 points as centres𝑚 ,𝑚 ,…, 𝑚2. For 𝑗 1,… ,𝑁

• Compute distances 𝑑 𝑥 𝑥 𝑚• Compute the probability that 𝑥 belongs to 𝐷 :

3. Compute the mean and variance for each cluster

4. Repeat steps 2 & 3 until convergence

Supplement: ‐means Algorithm

22

12

/22

1( )2

j aax m

a j d

a

P x e

1 ( )a a

a aD x Dm xP x

2 21 ( ) ( )

a aa a aD x D

x m P x

Lecture 04‐09

Page 7: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Recall PCA & Sparsity

• Shift‐invariance arises both in PCA and Sparsity.

• Are we wasting bases by encoding spatial translation? 

Lecture 04‐10

Page 8: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Full Sparsity

• Dictionaries of patches:• Cluster – k‐means.

Lecture 04‐11

Page 9: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Modeling Shift

• A variants of image patches.•Mini‐Epitomes (G. Papandreou et al. CVPR 2014)

•An attempt to deal directly with shift‐invariance.

Lecture 04‐12

Page 10: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Lecture 04‐13

Mini‐Epitomes

This is like an extension of Matched Templates

But with smarter patches

Can be learnt by the EM algorithm: extending k‐means

Image patch8x8

select

12

12

Page 11: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Sources of Redundancy in Patch Dictionaries1. Same pattern, different position

→ Our work: Build less redundant epitomic dictionaries

2. Same pattern, opposite polarity (x2 redundancy)

3. Same pattern, different contrast

Lecture 04‐14

Page 12: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

The Epitome Data Structure

Epitomes: Jojic, Frey, Kannan, ICCV-03

Lecture 04‐15

Page 13: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Dictionary of Mini‐Epitomes

G. Papandreou, L.-C. Chen, A. Yuille (CVPR-14)“Modeling Image Patches with a Generic Dictionary of Mini-Epitomes” Lecture 04‐16

Page 14: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Epitomic Patch Matching1. We have K mini-epitomes (say patch size is 8x8 pixels and mini-epitome

size is 12x12 pixels).2. For each patch in the image and each mini-epitome k = 1:K, find the

patch at position p in the epitome which minimizes the reconstruction error (whitening omitted):

(12-8+1)^2 = 25 candidate positions/epitome in this example

3. Algorithms: Exact search (GPU, <0.5 sec/image) or ANN or dynamic programming algorithm. Lecture 04‐17

Page 15: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Epitomic Match vs. Max Pooling1. Position search equivalent to epitomic convolution:

2. Epitomic convolution is an image-centric alternative to convolution followed by “max-pooling”:

* It is much easier to define image prob models based on EC than MP* Evaluation in discr. tasks underway Lecture 04‐18

Page 16: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

A Generic Mini‐Epitome Dictionary

Epitomic dictionary256 mini-epitomes (16x16)

Non-Epitomic dictionary1024 elements (8x8)

Both trained on 10,000 Pascal images Lecture 04‐19

Page 17: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Epitomic Dictionary Learning

→ Max likelihood, hard EM – essentially epitomic adaptation of K-Means.

Unsupervised training. Generative model:1. Select mini-epitome k with prob2. Select position p within epitome uniformly3. Generate the patch (whitening not shown here):

→ Faster convergence using diverse initialization of mini-epitomes by epitomic adaptation of K-Means++.

→ Mini-batch K-Means for very large-scale (to try).Lecture 04‐20

Page 18: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Evaluation on Image Reconstruction

Original image Epitome reconstr. (PSNR: 29.2 dB)

Improvement over non-epitome

Lecture 04‐21

Page 19: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Universal dictionary?

• Can a limited number of patches, or mini‐epitomes “accurately” model most image patches that appear in a large set of images?

• Accurate, means normalized cross‐correlation of 0.8 or higher. Perceptually the patches look similar (image patch and closest dictionary element).

• What is the set of all possible 8x8 image patches?

Lecture 04‐22

Page 20: Dictionaries –Mixtures of Gaussians –Mini‐Epitomes.ayuille/JHUcourses/VisionAsBayesianInference202… · Visionas Bayesian Inference Dictionaries –Mixtures of Gaussians

Vision as Bayesian Inference

Epitome Benefit in Reconstruction

1. Mini-Epitome dictionary with 64 elements =Non-epitome dictionary with 2048 elements (8x better/ param)

2. NCC better than 0.8 for 70% of image patches

Lecture 04‐23