beauty and the beast - university of manitobaece.eng.umanitoba.ca/undergraduate/ece3740/lecture...

18
1 of ? Image Compression Using Learned Vector Quantization Prof. K. Ferens, Ph.D., P.Eng. 29 November 2013 ECE 3740 Seminar Faculty of Engineering, University of Manitoba Beauty and the Beast

Upload: votram

Post on 13-Mar-2018

315 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

1 of ?

Image CompressionUsing Learned Vector Quantization

Prof. K. Ferens, Ph.D., P.Eng.29 November 2013

ECE 3740 SeminarFaculty of Engineering, University of Manitoba

Beauty and the Beast

Page 2: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

2 of ?

BEAUTY AND THE BEAST

Page 3: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

3 of ?

The Beast

Page 4: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

4 of ?

What do you get when you Squeeze An Android?

Data Compression

Page 5: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

5 of ?

Image (Gray Scale)

• Color: RGB, CYMK, and probably others• Grayscale: A grayscale image is one in which the only

colors are shades of gray• Example: 512 pixels x 512 pixels, each pixel is 8-bit

Page 6: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

6 of ?

LVQ Image Compression Main Idea

+ Many others (100s)

Feature Extraction: Example: find 256 common features

Create a codebook (palette) using these features from which face images can be constructed

CommunicationsChannel

1

256

4, 200, 5, 1, ……

Encoder (Transmitter)1

256

4, 200, 5, 1, … …

Decoder (Receiver)

Page 7: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

7 of ?

IMAGE COMPRESSION?

• The original image is represented by a sequence of indices of codewords from a codebook.

• Both transmitter and receiver have copies of same codebook.• Receiver decodes the sequence of indices by replacing each 

index by a codeword from the codebook • Data compression is achieved: 512x512x8bit : 256x8bit = 1024:1• How do we measure the quality of the reconstructed image?

CommunicationsChannel

1

256

4, 200, 5, 1, ……

Original Image1

256

4, 200, 5, 1, … …

Decoded ImageSequence of Indices

Codebook Codebook

Find BestMatchingCodeword

Lookup theCodeword

512x512x8 bits

Page 8: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

8 of ?

How can we Measure the Error?

Lena reconstructed using Baboon’s prototypes Baboon reconstructed using Lena’s prototypes

OriginalImages

CompressedImages

Page 9: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

9 of ?

Metric Determination

• What is the best measure of similarity and difference to use in this application? (comparing the original image with the reconstructed image)

• Using a measure, such as the Euclidean distance is misleading sometimes• Humans do not use Euclidean distance when comparing images.

= 123 ED Units

= 123 ED Units

Page 10: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

10 of ?

Image Vector Space LVQ MappingImage Vector Space

Vector i: 16x4, 8-bit Pixels128-bit Vectors

2128 Total Vectors in Space

PV1

PVi

PV256

Map

Partition of Vector Space256 Regions

Equivalence Subsets

Page 11: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

11 of ?

How Big is 2128 ?

• Consider the number of possible keys you would have to test one at a time to find the correct key to break an encrypted message which used a 128-bit key.• 2128 possible keys

• Imagine a computer that is the size of a grain of sand that can test 128-bit encryption keys.

• Assume that this computer can test a key in the amount of time it takes light to cross it.

• Then consider a cluster of these computers, so many that if you covered the earth with them, they would cover the whole planet to the height of 1 meter.

• Using this cluster of computers, it would take an average of 1,000 years to find the correct 128-bit key.

Page 12: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

12 of ?

Learning PrototypesInput sub-image

IV, 16x8-bit Pixels

PV1

PV256

PrototypeSub-image

1

2

256

255Winner PVj = min(j)Distance(IVi – PVj)

ColumnFormat

IVi

-Training Set…

Update PVj = PVj + LRate*(IVi – PVj)

Page 13: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

13 of ?

Learning Vector Quantization for Image Compression

Page 14: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

14 of ?

LVQ Encoder

Search forBest Matching

Prototype

12

255256

IndexCodewords

Codebook

239

• Encoder• Sequence of codeword indices: 239, 4, 6, 34, …• Each index refers to a codeword (prototype)

• Decoder• For each index lookup codeword and use that codeword (prototype to

Page 15: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

15 of ?

Results(2 Different Codebooks are learned)

• Prototypes are being learned from the Lena image only• Similarly, a codebook is learned using only the Baboon image

Column representation of the prototypes

Input Vector

Best matchingPrototype

Page 16: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

16 of ?

Results

• The Baboon image being represented by a codebook learned from just the Lena image.

Codebook of 256 Prototypes learned from

the Lena Image

Page 17: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

17 of ?

Beauty or Beast?

Lena reconstructed using Baboon’s prototypes Baboon reconstructed using Lena’s prototypes

Page 18: Beauty and the Beast - University of Manitobaece.eng.umanitoba.ca/undergraduate/ECE3740/Lecture Slides...Beauty and the Beast. 2of ? BEAUTY AND THE BEAST. ... • The original image

18 of ?

Beauty or Beast?

Lena reconstructed using Baboon’s prototypes Baboon reconstructed using Lena’s prototypes

OriginalImages

CompressedImages