vector quantization - Oregon State...

34
Lecture 13: Vector Quantization Thinh Nguyen Oregon State University

Transcript of vector quantization - Oregon State...

Page 1: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Lecture 13:Vector Quantization

Thinh NguyenOregon State University

Page 2: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Vector Quantization

Page 3: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Vector

Page 4: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Vector Quantization Facts

Page 5: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Examples

Page 6: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Scalar vs. Vector Quantization

Pixels within a block are correlated.This tends to minimize the number of codewords needed to represent the vectors well.

More flexibility:Different size blocks.Different size codebooks.

Page 7: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Scalar vs. Vector Quantization

Encoding:

Scan the a x b blocks of the image. For eachblock, find the nearest codeword in the codebook and output its index.

This is a “Nearest neighbor search.”

Decoding:

For each index, output the codeword with that index into the destination image.This is a table lookup.

Page 8: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

The Codebook

Both encoder and decoder must have the same codebook.

The codebook must be useful for many images and be stored somewhere.

The codebook must be designed properly to be effective.

Design requires a representative training set.

These are major drawbacks to VQ.

Page 9: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

The Codebook

Both encoder and decoder must have the same codebook.

The codebook must be useful for many images and be stored somewhere.

The codebook must be designed properly to be effective.

Design requires a representative training set.

These are major drawbacks to VQ.

Page 10: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

The Codebook Design Problem

Page 11: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Generalized Lloyd Algorithm (GLA)The Generalized Lloyd Algorithm (GLA) extends the Lloyd algorithm for scalars.

Also called LBG after inventors Linde, Buzo, Gray (1980).

It can be very slow for large training sets.

Page 12: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 13: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 14: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 15: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 16: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 17: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 18: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 19: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 20: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 21: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 22: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 23: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example

Page 24: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

GLA Algorithm

Page 25: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Codebook

Page 26: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Codeword Splitting

Page 27: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example of Splitting

Page 28: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example of Splitting

Page 29: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example of Splitting

Page 30: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example of Splitting

Page 31: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example of Splitting

Page 32: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example of Splitting

Page 33: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

Example of Splitting

Page 34: vector quantization - Oregon State Universityweb.engr.oregonstate.edu/.../vector_quantization.pdf · 2006-05-23 · Scalar vs. Vector Quantization Encoding: Scan the a x b blocks

GLA Advices

Time per iteration is dominated by the partitioning step, which is m nearest neighbor searches where m is the training set size.

Average time per iteration O(m log n) assuming is small.

Training set size:

Training set should be at least 20 training vectors per code word to get reasonable performance.Too small a training set results in “over training.”

Number of iterations can be large.