Composite Quantization for Approximate Nearest Neighbor Search - - PowerPoint PPT Presentation

โ–ถ
composite quantization for
SMART_READER_LITE
LIVE PREVIEW

Composite Quantization for Approximate Nearest Neighbor Search - - PowerPoint PPT Presentation

Composite Quantization for Approximate Nearest Neighbor Search Jingdong Wang Lead Researcher Microsoft Research http://research.microsoft.com/~jingdw ICML 2104, joint work with my interns Ting Zhang from USTC and Chao Du from Tsinghua


slide-1
SLIDE 1

Jingdong Wang Lead Researcher Microsoft Research

http://research.microsoft.com/~jingdw ICML 2104, joint work with my interns Ting Zhang from USTC and Chao Du from Tsinghua University

Composite Quantization for Approximate Nearest Neighbor Search

slide-2
SLIDE 2

5/6/2015

Outline

  • Introduction
  • Problem
  • Product quantization
  • Cartesian k-means
  • Composite quantization
  • Experiments
slide-3
SLIDE 3

5/6/2015

Nearest neighbor search

  • Application to similar image search

query

slide-4
SLIDE 4

5/6/2015

Nearest neighbor search

  • Application to particular object retrieval

query

slide-5
SLIDE 5

5/6/2015

Nearest neighbor search

  • Application to duplicate image search
slide-6
SLIDE 6

5/6/2015

Nearest neighbor search

  • Similar image search

Application to K-NN annotation: Annotate the query image using the similar images

slide-7
SLIDE 7

5/6/2015

Nearest neighbor search

  • Definition
  • Database:
  • Query:
  • Nearest neighbor:

๐‘ฆ โˆ’ ๐‘Ÿ 2

โˆˆ ๐‘†๐‘’

slide-8
SLIDE 8

5/6/2015

Nearest neighbor search

  • Exact nearest neighbor search
  • linear scan:
slide-9
SLIDE 9

5/6/2015

Nearest neighbor search - speedup

  • K-dimensional tree (Kd tree)
  • Generalized binary search tree
  • Metric tree
  • Ball tree
  • VP tree
  • BD tree
  • Cover tree
  • โ€ฆ
slide-10
SLIDE 10

5/6/2015

Nearest neighbor search

  • Exact nearest neighbor search
  • linear scan:
  • Costly and impractical for large scale high-dimensional cases
  • Approximate nearest neighbor (ANN) search
  • Efficient
  • Acceptable accuracy
  • Practically used
slide-11
SLIDE 11

5/6/2015

Two principles for ANN search

Recall the complexity of linear scan:

  • 1. Reduce the number of distance computations
  • Time complexity:
  • Tree structure, neighborhood graph search and inverted index
slide-12
SLIDE 12

5/6/2015

Our work: TP Tree + NG Search

  • TP Tree
  • Jingdong Wang, Naiyan Wang, You Jia, Jian Li, Gang Zeng, Hongbin Zha, Xian-Sheng Hua:Trinary-

Projection Trees for Approximate Nearest Neighbor Search. IEEE Trans. Pattern Anal. Mach. Intell. 36(2): 388-403 (2014)

  • You Jia, Jingdong Wang, Gang Zeng, Hongbin Zha, Xian-Sheng Hua: Optimizing kd-trees for scalable

visual descriptor indexing. CVPR 2010: 3392-3399

  • Neighborhood graph search
  • Jingdong Wang, Shipeng Li:Query-driven iterated neighborhood graph search for large scale
  • indexing. ACM Multimedia 2012: 179-188
  • Jing Wang, Jingdong Wang, Gang Zeng, Rui Gan, Shipeng Li, Baining Guo: Fast Neighborhood

Graph Search Using Cartesian Concatenation. ICCV 2013: 2128-2135

  • Neighborhood graph construction
  • Jing Wang, Jingdong Wang, Gang Zeng, Zhuowen Tu, Rui Gan, Shipeng Li: Scalable k-NN graph

construction for visual descriptors. CVPR 2012: 1106-1113

slide-13
SLIDE 13

5/6/2015

Comparison over SIFT 1M

13

ICCV13 ACMMM12 CVPR10 1 NN

slide-14
SLIDE 14

5/6/2015

Comparison over GIST 1M

14

ICCV13 ACMMM12 CVPR10 1 NN

slide-15
SLIDE 15

5/6/2015

Comparison over HOG 10M

15

ICCV13 ACMMM12 CVPR10 1 NN

slide-16
SLIDE 16

5/6/2015

Neighborhood Graph Search

  • Shipped to Bing ClusterBed
  • Number
  • Index building time on 40M documents is only 2 hours and 10 minutes.
  • Search DPS on each NNS machine stable at 950 without retry and errors
  • Five times faster improved FLANN
slide-17
SLIDE 17

5/6/2015

Two principles for ANN search

Recall the complexity of linear scan:

  • 1. Reduce the number of distance computations
  • Time complexity:
  • Tree structure, neighborhood graph search and inverted index
  • 2. Reduce the cost of each distance computation
  • Time complexity:
  • Hashing (compact codes)
  • 1. High efficiency ๏Š
  • 2. Large memory cost ๏Œ
  • 1. Small memory cost ๏Š
  • 2. Low efficiency ๏Œ
slide-18
SLIDE 18

5/6/2015

Approximate nearest neighbor search

  • Binary embedding methods (hashing)
  • Produce a few distinct distances
  • Limited ability and flexibility of distance approximation
  • Vector quantization (compact codes)
  • K-means
  • Impossible to use for medium and large code length
  • Impossible to learn the codebook
  • Impossible to compute a code for a vector
  • Product quantization
  • Cartesian k-means
slide-19
SLIDE 19

5/6/2015

Combined solution for very large scale search

Retrieve candidates with an index structure using compact codes Load raw features for retrieved candidates from disk Reranking using the true distances Efficient and small memory consumption IO cost is small

slide-20
SLIDE 20

5/6/2015

Outline

  • Introduction
  • Problem
  • Product quantization
  • Cartesian k-means
  • Composite quantization
  • Experiments
slide-21
SLIDE 21

5/6/2015

Product quantization

  • Approximate x by the concatenation of M subvectors
slide-22
SLIDE 22

5/6/2015

x = x1๐‘—1 x2๐‘—2 โ‹ฎ x๐‘๐‘—๐‘ โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘

Product quantization

  • Approximate x by the concatenation of M subvectors

{p11, p12, โ‹ฏ , p1๐ฟ}

Codebook in the 1st subspace

{p21, p22, โ‹ฏ , p2๐ฟ}

Codebook in the 2nd subspace

{p๐‘1, p๐‘2, โ‹ฏ , p๐‘๐ฟ}

Codebook in the Mth subspace

slide-23
SLIDE 23

5/6/2015

x = x1 x2 โ‹ฎ x๐‘ โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘

Product quantization

  • Approximate x by the concatenation of M subvectors

{p11, p12, โ‹ฏ , p1๐ฟ}

Codebook in the 1st subspace

{p21, p22, โ‹ฏ , p2๐ฟ}

Codebook in the 2nd subspace

{p๐‘1, p๐‘2, โ‹ฏ , p๐‘๐ฟ}

Codebook in the Mth subspace

slide-24
SLIDE 24

5/6/2015

Product quantization

  • Approximate x by the concatenation of M subvectors

{p11, p12, โ‹ฏ , p1๐ฟ} {p21, p22, โ‹ฏ , p2๐ฟ}

Codebook in the 2nd subspace

{p๐‘1, p๐‘2, โ‹ฏ , p๐‘๐ฟ}

Codebook in the Mth subspace

x = x1 x2 โ‹ฎ x๐‘ โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘

Codebook in the 1st subspace

slide-25
SLIDE 25

5/6/2015

Product quantization

  • Approximate x by the concatenation of M subvectors

{p11, p12, โ‹ฏ , p1๐ฟ}

Codebook in the 1st subspace

{p21, p22, โ‹ฏ , p2๐ฟ}

Codebook in the 2nd subspace

{p๐‘1, p๐‘2, โ‹ฏ , p๐‘๐ฟ}

Codebook in the Mth subspace

x = x1 x2 โ‹ฎ x๐‘ โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘

slide-26
SLIDE 26

5/6/2015

Product quantization

  • Approximate x by the concatenation of M subvectors
  • Code presentation: (๐‘—1, ๐‘—2, โ€ฆ, ๐‘—๐‘)
  • Distance computation:
  • ๐‘’ q,

x 2 = ๐‘’ q1, p1๐‘—1

2 + ๐‘’ q2, p2๐‘—2 2 + โ‹ฏ + ๐‘’ qM, p๐‘๐‘—๐‘ 2

  • M additions using a pre-computed distance table

{p11, p12, โ‹ฏ , p1๐ฟ}

Codebook in the 1st subspace

{p21, p22, โ‹ฏ , p2๐ฟ}

Codebook in the 2nd subspace

{p๐‘1, p๐‘2, โ‹ฏ , p๐‘๐ฟ}

Codebook in the Mth subspace

x = x1 x2 โ‹ฎ x๐‘ โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘

q1

๐‘’( ๐‘’( ๐‘’(

, q1 ) , q2 ) , q๐‘ ) โ‰œ {๐‘’ q1, p11 , ๐‘’ q1, p12 , โ‹ฏ , ๐‘’(q1, p1๐ฟ)}

slide-27
SLIDE 27

5/6/2015

๐‘ = 2

Product quantization

  • Approximate x by the concatenation of M subvectors
  • Codebook generation
  • Do k-means for each subspace
slide-28
SLIDE 28

5/6/2015

Product quantization

  • Approximate x by the concatenation of M subvectors
  • Codebook generation
  • Do k-means for each subspace

๐‘ = 2, ๐ฟ = 3

๐‘ž11 ๐‘ž12 ๐‘ž13 ๐‘ž21 ๐‘ž22 ๐‘ž23

slide-29
SLIDE 29

5/6/2015

Product quantization

  • Approximate x by the concatenation of M subvectors
  • Codebook generation
  • Do k-means for each subspace
  • Result in ๐ฟ๐‘ groups
  • The center of each is the concatenation of M subvectors

๐‘ = 2, ๐ฟ = 3

๐‘ž11 ๐‘ž12 ๐‘ž13 ๐‘ž21 ๐‘ž22 ๐‘ž23 = ๐‘ž11 ๐‘ž21

slide-30
SLIDE 30

5/6/2015

Product quantization

  • Approximate x by the concatenation of M subvectors
  • Codebook generation
  • Do k-means for each subspace
  • Result in ๐ฟ๐‘ groups
  • The center of each is the concatenation of M subvectors

๐‘ = 2, ๐ฟ = 3

slide-31
SLIDE 31

5/6/2015

Product quantization

  • Approximate x by the concatenation of M subvectors
  • Codebook generation
  • Do k-means for each subspace
  • Result in ๐ฟ๐‘ groups
  • The center of each is the concatenation of M subvectors

๐‘ = 2, ๐ฟ = 3

slide-32
SLIDE 32

5/6/2015

Product quantization

  • Approximate x by the concatenation of M subvectors
  • Codebook generation
  • Do k-means for each subspace
  • Result in ๐ฟ๐‘ groups
  • The center of each is the concatenation of M subvectors

๐‘ = 2, ๐ฟ = 3

x ๐‘ž13 ๐‘ž22 x โ‰ˆ x = ๐‘ž13 ๐‘ž22

slide-33
SLIDE 33

5/6/2015

Outline

  • Introduction
  • Problem
  • Product quantization
  • Cartesian k-means
  • Composite quantization
  • Experiments
slide-34
SLIDE 34

5/6/2015

Cartesian K-means

  • Extended product quantization
  • Optimal space rotation
  • Perform PQ over the rotated space

x โ‰ˆ x = R p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘

slide-35
SLIDE 35

5/6/2015

Cartesian K-means

  • Extended product quantization
  • Optimal space rotation
  • Perform PQ over the rotated space

๐‘ž11 ๐‘ž21 ๐‘ž12 ๐‘ž13 ๐‘ž23 ๐‘ž22

x โ‰ˆ x = R p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘

slide-36
SLIDE 36

5/6/2015

Cartesian K-means

  • Extended product quantization
  • Optimal space rotation
  • Perform PQ over the rotated space

x

x โ‰ˆ x = R ๐‘ž13 ๐‘ž22

๐‘ž11 ๐‘ž21 ๐‘ž12 ๐‘ž13 ๐‘ž23 ๐‘ž22

x โ‰ˆ x = R p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘

slide-37
SLIDE 37

5/6/2015

Outline

  • Introduction
  • Composite quantization
  • Experiments
slide-38
SLIDE 38

5/6/2015

Composite quantization

x โ‰ˆ x = c1๐‘—1 + c2๐‘—2 + โ‹ฏ + c๐‘๐‘—๐‘

{c11, c12, โ‹ฏ , c1๐ฟ}

Source codebook 1

{c21, c22, โ‹ฏ , c2๐ฟ}

Source codebook 2

{c๐‘1, c๐‘2, โ‹ฏ , c๐‘๐ฟ}

Source codebook M

  • Approximate x by the addition of M vectors

โ‹ฏ

Each source codebook is composed of K d-dimensional vectors

slide-39
SLIDE 39

5/6/2015

Composite quantization

c12 c11 c13 {c11, c12, c13} {c21, c22, c23}

2 source codebooks:

c22 c23 c21

slide-40
SLIDE 40

5/6/2015

Composite quantization

{c11, c12, c13} {c21, c22, c23}

2 source codebooks: Composite center:

= c11 + c21 c11 c21

slide-41
SLIDE 41

5/6/2015

Composite quantization

{c11, c12, c13} {c21, c22, c23}

2 source codebooks: Composite center:

= c11 + c22 c11 c22

slide-42
SLIDE 42

5/6/2015

Composite quantization

{c11, c12, c13} {c21, c22, c23}

2 source codebooks: Composite center:

= c11 + c23 c11 c23

slide-43
SLIDE 43

5/6/2015

Composite quantization

{c11, c12, c13} {c21, c22, c23}

2 source codebooks: More composite centers

slide-44
SLIDE 44

5/6/2015

Composite quantization

{c11, c12, c13} {c21, c22, c23}

Source codebook: Composite codebook: 9 composite centers

slide-45
SLIDE 45

5/6/2015

Composite quantization

{c11, c12, c13} {c21, c22, c23}

Source codebook:

x

c11 ๐‘‘22 x โ‰ˆ x = c11+ c22

9 groups Space partition:

slide-46
SLIDE 46

5/6/2015

Composite quantization

x โ‰ˆ x = c1๐‘—1 + c2๐‘—2 + โ‹ฏ + c๐‘๐‘—๐‘

{c11, c12, โ‹ฏ , c1๐ฟ}

Source codebook 1

{c21, c22, โ‹ฏ , c2๐ฟ}

Source codebook 2

{c๐‘1, c๐‘2, โ‹ฏ , c๐‘๐ฟ}

Source codebook M

  • Approximate x by the addition of M vectors

โ‹ฏ

slide-47
SLIDE 47

5/6/2015

Composite quantization

x โ‰ˆ x = c1๐‘—1 + c2๐‘—2 + โ‹ฏ + c๐‘๐‘—๐‘

{c11, c12, โ‹ฏ , c1๐ฟ} {c21, c22, โ‹ฏ , c2๐ฟ} {c๐‘1, c๐‘2, โ‹ฏ , c๐‘๐ฟ}

Source codebook 1 Source codebook 2 Source codebook M

  • Approximate x by the addition of M vectors
  • Code representation: ๐‘—1๐‘—2 โ‹ฏ ๐‘—๐‘
  • length: ๐‘log๐ฟ

โ‹ฏ

slide-48
SLIDE 48

5/6/2015

Connection to product quantization

  • Concatenation in product quantization

x โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘ = p1๐‘—1 โ‹ฎ + p2๐‘—2 โ‹ฎ + โ‹ฏ + โ‹ฎ p๐‘๐‘—๐‘

slide-49
SLIDE 49

5/6/2015

Connection to product quantization

  • Concatenation in product quantization = addition

x โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘ = p1๐‘—1 โ‹ฎ + p2๐‘—2 โ‹ฎ + โ‹ฏ + โ‹ฎ p๐‘๐‘—๐‘

slide-50
SLIDE 50

5/6/2015

Connection to product quantization

  • Concatenation in product quantization = addition

x โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘ = p1๐‘—1 โ‹ฎ + p2๐‘—2 โ‹ฎ + โ‹ฏ + โ‹ฎ p๐‘๐‘—๐‘

slide-51
SLIDE 51

5/6/2015

Connection to product quantization

  • Concatenation in product quantization = addition

x โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘ = p1๐‘—1 โ‹ฎ + p2๐‘—2 โ‹ฎ + โ‹ฏ + โ‹ฎ p๐‘๐‘—๐‘

slide-52
SLIDE 52

5/6/2015

Connection to product quantization

  • Concatenation in product quantization = addition
  • Composite quantization

x โ‰ˆ x = p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘ = p1๐‘—1 โ‹ฎ + p2๐‘—2 โ‹ฎ + โ‹ฏ + โ‹ฎ p๐‘๐‘—๐‘ x โ‰ˆ x = c1๐‘—1 + c2๐‘—2 + โ‹ฏ + c๐‘๐‘—๐‘

Product quantization is constrained composite quantization

slide-53
SLIDE 53

5/6/2015

Connection to Cartesian k-means

  • Concatenation in Cartesian k-means = addition

x โ‰ˆ x = R p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘ = R p1๐‘—1 โ‹ฎ + R p2๐‘—2 โ‹ฎ + โ‹ฏ + R โ‹ฎ p๐‘๐‘—๐‘

slide-54
SLIDE 54

5/6/2015

Connection to Cartesian k-means

  • Concatenation in Cartesian k-means = addition

x โ‰ˆ x = R p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘ = R p1๐‘—1 โ‹ฎ + R p2๐‘—2 โ‹ฎ + โ‹ฏ + R โ‹ฎ p๐‘๐‘—๐‘

slide-55
SLIDE 55

5/6/2015

Connection to Cartesian k-means

  • Concatenation in Cartesian k-means = addition
  • Composite quantization

x โ‰ˆ x = R p1๐‘—1 p2๐‘—2 โ‹ฎ p๐‘๐‘—๐‘ = R p1๐‘—1 โ‹ฎ + R p2๐‘—2 โ‹ฎ + โ‹ฏ + R โ‹ฎ p๐‘๐‘—๐‘ x โ‰ˆ x = c1๐‘—1 + c2๐‘—2 + โ‹ฏ + c๐‘๐‘—๐‘

Cartesian k-means is constrained composite quantization

slide-56
SLIDE 56

5/6/2015

  • Composite quantization
  • Generalizing product quantization and Cartesian k-means
  • Advantages
  • More flexible codebooks
  • More accurate data approximation
  • Higher search accuracy
  • Search efficiency?
  • Depend on the efficiency of the distance computation

Composite quantization

Product quantization: Coordinate aligned space partition Cartesian k-means: Rotated coordinate aligned space partition Composite quantization: Flexible space partition

slide-57
SLIDE 57

5/6/2015

Approximate distance computation

  • Recall the data approximation
  • x โ‰ˆ

x = ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

  • Approximate distance to the query q
  • q โˆ’ x 2

2 โ‰ˆ

q โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

Time-consuming

slide-58
SLIDE 58

5/6/2015

Approximate distance computation

q โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

= ๐‘›=1

๐‘

q โˆ’ c๐‘›๐‘—๐‘›(x) 2

2 โˆ’ ๐‘ โˆ’ 1

q 2

2 + ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

Expanded into three terms

slide-59
SLIDE 59

5/6/2015

Approximate distance computation

q โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

= ๐‘›=1

๐‘

q โˆ’ c๐‘›๐‘—๐‘›(x) 2

2 โˆ’ ๐‘ โˆ’ 1

q 2

2 + ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

๐‘ƒ(๐‘) additions Implemented with a pre-computed distance lookup table Distance lookup table: Store the distances from source codebook elements to q

slide-60
SLIDE 60

5/6/2015

Approximate distance computation

q โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

= ๐‘›=1

๐‘

q โˆ’ c๐‘›๐‘—๐‘›(x) 2

2 โˆ’ ๐‘ โˆ’ 1

q 2

2 + ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

Constant ๐‘ƒ(๐‘) additions

slide-61
SLIDE 61

5/6/2015

Using a pre-computed dot product lookup table

Approximate distance computation

q โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

= ๐‘›=1

๐‘

q โˆ’ c๐‘›๐‘—๐‘›(x) 2

2 โˆ’ ๐‘ โˆ’ 1

q 2

2 + ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

O(๐‘2) additions ๐‘ƒ(๐‘) additions Dot product lookup table: Store the dot products between codebook elements Constant

slide-62
SLIDE 62

5/6/2015

Approximate distance computation

q โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

= ๐‘›=1

๐‘

q โˆ’ c๐‘›๐‘—๐‘›(x) 2

2 โˆ’ ๐‘ โˆ’ 1

q 2

2 + ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

๐‘ƒ(๐‘2): still expensive

๐‘ƒ(๐‘) additions O(๐‘2) additions Constant

slide-63
SLIDE 63

5/6/2015

Approximate distance computation

q โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

= ๐‘›=1

๐‘

q โˆ’ c๐‘›๐‘—๐‘›(x) 2

2 โˆ’ ๐‘ โˆ’ 1

q 2

2 + ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

If constant

๐‘ƒ(๐‘) additions Constant

slide-64
SLIDE 64

5/6/2015

Approximate distance computation

q โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

= ๐‘›=1

๐‘

q โˆ’ c๐‘›๐‘—๐‘›(x) 2

2 โˆ’ ๐‘ โˆ’ 1

q 2

2 + ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

If constant

Computing this is enough for search ๐‘ƒ(๐‘) additions Constant

slide-65
SLIDE 65

5/6/2015

Formulation

q โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

= ๐‘›=1

๐‘

q โˆ’ c๐‘›๐‘—๐‘›(x) 2

2 โˆ’ ๐‘ โˆ’ 1

q 2

2 + ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

Subject to the third term is a constant Minimize quantization error: x โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2

Constant

slide-66
SLIDE 66

5/6/2015

Formulation

  • Constrained formulation

min

C๐‘› , ๐‘—๐‘› x ,๐œ— x x โˆ’ ๐‘›=1 ๐‘

c๐‘›๐‘—๐‘› x

2 2

๐‘ก. ๐‘ข. ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x)

๐‘ˆ

c๐‘š๐‘—๐‘š(x) = ๐œ—

Minimize quantization error for search accuracy Constant constraint for search efficiency

slide-67
SLIDE 67

5/6/2015

Connection to PQ and CKM

  • Constrained formulation

min

C๐‘› , ๐‘—๐‘› x ,๐œ— x x โˆ’ ๐‘›=1 ๐‘

c๐‘›๐‘—๐‘› x

2 2

๐‘ก. ๐‘ข. ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x)

๐‘ˆ

c๐‘š๐‘—๐‘š(x) = ๐œ—

Minimize quantization error for search accuracy Constant constraint for search efficiency

slide-68
SLIDE 68

5/6/2015

Connection to PQ and CKM

  • Constrained formulation

min

C๐‘› , ๐‘—๐‘› x ,๐œ— x x โˆ’ ๐‘›=1 ๐‘

c๐‘›๐‘—๐‘› x

2 2

๐‘ก. ๐‘ข. ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x)

๐‘ˆ

c๐‘š๐‘—๐‘š(x) = ๐œ—

  • Product quantization and Cartesian k-means: suboptimal solutions of
  • ur approach

Non-overlapped space partitioning Codebooks are mutually orthogonal

๐‘›โ‰ ๐‘š

c๐‘›๐‘—๐‘›(x)

๐‘ˆ

c๐‘š๐‘—๐‘š(x) = ๐œ— Product quantization and Cartesian k-means Minimize quantization error for search accuracy Constant constraint for search efficiency

slide-69
SLIDE 69

5/6/2015

Formulation

  • Constrained formulation

min

C๐‘› , ๐‘—๐‘› x ,๐œ— x x โˆ’ ๐‘›=1 ๐‘

c๐‘›๐‘—๐‘› x

2 2

๐‘ก. ๐‘ข. ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x)

๐‘ˆ

c๐‘š๐‘—๐‘š(x) = ๐œ—

  • Transformed to unconstrained formulation
  • Add the constraints into the objective function

๐œš {C๐‘› , ๐‘—๐‘›(x) , ๐œ—) = x x โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2 + ๐œˆ x ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x) โˆ’ ๐œ—

2 Minimize quantization error for search accuracy Constant constraint for search efficiency

slide-70
SLIDE 70

5/6/2015

Optimization

  • Unconstrained formulation

๐œš {C๐‘› , ๐‘—๐‘›(x) , ๐œ—) = x x โˆ’ ๐‘›=1

๐‘

c๐‘›๐‘—๐‘› x

2 2 + ๐œˆ x ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x) ๐‘ˆ

c๐‘š๐‘—๐‘š(x) โˆ’ ๐œ—

2

  • Alternative optimization between C๐‘› , ๐‘—๐‘›(x) , ๐œ—

Selected by validation Distortion error Constraints violation

slide-71
SLIDE 71

5/6/2015

Alternative optimization

  • Update {๐‘—๐‘›(x)}
  • Iteratively alternative optimization, fixing ๐‘—๐‘š(x) lโ‰ ๐‘›, update ๐‘—๐‘›(x)
  • Update ๐œ—
  • Closed form solution,๐œ— =

1 #{x} x ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘› x ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

  • Update {C๐‘›}
  • L-BFGS algorithm
slide-72
SLIDE 72

5/6/2015

Complexity

  • Update {๐‘—๐‘›(x)}
  • Iteratively alternative optimization, fixing ๐‘—๐‘š(x) lโ‰ ๐‘›, update ๐‘—๐‘›(x)
  • ๐‘ƒ(๐‘๐ฟ๐‘’๐‘ˆ๐‘’)
  • Update ๐œ—
  • Closed form solution,๐œ— =

1 #{x} x ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘› x ๐‘ˆ

c๐‘š๐‘—๐‘š(x)

  • ๐‘ƒ(๐‘‚๐‘2)
  • Update {C๐‘›}
  • L-BFGS algorithm
  • ๐‘ƒ(๐‘‚๐‘๐‘’๐‘ˆ๐‘š๐‘ˆ

๐‘‘)

Convergency?

slide-73
SLIDE 73

5/6/2015

Convergence

1MSIFT, 64 bits Converge about 10~15 iterations

slide-74
SLIDE 74

5/6/2015

Outline

  • Introduction
  • Composite quantization
  • Experiments
slide-75
SLIDE 75

5/6/2015

Experiments on ANN search

  • Datasets
  • 1 million of 128D SIFT vectors, 10000 queries
  • 1 million of 960D GIST vectors, 1000 queries
  • 1 billion of 128D SIFT vectors, 1000 queries
  • Evaluation
  • Recall@R
  • the fraction of queries for which the ground-truth Euclidean nearest neighbor is in the R

retrieved items

slide-76
SLIDE 76

5/6/2015

Search pipeline

Query q Code of database vector x Distance between q and x Output the nearest vectors Repeated for n database vectors Source codebooks Distance tables

(between query and codebook elements)

slide-77
SLIDE 77

5/6/2015

Comparison on 1M SIFT and 1M GIST

slide-78
SLIDE 78

5/6/2015

Comparison on 1M SIFT and 1M GIST

Our:71.59% CKM:63.83% Recall@10: 64 btis

slide-79
SLIDE 79

5/6/2015

Comparison on 1M SIFT and 1M GIST

Our:71.59% CKM:63.83% Relatively small improvement on 1M GIST might be that CKM has already achieved large improvement

slide-80
SLIDE 80

5/6/2015

Comparison on 1M SIFT and 1M GIST

Our:71.59% 64 bits ITQ: 53.95% 128 bits ITQ without asymmetric distance underperformed ITQ with asymmetric distance Our approach with 64 bits outperforms (A) ITQ with 128 bits, with slightly smaller search cost

slide-81
SLIDE 81

5/6/2015

Comparison on 1B SIFT

slide-82
SLIDE 82

5/6/2015

Comparison on 1B SIFT

Our:70.12% CKM:64.57% Recall@100:

slide-83
SLIDE 83

5/6/2015

Average query time

Average query time

slide-84
SLIDE 84

5/6/2015

Application to object retrieval

  • Two datasets
  • INRIA Holidays contains 500 queries and 991 corresponding relevant images
  • UKBench contains 2550 groups of 4 images each
  • Results

MAP on the holiday dataset Scores on the UKBench dataset

slide-85
SLIDE 85

5/6/2015

Discussion

  • The effect of ๐œ—
  • min ๐‘ฆ ๐‘ฆ โˆ’

๐‘ฆ 2

2 subject to ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(๐‘ฆ) ๐‘ˆ

c๐‘š๐‘—๐‘š(๐‘ฆ) = ๐œ—

  • Indicate the dictionaries are mutual orthogonal like splitting the space

๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(๐‘ฆ)

๐‘ˆ

c๐‘š๐‘—๐‘š(๐‘ฆ) = 0

Search performance with learnt ๐œ— is better, since learning ๐œ— is more flexible

(R,T) recall@R

slide-86
SLIDE 86

5/6/2015

Discussion

  • The effect of translation
  • min ๐‘ฆ ๐‘ฆ โˆ’

๐‘ฆ 2

2 subject to ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(๐‘ฆ) ๐‘ˆ

c๐‘š๐‘—๐‘š(๐‘ฆ) = ๐œ—

  • search performance doesnโ€™t change too much

๐‘ฆ ๐‘ฆ โˆ’ ๐‘ข โˆ’ ๐‘ฆ 2

2

recall@R (R,T)

Contribution of the offset is relatively small compared with the composite quantization

slide-87
SLIDE 87

5/6/2015

Extension (CVPR15)

  • Constrained formulation

min

C๐‘› , ๐‘—๐‘› x ,๐œ— x x โˆ’ ๐‘›=1 ๐‘

c๐‘›๐‘—๐‘› x

2 2

๐‘ก. ๐‘ข. ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x)

๐‘ˆ

c๐‘š๐‘—๐‘š(x) = ๐œ— ๐‘› C๐‘› 1 โ‰ค ๐‘ˆ

Minimize quantization error for search accuracy Constant constraint for search efficiency Sparsity constraint for precomputation efficiency

slide-88
SLIDE 88

5/6/2015

Extension (CVPR15)

  • Constrained formulation

min

C๐‘› , ๐‘—๐‘› x ,๐œ— x x โˆ’ P ๐‘›=1 ๐‘

c๐‘›๐‘—๐‘› x

2 2

๐‘ก. ๐‘ข. ๐‘›โ‰ ๐‘š c๐‘›๐‘—๐‘›(x)

๐‘ˆ

c๐‘š๐‘—๐‘š(x) = ๐œ— ๐‘› C๐‘› 1 โ‰ค ๐‘ˆ

Minimize quantization error for search accuracy Constant constraint for search efficiency Sparsity constraint for precomputation efficiency Dimension reduction

slide-89
SLIDE 89

5/6/2015

Multi-stage vector quantization

Vector quantization (1) Vector quantization (2) Residuals Vector quantization (M) Residuals Residuals โ€ฆโ€ฆ Database ๐‘Œ

slide-90
SLIDE 90

5/6/2015

Conclusion

  • Composite quantization
  • A compact coding approach for approximate nearest neighbor search
  • Joint optimization of search accuracy and search efficiency
  • State-of-the-art performance
slide-91
SLIDE 91

5/6/2015

A Survey on Learning to Hash

http://research.microsoft.com/~jingdw/pubs/lthsurvey.pdf

slide-92
SLIDE 92

5/6/2015

Call for papers

http://research.microsoft.com/~jingdw/cfp/CFP_TBDSI_BMD.pdf

slide-93
SLIDE 93

5/6/2015

Call for papers

http://research.microsoft.com/~jingdw/cfp/CFP_ICDM15WORKSHOP_BMD.pdf

slide-94
SLIDE 94

5/6/2015

Thanks Q&A

slide-95
SLIDE 95

5/6/2015

A distance preserving view of quantization

  • Quantization
  • Data approximation:

x โ‰ˆ x

  • Better search
  • If better distance preserving: q โˆ’

x 2 โ‰ˆ q โˆ’ x 2

  • Distance preserving view
  • Triangle inequality:

q โˆ’ x 2 โˆ’ q โˆ’ x 2 โ‰ค x โˆ’ x 2

  • Minimize the upper bound: x x โˆ’

x 2

2

q x x

slide-96
SLIDE 96

5/6/2015

A joint minimization view

q โˆ’ x 2 โˆ’ q โˆ’ x 2 โ‰ค x โˆ’ x 2

Triangle inequality

๐‘’ q, x = (ฮฃ๐‘›=1

๐‘

q โˆ’ c๐‘›๐‘—๐‘› x

2 2)1/2

๐‘’ q, x = ( q โˆ’ x 2

2 + ๐‘ โˆ’ 1

q 2

2)1/2

๐œ€ = ฮฃ๐‘›โ‰ ๐‘šc๐‘›๐‘—๐‘›(x)

๐‘ˆ

c๐‘š๐‘—๐‘š(x) x = ฮฃ๐‘›=1

๐‘

c๐‘›๐‘—๐‘›(๐‘ฆ)

Distortion Efficiency

๐‘’ q, x โˆ’ ๐‘’(q, x) โ‰ค x โˆ’ x 2 + |๐œ€|1/2

Generalized triangle inequality

slide-97
SLIDE 97

5/6/2015

A joint minimization view

min

C๐‘› , ๐‘—๐‘› x ,๐œ— ฮฃx x โˆ’

x 2

2

๐‘ก. ๐‘ข. ฮด = ๐œ—

Our formulation

Minimize distortion for search accuracy Constant constraint for search efficiency

๐‘’ q, x โˆ’ ๐‘’(q, x) โ‰ค x โˆ’ x 2 + |๐œ€|1/2

Generalized triangle inequality

Distortion Efficiency