Mais conteúdo relacionado
Semelhante a K-means hashing (CVPR'13) とハッシング周り (20)
Mais de Yusuke Uchida (20)
K-means hashing (CVPR'13) とハッシング周り
- 2. 背景
• 画像特徴
– SIFT: 128次元, GIST: 960 (384) 次元, FV/VLAD: ~数万次元
– 1M~1B枚レベルの画像検索とかしたいお…
– でも画像の特徴ベクトルそのものを利用すると
メモリに乗らないし類似検索もおそいお…
– だからコンパクトなバイナリコードに変換するお!(テンプレ)
(面白いけど応用を気にしている人があんまいない印象)
• バイナリ化のメリット
– コンパクト+高速検索 (e.g., SSE 4.2 POPCNT)
(参考)ビットを数える
http://www.slideshare.net/takesako/x86x64-sse42-popcnt
• 単純にユークリッド距離を近似することが目的の手法と
supervisedでクラス分類を意識し距離学習も行う手法がある
- 3. Hashing
"Similarity search in high dimensions via hashing," VLDB'99. (LSH)
"Spectral Hashing," NIPS'08. (SH)
"Learning to Hash with Binary Reconstructive Embeddings," NIPS'09. (BRE)
"Locality Sensitive Binary Codes from Shift-Invariant Kernels," NIPS'09. (SIKH)
"Kernelized Locality-Sensitive Hashing for Scalable Image Search," ICCV'09. (KLSH)
"Sequential Projection Learning for Hashing with Compact Codes," ICML'10. (USPLH)
"Self-Taught Hashing for Fast Similarity Search," SIGIR'10.
"CARD: Compact And Real-time Descriptors," ICCV'11.
"Complementary Hashing for Approximate Nearest Neighbor Search," ICCV'11.
"Coherency Sensitive Hashing," ICCV'11.
"Hashing with Graphs," ICML'11. (AGH)
"Minimal Loss Hashing for Compact Binary Codes," ICML'11.
"Random Maximum Margin Hashing," CVPR'11.
"Iterative Quantization: A Procrustean Approach to Learning Binary Codes," CVPR'11. (ITQ)
"LDAHash: Improved Matching with Smaller Descriptors," PAMI'12. (LDAH)
"Isotropic Hashing," NIPS'12.
"Supervised Hashing with Kernels," CVPR'12.
"Spherical Hashing," CVPR'12.
"Multidimensional Spectral Hashing," ECCV'12.
"Double-Bit Quantization for Hashing," AAAI'13.
"Variable Bit Quantisation for LSH," ACL'13.
"Hash Bit Selection: a Unified Solution for Selection Problems in Hashing," CVPR'13.
"Compressed Hashing," CVPR'13.
"Inductive Hashing on Manifolds," CVPR'13.
"Learning Binary Codes for High-Dimensional Data Using Bilinear Projections," CVPR'13.
"K-means Hashing: an Affinity-Preserving Quantization Method for Learning Binary Compact Codes," CVPR'13.
↓好きなキーワードを入れてね!
- 4. Hashingの基本
"Semi-Supervised Hashing for Large Scale Search," TPAMI'12.
sgn(Wx - t) により b-bit バイナリコードを求める手法が多い
d次元入力ベクトル
射影行列 (b x d) 定数項
↑この射影行列をいかに求めるかに帰着
基本戦略は変換後のバイナリコード間のハミング距離に
元の特徴ベクトル間の距離を反映させる
※SHのようにlaplacian eigenmaps等で
射影した空間でHashingするものも多い
e.g., AGH http://www.slideshare.net/beam2d/rinko2011-web
- 5. k-means hashingの位置づけ (1)
00 01 10 11
00 0 0.6 0.8 0.8
01 0.6 0 0.9 0.7
10 0.8 0.9 0 0.8
11 0.8 0.7 0.8 0
• 入力ベクトルを代表ベクトルのIDに符号化
• 代表ベクトル間の距離をLookup tableに保持
• Lookup tableの参照のみで2つの符号間の
距離を算出可能
Lookup table
- 6. k-means hashingの位置づけ (2)
• ベクトル量子化と同様に入力ベクトルを代表ベクトルに割り当て
• 各代表ベクトルにバイナリコードが割り当てられており、
そのバイナリコードに符号化する
• クエリベクトルも同様にバイナリ化、ハミング距離で類似探索
• ベクトル量子化は量子化誤差の観点で優秀&POPCNT高速探索
符号化効率 距離計算速度
- 8. k-means hashingのコンセプト
オリジナルベクトル
x, y 間の距離
xを量子化した
ベクトル
xが量子化された
代表ベクトルのID
ベクトル量子化
k-means hashing
スケーリング定数 i, j番目の代表ベクトルに割り当てられた
バイナリコード間のハミング距離
代表ベクトルID→バイナリコードへの割り当て
(=permutation )を求める問題へ帰着
- 10. Affinity preserving k-means (1)
ハミング距離で近似することを考慮したk-means
通常のk-meansのコスト関数
Affinityに関する項を追加
Affinity preserving k-meansのコスト関数
(λ = 0 で通常のk-means)
ni: 代表ベクトル ci に割り当てられた
訓練ベクトルの数
- 11. Affinity preserving k-means (2)
1) Assignment step: {ci} を固定し、i(x) を最適化
k-meansと同様に最近傍の代表ベクトルに割り当て
2) Update step: i(x) を固定し、{ci} を最適化
Affinity項は {ci} が相互に関係しているので順に最適化
{ci}, i(x), s の初期化はPCA-Hashingを用いる
制約なし最適化、準ニュートン法で解く(matlabでfminunc!)
50~200
繰り返し
GIST, b=8
で20分
現実的には b≦8、それ以上のコードは直積量子化を利用
- 14. SIFT1M dataset
KMH: k-means hashing
ITQ: iterative quantization
MLH: minimal loss hashing
SH: spectral hashing
PCAH: PCA hashing
LSH: locality sensitive hashing
KMH
PCAH
MLH
KMH
LSH
• 32bitでPCAHが良い(SHも)
• 128bitではITQとLSHが良い
(LSHやSKLSHは直交条件がないので
ビットを増やすほど精度向上)
ITQ
SH
- 15. GIST1M dataset
KMH: k-means hashing
ITQ: iterative quantization
MLH: minimal loss hashing
SH: spectral hashing
PCAH: PCA hashing
LSH: locality sensitive hashing
• KMH, MLH, ITQが良い
• PCAHが32bitでも悪い
(固有値(分散)が大きく違うため?)
KMH
MLH
ITQ
PCAH
- 17. 参考:直積空間の分割の最適化
“Optimized Product Quantization for Approximate Nearest Neighbor Search,” CVPR’13.
“Cartesian k-means,” CVPR’13.
どちらもアプローチはほぼ同じ(どちらもITQにinspireされている?)
特徴ベクトルを射影する回転行列と直積量子化コードブックを最適化
1) Rを固定して直積量子化のコードブックを最適化
2) 直積量子化コードブックを固定してRを最適化
http://www.robots.ox.ac.uk/~vgg/rg/slides/ge__cvpr2013__optimizedpq.pdf
- 18. 参考:Asymmetric Hamming Distance
• バイナリコード間の距離の代わりに
クエリのオリジナルの特徴ベクトル(量子化前)と
DB内のバイナリコードの距離を計算
• 直積量子化でも利用されている(こちらのほうが自然)
"Asymmetric Hamming Embedding," ICMR'11.
"Asymmetric Distances for Binary Embeddings," CVPR'11.
"Product Quantization for Nearest Neighbor Search," TPAMI'11.