# Local Distance Vector

It is verified that using the distance between local feature and classes (i.e., image-to- class distance) can provide better generation capability. We propose a novel distance pattern, called local distance vector, to define the distance from local feature to a specific class. Local distance vector eliminates the need to search for the nearest few neighbors in every class-specific manifold to generate distance vectors. Instead, it merges all the class-specific manifolds together to form a single dataset, i.e., *M = [M*^{1}, M^{2},*M ^{C}*] = (m

_{;}}"=

_{1}, where m

_{;}is called “anchor points” [8] and

*n*is the total number of points. To obtain the class-specific distance, we search for

*k*nearest neighbors of a local feature

*x*in

_{;}*M*, denoted as

*NN(x*{p

_{;}, k) =_{1;}p

_{2},..., p

_{k}} e

*M*. Each neighbor p

_{;}has a label

*Class{p*identifying it belongs to which class. We define the distance from

_{;}}*x*to those classes found in the

_{;}*k*nearest neighbors as follow:

The difference between distance vector and local distance vector is shown in Fig.5.1. Our proposed local distance vector is less influenced by isolated classes since it only calculate distance vector for some classes which are close to the query feature. On the contrary, distance vector has to calculate the distance between the local feature and each class; it is inevitable to bring in some irrelative information from distant classes.

For those classes that are not found in the *k* nearest neighbors, we use the distance to the *k +* 1 nearest neighbors of *x _{;}* to estimate the class-specific distance. And the local distance vector of the local feature

*x*is denoted as d

_{;}*]. The local distance vectors of an image is described in Algorithm 1.*

_{;}= [dj, df,..., df**Fig. 5.1 **Distance vector *versus* local distance vector. *x;* is a query local feature. Distance vector searches the mapping point *x;* which is determined by the nearest few neighbors in each manifold *M*^{c}. Local distance vector retrieves only the local neighborhood in *M = [M*^{j}, *M ^{2}, M^{c}]*

Algorithm 1 Local Distance Vector Require:

Local features (x^ j} of a input image *I*; the merged dataset M.

Ensure:

Local distance vectors d;, *i = 1, 2, N*.

for *i* —- 1; *i < N*; *i* —- *i* + 1 do (P1, p2,pk+1} — *NN*(x;, *k +* 1)

if category *c* is found in the *k* nearest neighbors of x; then

* ^{d}i = ^{min}{pj* |

*Class(pj')=c}*||

^{x}i

^{— p}j llf

_{2}.

else if category *c* is not found in the *k* nearest neighbors then *dc* = || x; - pk+1 H^.

Obtain d*; =* [id?, *d ^{2}, d^{C} ]* for the local descriptor x;.

Unlike the original local features, local distance vector is more class-specific as desired for classification. Such class-specific distance captures the underlying manifold structure of the local features [2]. Meanwhile, it is obtained by using its nearest few neighbors avoiding coding process and ignoring some irrelative classes far from the local feature. Thus it gains stronger discriminative capability, and more robustness to noise and outlier features. Local distance vector obtains another advantage inherited from distance pattern, that is all local distance vectors within the same class are more similar in the distance feature space due to the class-specific characteristic. Therefore, it can cooperate better with following pooling procedure. Furthermore, the calculation of local distance vector is significant faster than that of distance vector because it is produced by searching for nearest neighbors within a merged reference dataset.