# 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 = [M1, M2,MC] = (m;}"=1, where m; is called “anchor points”  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;, k) = {p1; p2,..., pk} 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; = [dj, df,..., df ]. The local distance vectors of an image is described in Algorithm 1. 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 Mc. Local distance vector retrieves only the local neighborhood in M = [Mj, M2, Mc]

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

di = min{pj | Class(pj')=c} || xi — pj llf2.

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

Obtain d; = [id?, d2, dC ] 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 . 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.