# Fast Image Search with Locality-Sensitive Hashing and Homogeneous Kernels Map

Authors: Jun-yi Li; Jian-hua Li
Journal: The Scientific World Journal
 (2015)

---

## Abstract

Fast image search with efficient additive kernels and kernel locality-sensitive hashing has been proposed. As to hold the kernel functions, recent work has probed methods to create locality-sensitive hashing, which guarantee our approach’s linear time; however existing methods still do not solve the problem of locality-sensitive hashing (LSH) algorithm and indirectly sacrifice the loss in accuracy of search results in order to allow fast queries. To improve the search accuracy, we show how to apply explicit feature maps into the homogeneous kernels, which help in feature transformation and combine it with kernel locality-sensitive hashing. We prove our method on several large datasets and illustrate that it improves the accuracy relative to commonly used methods and make the task of object classification and, content-based retrieval more fast and accurate.


---

## Body

## 1. Introduction

In Web 2.0 applications era, we are experiencing the growth of information and confronted with the large amounts of user-based content from internet. As each one can publish and upload their information to the internet, it is urgent for us to handle the information brought by these people from internet. In order to organize and be close to these vision data from Internet, it has caused considerable concern of people. Therefore, the task of fast search and index for large video or image databases is very important and urgent for multimedia information retrieval such as vision search especially now the big data in some certain domains such as travel photo data from the website and social network image data or other image archives.With the growth of vision data, we focus on two important aspects of problem including nearest neighbor search and similarity metric learning. For metric learning, many of the researchers have proposed some algorithms such as Information-Theoretic metric learning [1]. As for nearest neighbors search, the most common situation and task for us is to locate the most similar image from an image database. Among all the methods, given the similarity of example and query item, the most common method is to find all the vision data among the vision database and then sort them. However time complexity of this algorithm is too large and also impractical. When we handle image or video data, especially, this complexity will not be calculated, because it is very difficult for us to compute the distance of two items in higher dimensional space and also vision datum is sparse, so we cannot complete it by limited time.Many researchers believe that linear scanning can solve this problem; although we believe it is a common approach and not suitable for computing in large-scale datasets, it promotes the development of ANN. LSH was used in ANN algorithms. To get fast query response for high-dimensional space input vectors [1–5], when using LSH, we will sacrifice the accuracy. To assure a high probability of collision for similar objects, randomized hash function must be computed; this is also referred to in many notable locality-sensitive hashing algorithms [6, 7].Although, in object similarity search task, the LSH has played an important role, some other issues and problems have been neglected. In image retrieval, recognition, and search tasks, we find that they are very common:(A)
in the sample feature space, traditionally LSH approaches can only let us get a relatively high collision probability for items nearby. As a lot of vision datasets contained much rich information, we can find that the category tags are attached to YouTube and Flickr data and the class labels are attached to Caltech-101 images. However the low-level and high-level of vision samples have great gap, which means that the gap low-level features and high-level semantic information exist. To solve this problem, we intend to utilize the side additional information for constructing hash table;
(B)
As to manipulate nonlinear data which is linear inseparable, we commonly use kernel method in vision task because of its popularity. For instance, in vision model, objects are often modeled as BOF and kernel trick is an important approach in classifying these data from low-dimension space to high-dimension space. However, how to create hash table in kernel spaces is a tough problem for us.To verify our idea, we did several experiments in object search task. For example, we show our results on the Caltech-101 [8] dataset and demonstrate that our approach is superior to the existing hashing methods as our proposed algorithm.In order to test our algorithm performance on dataset, we design some experiments on certain visual task such as Caltech-101 [8] and demonstrate that the performance of algorithm in our paper is beyond the traditional LSH approaches on the dataset, as hash functions can be calculated beyond many kernels. Arbitrary kernel in ANN is suitable in our scheme; actually we can find that a lot of similarity hashing functions can be accessed in the task of vision search tasks based on content retrieval.


## 2. Homogeneous Kernel

In our paper, we mainly focus on some similar kernels like intersection, Jensen-Shannon, Hellinger’s, andχ
2 kernels. In the fields of machine learning and vision search, we often use these kernels as learning kernels. These kernels have two common attributes: being homogeneous and additive. The idea of kernel signature has been smoothly connected to these kernels in this section. Meanwhile we can use pure functions to represent these kernels. Also these attributes will be applied in Section 3 to obtain kernel feature maps. Through the kernel feature map, we can get their approximate expression.Homogeneous Kernels. A kernel k
l
:
R
0
+
×
R
0
+
→
R is γ-homogenous if(1)
∀
m
≥
0
:
k
l
m
a
,
m
b
=
m
γ
k
l
a
,
b
.When γ
=
1, we believe that k
l
(
m
a
,
m
b
) is homogeneous. Let m
=
1
/
a
b; we can obtain a γ-homogeneous kernel and we can also write the formula as(2)
k
l
a
,
b
=
m
-
γ
k
l
(
m
a
,
m
b
)
=
a
b
γ
/
2
k
l
b
a
,
a
b
=
a
b
γ
/
2
κ
log
⁡
b
-
log
⁡
a
.Here the pure function(3)
κ
(
λ
)
=
k
l
(
e
λ
/
2
,
e
-
λ
/
2
)
,
λ
∈
Ris called the kernel signature.Stationary Kernels. A kernel k
s
:
R
0
+
×
R
0
+
→
R is called stationary kernels if(4)
∀
l
∈
R
:
k
s
(
l
+
a
,
l
+
b
)
=
k
s
(
a
,
b
)
.Let l
=
-
(
a
+
b
)
/
2; the k
s
(
a
,
b
) is represented as(5)
k
s
a
,
b
=
k
s
(
l
+
a
,
l
+
b
)
=
k
s
b
-
a
2
,
a
-
b
2
=
κ
b
-
a
,
(6)
κ
λ
=
k
s
λ
2
,
-
λ
2
,
λ
∈
R
.Here we call formula (6) kernel feature.In the field of machine learning or computer vision, most of the homogeneous kernels are composed of the Jensen-Shannon, intersection,χ
2, and Hellinger’s kernels. So we can also view them as additive kernels. In the next section, we will focus on these kernels and their kernel maps. Table 1 shows the details [9].Table 1
Common kernels, signature, and their feature maps.
Kernel
k
(
a
,
b
)
Signatureκ
(
θ
)
κ
(
w
)
Featureψ
ω
(
a
)
Hellinger’s
a
b
1
δ
(
ω
)
a
χ
2
2
a
b
a
+
b
sech
⁡
(
θ
2
)
sech
⁡
(
π
ω
)
e
i
w
log
⁡
a
a
sech
⁡
(
π
ω
)
Intersection
min
⁡
{
a
,
b
}
e
-
|
θ
|
/
2
2
π
1
1
+
4
ω
2
e
i
w
log
⁡
a
2
a
π
1
1
+
4
ω
2
JS
a
2
log
2
⁡
a
+
b
a
+
b
2
log
2
⁡
a
+
b
b
e
θ
/
2
2
log
2
⁡
(
1
+
e
-
θ
)
+
e
-
θ
/
2
2
log
2
⁡
(
1
+
e
θ
)
2
log
⁡
4
sech
⁡
(
π
ω
)
1
+
4
ω
2
e
i
w
log
⁡
a
2
log
⁡
4
sech
⁡
(
π
ω
)
1
+
4
ω
2χ
2
Kernel. We define k
(
a
,
b
)
=
2
a
b
/
(
a
+
b
) as the χ
2 kernel [10, 11]. Here the χ
2 distance is then defined as D
2
(
a
,
b
)
=
χ
2
(
a
,
b
).Jensen-Shannon (JS) Kernel. We define k
(
a
,
b
)
=
(
a
/
2
)
log
⁡
2
⁡
(
a
+
b
)
/
a
+
(
b
/
2
)
lo
g
2
(
a
+
b
)
/
b as the JS kernel. Here the JS kernel distance D
2
(
a
,
b
) can be obtained by D
2
(
a
,
b
)
=
K
L
(
a
∣
(
a
+
b
)
/
2
)
+
K
L
(
b
∣
(
a
+
b
)
/
2
), where we import the concept of Kullback-Leibler divergence computed by K
L
(
a
∣
b
)
=
∑
l
=
1
d
a
l
lo
g
2
(
a
l
/
b
l
).Intersection Kernel. We defined k
(
a
,
b
)
=
min
⁡
{
a
,
b
} as the intersection kernel [12]. The distance metric D
2
(
a
,
b
)
=
a
-
b
1 is l
1 distance between variants a and b.Hellinger’s Kernel. We defined k
(
a
,
b
)
=
a
b as the Hellinger’s kernel and specified distance metric D
2
(
a
,
b
)
=
a
-
b
2
2 as Hellinger’s distance between variants a and b. The function expression κ
(
λ
)
=
1 is the signature of the kernel, which is constant.γ
-
Homogeneous Parameters. In previous research paper, we can see that the homogeneous kernels are used by parameters γ
=
1 and γ
=
2. When γ
=
2, the kernel becomes k
(
a
,
b
)
=
a
b. Now, in our paper, we can derive the γ
-homogeneous kernel by formula (2).


## 3. Homogeneous Kennel Map

When handling low-dimensional data which is inseparable, we should create kernel feature mapψ
(
x
) for the kernel so that we can map our input data information in low-dimensional space to relatively high-dimensional (Hilbert) information space with ·
,
·:(7)
∀
a
,
b
∈
R
D
:
K
(
a
,
b
)
=
ψ
(
a
)
,
ψ
(
b
)
.In order to compute the feature maps and get approximate kernel feature maps expression for the homogeneous kernels, we should use Bochner’s theorem by expanding the configuration ofγ-homogeneous expression. Here we notice that if a homogeneous kernel is Positive Definite [13], its signature will also be Positive Definite expression. The assumption condition is suitable for a stationary kernel. So, depending on formulae (2) and Bochner’s theorem (9), we can derive the k
(
a
,
b
) and closed feature map.We can compute the kernel density and feature map closed form [9] for most machine learning kernels. Table 1 illustrates the results. Consider(8)
k
a
,
b
=
a
b
θ
/
2
∫
-
∞
+
∞
e
-
i
w
λ
κ
(
ω
)
d
ω
,
θ
=
log
⁡
b
a
=
∫
-
∞
+
∞
e
-
i
w
log
⁡
a
a
θ
κ
ω
∗
e
-
i
w
log
⁡
b
b
θ
κ
ω
d
ω
,
(9)
ψ
w
a
=
e
-
i
w
log
⁡
a
a
γ
κ
ω
.


## 4. Kernelized Locality-Sensitive Hashing

To create and conduct the data association, we take the approach of Kernelized LSH [14] which is also a hash table-based algorithm. KLSH is proposed based on LSH algorithm, which is more efficient and accurate for query search and matching. When searching the input query, the KLSH approach can quickly locate the possible similar and nearest neighbor items in the hash table and match it. In addition, KLSH has another characteristic: traditional LSH methods can only find a part of hashes in the kernel space, while KLSH can locate all the possible hash tables in kernel space. Moreover KLSH has been applied in the vision search tasks by large scale datasets such as Tiny Image and other datasets [14].Similar to LSH, constructing the hash functions for KLSH has been the key problem for us. That means if we intend to compute the collision probabilities of input query and the database points, we should compute the extent of similarity between them in the database as proposed by [15].KLSH Principle. Any locality-sensitive hashing algorithm is based on the probability of distribution of hash function clusters. So we should compute the collision probability of a bundle of points, for example, m and n:(10)
P
r
h
m
=
h
n
=
sim
m
,
n
.We can also view the problem as the issue of computing the similarity of objects betweenm and n. Here sim
(
m
,
n
) in the algorithm is the measure function of calculating the similarity, while h
(
m
) and h
(
n
) are randomly selected from the hash function cluster H. The instinct beyond this is that we find the fact that m and n will collide in the same hash bucket. So those objects which are significantly similar will be more possible to be memorized in the hash table and this eventually results in confliction [1].We can derive the similarity function expression according to the vector inner product:(11)
sim
m
,
n
=
m
T
n
.In [15, 16], the definition of LSH function has been extended from formula (10) as(12)
h
r
→
(
m
)
=
1
,
if
r
→
T
m
≥
0
,
0
,
else
.Here we create a random hyper plane vector r
→. The distribution of r
→ fit has a zero-mean multi-Gaussian N
(
0
,
Σ
p
) distribution. The dimensionality of r
→ is the same with the input vector m. This demonstrates that the statistical characteristic of input vector is uniquely matched with each hash function. Meanwhile this verification has been detailedly reported in the LSH attribute in [17]. When we project on a point m, actually the sigh function we obtain in this process is a hash function and then we repeat it k times; a couple of hashes can be created. We can also call this couple of hashes hash bucket. The hash bucket can be formed as (13)
g
m
=
h
1
m
,
…
,
h
t
m
,
…
,
h
k
m
.From (13), we can see that, after repeating k times, we can get one column of hash bucket (14); then repeating b times, we can finally obtain the hash bucket g
(
m
):(14)
g
j
m
=
h
1
m
,
…
,
h
t
m
,
…
,
h
k
m
1
<
j
<
b
.When given the value of b, we can get all the the hash functions located in the bucket; we can see the following:(15)
g
m
=
h
1,1
r
→
m
h
2,1
r
→
m
⋯
h
s
,
1
r
→
m
⋯
h
t
,
1
r
→
m
⋮
⋮
⋮
⋮
⋮
⋮
h
1
,
j
r
→
p
h
2
,
j
r
→
m
⋯
h
s
,
j
r
→
m
⋯
h
t
,
j
r
→
m
⋮
⋮
⋮
⋮
⋮
⋮
h
1
,
b
r
→
m
h
2
,
b
r
→
m
⋯
h
s
,
b
r
→
m
⋯
h
t
,
b
r
→
m
,
1
<
j
<
b
;
1
<
s
<
t
.Due to the fact that we compute the similarity measure function in high-dimensional kernel space, the similarity function can also be extended and written as(16)
sim
m
i
,
m
j
=
κ
m
i
,
m
j
=
ϕ
m
i
T
ϕ
m
j
.In formula (16), we use kernel function ϕ
(
m
) to construct κ
m
i
,
m
j to complete the kernel mapping for the points of m
i and m
j. And ϕ
(
m
i
)
T
ϕ
(
m
j
) is a product of projection on hash function from the R space. The problem is that nothing is known about the data while in kernel space to generate r
→ from N
(
0
,
Σ
p
). Therefore, in order to construct the hash function, r
→ needs to be created so that we can quickly compute the r
→
T
ϕ
m function based on the kernel. Similar to normal r
→
T, we could use only the kernel of ϕ
(
m
) to approximately compute the function of r
→
T
ϕ
(
m
). We should select a subset of database to construct r
→. By the large number of central limit theory, if we intend to choose parts of database items from the whole database to form the dataset S, the sample of kernel data must be satisfied by the distribution with mean μ and variance Σ. The variable z
a can be written as(17)
z
a
=
1
k
∑
i
∈
s
ϕ
m
i
.With the growth of variablea, the theory tells us that the vector z
~
a
=
t
(
z
a
-
μ
) has also been satisfied by the distribution of normal Gaussian.We used the whitening transform to obtainr
→:(18)
r
→
=
Σ
-
1
/
2
z
~
a
.The LSH function has been yielded:(19)
h
(
ϕ
(
m
)
)
=
1
,
if
ϕ
m
T
Σ
-
1
/
2
z
~
a
≥
0
,
0
,
else
.As analyzed above, we use kernel function to represent the database data; then the statistical data like variance and mean are uncertain. If we intend to estimate and calculate μ and Σ, we could sample the data from the database by KPCA and eigen decomposition in [18] and we let Σ
=
V
Λ
V
T  and Σ
-
1
/
2
=
V
Λ
-
1
/
2
V
T; therefore we can obtain the hash function h
(
ϕ
(
m
)
):(20)
h
ϕ
m
=
sign
ϕ
m
T
V
Λ
-
1
/
2
V
T
z
~
a
.From the above, we can see how to construct the hash function for the kernel matrix input vectors. In this case, we let the kernel matrix input be K
=
U
Ω
U
T  by decomposing the K matrix. Here Ω and Λ have the same nonzero eigenvalue; it is also viewed as another form of kernel matrix input. From [18], we compute the projection(21)
v
t
T
ϕ
(
m
)
=
∑
i
=
1
n
1
θ
t
u
t
(
i
)
ϕ
m
i
T
ϕ
(
m
)
.Here u
t and v
t are, respectively, the tth eigenvector of the kernel matrix and its covariance matrix.As mentioned before, we choosen data points from the database to form ϕ
(
m
i
); traversing all the t eigenvectors and conducting the computation yields(22)
h
ϕ
m
=
ϕ
m
T
V
Λ
-
1
/
2
V
T
z
~
a
=
∑
t
=
1
n
θ
t
v
t
T
ϕ
m
T
v
t
T
z
~
a
.Substituting (21) into (22) yields(23)
∑
t
=
1
n
θ
t
(
∑
i
=
1
n
1
θ
t
u
t
(
i
)
ϕ
m
i
T
ϕ
(
m
)
)
·
∑
i
=
1
n
1
θ
t
u
t
i
ϕ
m
i
T
z
~
a
.Simplifying (23) yields(24)
∑
i
=
1
n
∑
j
=
1
n
(
ϕ
m
i
T
ϕ
(
m
)
)
·
ϕ
m
j
T
z
~
a
∑
t
=
1
n
1
θ
t
u
t
i
u
t
j
.Since K
i
j
-
1
/
2
=
∑
k
=
1
n
1
/
θ
k
u
k
(
i
)
u
k
(
j
), we further simplify the (24) yields(25)
h
(
ϕ
(
m
)
)
=
∑
i
=
1
n
w
(
i
)
(
ϕ
m
i
T
ϕ
(
m
)
)
,where w
(
i
)
=
∑
j
=
1
n
K
i
j
-
1
/
2
ϕ
x
j
T
z
~
a.Through the above derived formulaw
(
i
) we can obtain r
→
=
∑
i
=
1
n
w
(
i
)
ϕ
(
x
i
) which obeys random Gaussian distribution, then we can substitute (17) into w
(
i
):(26)
w
i
=
1
a
∑
j
=
1
n
∑
l
∈
s
K
i
j
-
1
/
2
K
j
l
.We neglect the term of a, and finally the simplified w
(
i
) yields (27). e
s represents the unit vector for S.And therefore hash function for kernel input will finally be(27)
w
=
K
1
/
2
·
e
s
k
,
(28)
h
ϕ
m
=
sign
∑
i
=
1
n
w
i
κ
m
,
m
i
.
κ is the kernel mapping matrix for points m and m
i in space. After several iterations, the hash function will form a hash bucket.In order to get the suitable parameters in this process, we implement the query matching for several iterations. The detailed algorithm is illustrated finally in Algorithm1. Consider(29)
g
j
m
=
h
1
ϕ
m
,
h
2
,
j
ϕ
m
,
…
,
h
t
,
j
ϕ
m
,
…
,
h
k
,
j
ϕ
m
,
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
f
1
<
l
<
t
,
1
<
j
<
b
.Algorithm 1:KLSH algorithm.
(1) Process Data
(a) ObtainK matrix from database throughout the n points.
(b) Obtaine
s by randomly sampling a subset from the {
1,2
,
…
,
n
}
(c) Project onath subset to obtain h
a
(
ϕ
(
m
)
).
(d) Obtainw
=
K
1
/
2
·
e
s
/
a
(e) Projectw
(
i
) onto the points in kernel space
(f) Obtain hash bucketg
j
(
m
)
(2) Query Processing
(a) Obtain the same hash bucket in (29) from the database
(b) Use Ann search for query matching.


## 5. Experimental Result

In the experiment, we proposed the homogenous kernel-hashing algorithm and verified the high efficiency on the dataset. In our scheme, homogenous kernel-KLSH method makes it possible to get the unknown feature embeddings. We use these features to conduct vision search task to locate the most similar items in the database, and the neighbors we find in the task will give their scores on the tags. The method proved to be more effective and accurate than the linear scan search.In this part, we design and verify our algorithm on the Caltech-101 dataset in Figure1. Caltech-101 dataset is a benchmark on image recognition and classification, which has 101 categories objects and each category has about 100 images, so 10000 images totally. In recent years, many researchers have done useful research on this dataset such us proposing some important and useful image represent kernels [19]. Also there are many published papers that focused on this dataset, some of which are very valuable and significantly historic. For example, papers [20–22], respectively, state their contribution to the dataset. The author of [21] proposed the matching method for pyramid kernel of images histograms, while Berg [20] proposed and created the CORR kernel of image local feature using geometric blur for matching local image similarity.Figure 1
Datasets: Caltech-101 Example.In our paper, we apply our algorithm to complete the vision classification and similar search task. The platform of our benchmark is based on Intel 4 core 3.6 GHZ CPU and 16 GB of memory and 2 TB hard disk.We usedχ
2 kernel for γ-homogeneous kernel maps (γ
=
1
/
2) and applied the nonlinear RBF-
χ
2 kernel designed in [19, 23] to the SIFT-based local feature. Meanwhile we applied and learnt the homogenous kernel map beyond it. Compared with the nonlearnt kernel, our learnt kernel has been more accurate. And we use KNN classifier, respectively, for KLSH and linear scan to compute the accuracy of classification. We also compare it with CORR [24] and the result proves to be better than them, here we use 15 images per class for training task.From Figure2 we can see that the growth of parameters is closely related with accuracy. As is seen, the accuracy increased with the increase of n, while it has little relationship with the number of t and b. The value of (n
,
t
,
b) is chosen as n
=
300, b
=
300, t
=
30 as the best parameters through a series of experiments.Figure 2
Hashing using a RBF-χ
2 kernel for SIFT based on homogenous kernels χ
2
(
γ
=
1
/
2
). We choose t
=
30, n
=
300, and b
=
300 in our experiment.We find that the combination of these parameters can result in better performance than the large-scale dataset. Meanwhile it can be seen that our approach with homogenous kernel map has higher accuracy than CORR-KLSH with metric learning [25].Figure3 illustrates that our method is superior to other existing approaches [25–28] tested on this dataset. Comparing with other kernel classifiers, our classifier with RBF-χ
2 kernel for local features performs better. In Table 2 we can see that the result of ours has higher accuracy with T
=
15 and T
=
30 than other papers’ results including better than [24] which obtains the result by 61% for T
=
15 and 69.6% for T
=
30. More clearly, it has improved the result by 16% several years ago.Table 2
Accuracy of Caltech-101.
#train
Ours
[18]
[29]
[30]
[31]
[32]
[33]
15
68.5
59.05
56.4
52
51
49.52
44
30
75.2
66.23
64.6
N/A
56
58.23
63Figure 3
Comparison against existing techniques on the Caltech-101.In order to find the best parameters in our experiment for NN search for our scheme, we should take into account the balance between performance and CPU time. Therefore here we conducted to analyze the performance and CPU time of different ofk
(
k
=
2,3
,
…
,
20
) for NN search. Figure 4 illustrates the accuracy and CPU time by each k in our dataset.Figure 4
Classification beyond CPU load performance.The author of [26] proposed the method by combining KPCA and normal LSH. That means computing hashing beyond the KPCA. However this method has apparent disadvantage because KPCA will bring on the loss of input information although it can reduce the dimensionality in the processing, while KLSH can solve this problem to assure the integrity of input information to compute the LSH. Therefore we found that our method has high accuracy and better performance than the algorithm in [26].


## 6. Conclusions

In our paper, we properly use the concept of homogeneous kernel maps to help us to solve the problem of approximation of those kernels, including those commonly used in machine learning such asχ
2, JS, Hellinger’s, and intersection kernels. Combining with the KLSH scheme, it enables us to have access to any kernel function for hashing functions. Although our approach is inferior to linear scan search in time but it can guarantee that the search accuracy will not be affected. Moreover we do not need to consider the distribution of input data; to some extent, it can be applicable for many other databases as Flicker and Tiny Image. Experimental results demonstrate that it is superior to standard KLSH algorithm.



---

*Source: 350676-2015-03-29.xml*