Adaptive dictionary learning based on local configuration pattern for face recognition

Sparse representation based on classification and collaborative representation based classification with regularized least square has been successfully used in face recognition. The over-completed dictionary is crucial for the approaches based on sparse representation or collaborative representation because it directly determines recognition accuracy and recognition time. In this paper, we proposed an algorithm of adaptive dictionary learning according to the inputting testing image. First, nearest neighbors of the testing image are labeled in local configuration pattern (LCP) subspace employing statistical similarity and configuration similarity defined in this paper. Then the face images labeled as nearest neighbors are used as atoms to build the adaptive representation dictionary, which means all atoms of this dictionary are nearest neighbors and they are more similar to the testing image in structure. Finally, the testing image is collaboratively represented and classified class by class with this proposed adaptive over-completed compact dictionary. Nearest neighbors are labeled by local binary pattern and microscopic feature in the very low dimension LCP subspace, so the labeling is very fast. The number of nearest neighbors is changeable for the different testing samples and is much less than that of all training samples generally, which significantly reduces the computational cost. In addition, atoms of this proposed dictionary are these high dimension face image vectors but not lower dimension LCP feature vectors, which ensures not only that the information included in face image is not lost but also that the atoms are more similar to the testing image in structure, which greatly increases the recognition accuracy. We also use the Fisher ratio to assess the robustness of this proposed dictionary. The extensive experiments on representative face databases with variations of lighting, expression, pose, and occlusion demonstrate that the proposed approach is superior both in recognition time and in accuracy.


Introduction
As a biological feature, the human face has been paid more attention because it can be easily captured with a common camera even without cooperation of the subject. Yet the performance of face recognition is affected by the expression, illumination, occlusion, pose, age change, and so on. There are still some challenges in the field of unrestricted face recognition.
Facial images are very high dimensional, which is bad for classification. So dimension reduction is carried out before classification. Principle component analysis (PCA) [1][2][3][4] has become the classic reducing dimension approach and has been used widely in image processing and pattern recognition fields. All training images make up covariance matrix, and these eigenvectors corresponding to the bigger eigenvalues of covariance matrix span the linear feature subspace. Through projecting high-dimensional original face images onto the low dimensional linear feature subspace, PCA performs the dimension reduction and preserves the global structure of an image.
Designed as a texture descriptor originally, local binary patterns (LBP) [5] is a simple and efficient algorithm, it can capture the local structural features that are very important for human texture perception. Researches show that LBP is discriminative and robust to illumination, expression, pose, misalignment, and so on. LBP has been a popular feature extraction approach and has been used successfully in face recognition [6][7][8]. Up to now, some improved approaches based on LBP have been presented, such as complete LBP (CLBP) [9], local Gabor LBP [10], multi-scale LBP [11], and so on. Because the intensity of the central pixel is independent to its LBP value, the information embodying the relationship between pixels in the same neighborhood is lost. Guo et al. [12] proposed the local configuration pattern (LCP) including both local structural and microscopic features. The local structural features are represented by the pattern occurrence histograms, just as LBP, and the microscopic features are described by optimal model parameters. The microscopic configuration features reveal the pixel-wise interaction relationships. It has been proved LCP is an excellent feature descriptor. In this paper, we use LCP to measure the similarities between face images and finally to find neighbors of testing image.
Many researches confirmed that sparse representation and collaborative representation are good at image processing, such as image reconstruction, image representation, and image classification. Li et al proposed an effective approach called patch matching-based multitemporal group sparse representation to restore the missing information that should be contained in remote sensing images [13] (Patch Matching-Based Multitemporal Group Sparse Representation for the Missing Information Reconstruction of Remote-Sensing Images). Yang et al. [14] regarded face recognition as a globally sparse representation problem and proposed the face recognition (FR) approach known sparse representation based on classification (SRC), in which the overcomplete dictionary is formed by training face images. Subsequently, To improve the recognition accuracy with occlusion, Wright et al. [15] subsequently introduced an identity matrix to code the outlier pixels that were occluded. Yang et al. [16] viewed the sparse coding as a sparsity constrained robust regression problem and proposed the robust sparse coding method. It is more robust to detect outliers than SRC. In 2010, Yang et al. [17] introduced Gabor features into SRC; they projected firstly the high-dimension facial images into the lower dimension Gabor-feature space and then used SRC to classify. This approach greatly decreased the size of the occlusion dictionary compare with that of SRC. As a result, recognition-time is reduced. Ou et al. proposed an approach of face recognition with occlusion named structured sparse representation based classification [18]. In which, occlusion dictionary is not an identity matrix, but is learned from data and is smaller than that of SRC. In addition, the occlusion dictionary is independent of the training sample as possible, so the occlusion is sparsely represented by the learned occlusion dictionary and can be separated from the occluded image. The testing image is classified by the recovered non-occluded image. Ou also provided another occlusion dictionary learning algorithm named discriminative nonnegative dictionary learning, where the occlusions were estimated adaptively by the reconstruction errors and weights for different pixels were learned during iterative processing [19] The resolution method of sparse representation vector (or sparse solution) is another crucial issue for sparse representation based on classification (SRC), which influences the recognition accuracy and recognition time. The first researchers, such as the above mentioned, hold the view that "sparsity" of the sparse representation vector is the most crucial for SRC and paid more attention to the "sparsity" of sparse solution. Because l 0 _norm minimization is NP-hard, they used l 1 _norm minimization to replace l 0 _norm minimization as the optimal solution (the sparsest solution). But l 1 _norm minimization is timeconsuming, which is bad for recognition especially in the case of real-time identification. Ma et al [20] proposed a discriminative low-rank dictionary learning, in which the over-completed discriminative dictionary is composed of series of sub-dictionaries. Atoms of each sub-dictionary are training images from the same category, so they are linearly correlated and all sub-dictionaries are low-rank with a compact form. Zhang et al. [21] also regarded the feature coding problem as the low-rank matrix learning problem and researched local structure information among features on the image-level. Using the similarities among local features embraced in the same spatial neighborhood, an exacting joint representation of these local features w.r.t. the codebook was founded. Zhang et al [22] analyzed the mechanism of SRC and found that "collaboration representation" among categories is the crucial factor for SRC. He relaxed the demand on "sparsity" and used l 2 -norm to replace l 1 -norm as the sparse constraint condition and proposed the algorithm known collaborative representation based on classification with regularized least square (CRC_RLS). Gou et al investigated deeply approaches based on collaborative representationclassification and proposed several novel approaches of classification based on collaborative representation [23][24][25][26]. He proposed a two-phase probabilistic collaborative representation-based classification [25], in which the nearest representative samples are chosen first and then each testing sample is represented and classified by those chosen nearest samples. In Ref. [26], the locality of data is employed to constrain the collaborative representation in order to represent faithfully testing images with the nearest samples. In this paper, we proposed a new and simple approach based on sparse representation and LCP features. We pay our attention to the over-completed compact dictionary. Atoms of this proposed dictionary are all nearest neighbors in LCP feature subspace, so structures of atoms are more similar to that of testing images and the atoms' number is greatly decreased compared with the training images, which will improve the recognition accuracy and reduce the recognition time.
This paper is organized as follows: related theories about SRC and LCP were described in Section 2. The proposed face recognition approach using a sparse representation-based adaptive nearest dictionary was described in Section 3. Experimental results were provided in Section 4 and conclusions were illustrated in Section 5.

Sparse representation based on classification
Assume there are M training face images from Q subjects, each subject has m q images, M ¼ P Q q¼1 m q . Let v q, i ∈ ℜ d × 1 denote the d-dimension vector stretched by the ith image from theqth class (subject) and yrepresent the testing image vector. Let matrix X q ¼ ½v q;1 ; ⋯; v q;m q whose column vectors are the training images from the qth class, X = [X 1 , ⋯, X q , ⋯, X Q ] ∈ ℜ d × M is the set of all training images. Yang et al. [14] proved that face recognition can be regarded as sparse representation based on classification (SRC) if there were enough training face images (the number of training face images M should be greater than the dimension of image, i.e., d < M). In this case, the testing imagey can be as the sparse linear combination of all training images, i.e., where β ¼ ½β 1;1 ; β 1;;2 ; ⋯; β T 1;m;…;β Q;1 ;⋯;β Q;m Q ∈ℜ MÂ1 is the representation coefficient vector.
Sparse representation classification firstly encodes the testing image by all training images according to Eq. (1) and then classifies class-by-class. Specifically, if the testing image y comes from the qth subject (class), entries of its β should be zero except for those associated with theqth class ideally, i.e. β ¼ ½0; ⋯; 0; β q;1 ; β q;2 ; ⋯; β q;m q ; 0; ⋯; 0 T (T is transpose operation). In fact, any entry of βcan be very small nonzero, so the identity of y is determined by the residual between yt and its reconstruction by each class. Let β q ¼ ½β q;1 ; β q;2 ; ⋯; β q;m q T be the representation coefficient associated with the qth class. The reconstruction of the test image by the qth class training samples denotes byy q , y q = X q β q , the residual r q = ‖y − y q ‖ 2 = ‖y − X q β q ‖ 2 . The testing image is classified to the qth class if r q is the minimum residual, i.e., How to get the representation coefficient vector from Eq. (1) is crucial for sparse representation. Sparse representation requires the dictionary to satisfyd < M, so Eq.
(1) has more than one solution. The sparest solution is generally considered as the optimal solution for classification. The optimal solution expressedβ is the solution of Eq. (3), while it is a NP-hard problem.
Theories of sparse representation and compressed sensing reveal that l 0 -norm minimization solution and l 1 -norm minimization solution were nearly equivalent when the solution is sparse enough. So Yang [14]  employed l 1 -norm to replace l 0 -norm and estimated the optimal representation vector by Eq. (4) where εdenotes the error term including noisy and model error, and this is the well-known sparse representation based on classification (SRC). Zhang employed l 2 -norm as the sparse constraint condition to solve representation vector using regularized least square and proposed CRC_RLS algorithm [22], in which the representation vector can be obtained by Eq. (5) With regularized least squares method, the unique solution of Eq. (5) can be easily educed asβ ¼ ðX T X þ λIjÞ −1 X T y, where λ is a regularization parameter given experientially. AssumeP = (X T X + λI| ) −1 X T , it is clear that P is independent of y, so P can be seen as a projection matrix decided only by training images. Just projecting y onto P, β can be solved easily,β=Py.
According to sparse representation theory, the overcompleted dictionary should be satisfied that the number of features is greater than that of an atom. However, face recognition is a typical small-size-sample task and matrix X made directly by face images could not be an over-completed dictionary. Generally, dimension reduction was performed before a sparse representation.

Local configuration pattern
In essence, LBP feature is the histogram build by LBP value of all pixels in an image. LBP of the given pixel is defined as follows [5]: where R is the radius of the circle neighborhood centered at the given pixel, P is the number of neighboring samples spaced at regular intervals on this circle, g c is gray of the center pixel, and g p (p = 0, 1, ⋯P − 1) denotes gray of its neighboring. Regard the LBP as a circular binary string with P bits, the number of two bitwise transitions 0 and 1 is defined as U. If U ≤ 2, then the LBP are defined as a uniform pattern, notated LBP u2 P;R . Ojala et al. [5] defined the rotation-invariant uniform patterns LBP riu2 P;R : LetN k denotes the occurrence of the k-pattern in- is the Dirac function. Histogram H expresses the LBP feature vector of the image.
where S is the maximum value of LBP pattern. Although the LBP feature vector can capture the statistical feature of the image and is robust for illumination, it neglects the relationship between neighboring pixels, which leads to wrong classification results when images have the same LBP feature but the different gray variations between the center pixel and its neighboring pixels. Guo et.al [12]. introduced the microscopic feature (MiC) information into LBP and proposed a local configuration pattern (LCP). Let A = (a 0 , ⋯, a P − 1 ) presents a parameter vector and g = (g 0 , ⋯, g P − 1 )presents a neighboring vector of center pixel. The central pixel can be reconstructed by P P−1 p¼0 a p g p , the reconstruction error j g c − P P−1 p¼0 a p g p jwill be minimum when parameter vector A reaches optimum. Assume there are N L pixels whose patterns are all equal to L, let c L i ði ¼ 1; ⋯; N L Þ denote the gray value of the ith center pixel belonging to L pattern, these N L gray values made up the matrix Þrepresents the optimal parameters corresponding to the L pattern. C L , A L , and G L satisfy Eq. (9) With overwhelming probability N L > > P, hence the matrix G L is over-determined and the optimal parameter vector A L can be computed by the least squares.
A small probability event (N L ≤ P)is regarded as unreliable and its model parameters are set to zero. The ðk ¼ 0; ⋯; P−1Þ . MiC features consist of the amplitude of the Fourier transform (|ϕ L (k)|), denoted by Φ L .
Appending N L to Φ L , LCP feature corresponding to L pattern can be obtained by the Eq. (12). The LCP feature vector of an image can be obtained by concatenating all S LCP features, it is denoted by F LCP .

Methods
According to sparse representation theories, the more similar the atom is to the testing sample, the sparser the representation vector is, and the greater recognition accuracy of the dictionary is. Let η = m q /Mdescribe the sparsity of the representation vector. If all classes have the same number of training samples, thenη = 1/Q, else min q (m q )/M ≤ η ≤ max q (m q )/M, where min q (m q ) and max q (m q ) are the minimum and the maximum number of training samples for each class. The representation vector is sparser with the smallerη. Clearly, we want to make ηsmall enough. There are two ways to make η smaller. One is to augment categories and the other is to reduce the sample size of each class. For the former, it is difficult to ask more enough volunteers to take face picture. So we use the second way to increase the sparsity. A testing image may be not represented sufficiently if we discard randomly some training images, which are bad for the recognition accuracy. In this paper, we recommend to utilize the nearest neighboring images of the testing image as atoms to build a dictionary so that the testing image can be represented sparsely and faithfully. SRC then are performed on this proposed dictionary. We call this proposed approach for FR as "Collaborative representation classification based adaptive nearerneighbor-dictionary" (CRC_NLCP). Figure 1 shows the flowchart of this proposed algorithm. The proposed algorithm includes two stages, the first is to learn adaptively the over-completed dictionary, and the second stage is the SRC process. Dictionary learning includes rough similarity measurement, nearest neighbor criterion, and dictionary atom selection.

Similarity measurement
As the aforementioned, the LCP feature includes the statistical feature (LBP feature) described by the histogram and the microscopic configuration feature described by the parameter vector (MiC feature). So we measure the similarity among images in these two feature subspaces respectively.

Statistical similarity
In essence, the LBP feature vector is a frequency histogram, so the chi-square distance is a good measurement to estimate the similarity between histograms. Hu et.al [27] proved that the distance-based chi-square is not robust for partial occlusion and they may lose the cooccurrence relations that benefit to improve the recognition accuracy. Hence, he proposed a bin ratio-based distance (BRD).
Q are respectively two unit histogram vectors corresponding the image A and image B, BRD of these two images are defined as Eq. (13): where the numerator term ( u B i u A j −u B j u A i ) embodies the ratio-relations and the differences of bins included in the same histogram, and the denominator is the standard term. He also proved the combination of BRD and chisquare distance, notated as dχ 2 −BRD and defined by Eq. (14), is superior to both them for classification.
For the unit length histograms, values of dmsubsup χ 2 −BRD are all very small, for example, the maximum value is shown in Fig. 2 (red rhomb) is 0.025, and differences dmsubsup χ 2 −BRD are even smaller, which means dmsubsup χ 2 −BRD has less discrimination feature and is not fit to measure the statistical similarity. We defined a new statistical similarity measurement named "chi-square-BRD-similarity" and notated as ξ to estimate the similarity of images in the LBP feature subspace.
Clearly, Chi-square-BRD-similarity (ξ) is the minus logarithm of dmsubsup χ 2 −BRD , it expands nonlinearly the value range of dmsubsup χ 2 −BRD . Figure 2 shows the chi-BRD-distance ( dmsubsup χ 2 −BRD ) indicated by red rhombs and Chi-square-BRD-similarity (ξ) denoted by blue stars between one image and the others from the ORL face database. Clearly, ξ is more discriminative than d msubsup χ 2 −BRD . The larger ξ, the more similar two images are. Chi-BRD-distance between the image and itself is zeros while the chi-square-BRD-similarity is infinity.

Configuration similarity
In the MiC feature subspace, we use Euclidean distance to measure the configuration similarity between two imagesx 1 andx 2 , notatingρ(x 1 , x 2 ).
Clearly, two images are more similar if their Euclidean distance is smaller.

Neighboring images selection criteria
According to Eq.(7)~(11), we can obtain unit histogram H q;i and Mic featureΦ q;i from training imagev q, i , and H y (unit histogram of testing image) andΦ y (MiC feature of testing image). Let ξ q, i andρ q, i describe respectively the statistical similarity and configuration similarity between testing image y andv q, i , ξ q;i ¼ ξðH y ;H q;i Þ can be obtained by Eq. (13)~(15); ρ q, i = ‖Φ y − Φ q, i ‖ 2 can be computed according to Eq. (16). Define ξ q ¼ 1 m q P m q i¼1 ξ q;i as "class-average-statistical similarity." If ξ q;i ≥ ξ q , then the training imagev q, i is labeled as statistical neighboring. Similarly, define 'class-average- There are two criteria to label the nearest neighboring samples. One, named criterion-A, is that the nearest neighboring image should be labeled as both statistical neighboring and configuration neighboring. The other, named criterion-B, is that the nearest neighboring image was labeled as either statistical neighboring or configuration neighboring. Whatever criterion is used, there must be enough training samples in each class to be labeled as the nearest neighbor. If not, the complementary criterion, named criterion-C, must be performed. In this paper, the complementary criterion (criterion-C) is to sort respectively the training images in LBP and MiC subspace, and then keep labeling the closer ones in both two subspaces until the quantity of the nearest neighbor in each class reaches the requirement. Generally, the number of the nearest neighbor in each class should be between 2 and half of the number of training images in each class. The algorithm of labeling the nearest neighbor is summarized as the algorithm 1.

Building an adaptive dictionary
For this proposed approach, it is crucial to fast find and label these training samples that are more similar to the inputting testing image. So we compute the similarity in the lower-dimension LCP feature subspace. However, compared to the face image, LCP feature vector loses much information, which are bad for SRC. We employ the original face image as an atom to make up the dictionary, which means all atoms of the dictionary are these face-image-vectors labeled in the LCP subspace, but not LCP-feature-vectors. That is to say, sparse representation and classification are performed in face image space but not in feature subspace. The experimental results shown in the later section also verify that SRC based on image vector is better than based on the LCP feature vector.
Use these training images labeled the nearest neighbor as the atoms to build the over-completed dictionary. In order not to be confused with the ordinary dictionary notated by X (defined in Section 2.1), we use R to notate this proposed adaptive nearest neighbor dictionary.R = [ R 1 , ⋯, R q , ⋯, R Q ], where R q ¼ ½v q; j 1 ; v q; j;…;v q; j s ∈ℜ dÂκq (1 ≤ j 1 , j 2 ,⋯, j s ≤ m q }, whose column vectors are the nearest neighbors selected from the qth subject's training images. Integer κ q indicates that there are κ q nearest neighbor images are chosen in the qth class. Usually,

Assessment of the adaptive dictionary
The over-completed dictionary greatly affects the performance of SRC. We employ Fisher's ratio as the criterion to quantitatively evaluate the validity of the dictionary. Using the within-class scatter and the between-class scatter, Fisher's ratio directly assesses the class separation performance. For the q-class and p-class, their Fisher's ratio along the l-principal component vector direction F q, p, l is defined where S b = (μ p − μ q )(μ p − μ q ) T is the between-class scatter matrix of the class p and class q, μ p is the p-class mean, μ q is the q-class mean; S w ¼ 1 Þðx j;i −μ j Þ T Þ is the within-class scatter matrix for the class p and class q, x j, i is the ith image from the jth class, m j is the number of the images in the class j; w l is the eigenvector corresponding to the eigenvalue λ l , w l T express the transposition of w l . The coefficients 1/2 and m j remove the interference brought by the different sample size of each class.
From Eq. (17), we can see that F p, q, l =F q, p, l . For the whole dictionary, the fisher ratio along l-principal component is defined as the mean of F p, q, l , notated F l : Integer Q, defined in Section2.1, represents the number of class included in the dictionary.

Results and discussion
In this section, the performance of the proposed algorithm is verified based on two standard face databases, AR [28] and ORL [29]. Both face databases involve some changes in gender, illumination, pose, expression, glass, and time. The detailed data used in this paper are list in Table 1.
This proposed adaptive dictionary is different for different testing images, so different sets of training samples have a little influence on experimental results. We randomly selected training samples to repeat the proposed algorithm for multiple times and presented the average result in the later of this section. All algorithms are coded by MATLAB 2015 and performed on the same computer with 2.6GHz CPU and 8G RAM. In this paper, we never use any parallel computing or GPU.

Nearest neighbor image selection based on LCP features
In order to reduce computation while retaining neighbor attribution, we employ the rotation-invariant uniform pattern to compute the similarities between images. Set P = 8, R = 1, and the length of the LCP feature vector is 90. Figure 3 presents an example about one face image and its LCP feature vector, where (a) is the equalized image, (b) is the rotationinvariant uniform LBP pattern spectrum for P = 8 and R = 1, and (c) is the LCP feature vector corresponding to (c). The ten groups of red vertical line ' ' denote the ten normalized MiC feature vectors respectively, the ten black solid vertical lines describe the frequencies of all patterns in LBP.
In this paper, all images were equalized in advance to reduce the effects of illumination. The number of Fig. 9 The curve of recognition accuracy with feature-dimension nearest neighbors is different for different testing images. Figure 4 represents the scatter diagrams of the nearer-neighbor-number for the face database ORL. The numbers of nearest neighbor both on criterion-A and on criterion-B (given in algorithm 1) are reasonable. It is unnecessary to perform criterion-C. Figure 5 represents the scatter diagrams of the nearer-neighbor-number for the face database AR. For some images, its numbers of nearest neighbor labeled by criterion-A are relatively small to the number of classes. So the number labeled criterion-C is shown in Fig. 5.
For clarity, we presented the Cumulative Distribution Function (CDF) and Probability Density Function (PDF) of the nearer-neighbor-number for AR and ORL in Fig.6, where EA and VA are mean and variance respectively of the numbers. Obviously, the number of nearest neighbor labeled by criterion-A is mainly between 130 and150 in AR database, it is much less than the total number of training images.
For each image in the database ORL, the number of its nearest neighbors in each class is shown in Fig. 7. It is clear that the number of nearest neighbors labeled by our method is almost half of that of training samples and the nearest neighbor images are distributed in all categories. So the number of categories is not reduced, but the number of atoms in each category is reduced, which reduces the dictionary thickness and improves the sparsity.

Adaptive dictionary
Face image is a high dimension with lots of discriminative information. But the LCP feature dimension is 90 and LBP feature dimension is only 10 in this paper. So much information is missed in the LCP or LBP feature subspace, which leads to classify wrong.
We use fish-ratio defined by Eq. (17) to measure the discrimination of the dictionary. In order to compare, three dictionaries are created. As baseline, the first dictionary, denoted by D -O , is composed by all training original facial images and is stationary for all testing images; the second dictionary proposed in this paper and denoted by D -p is composed by the nearest neighbor facial images, and the third dictionary denoted by D -f is composed by the nearest neighbor LCP feature vectors. Atom feature dimensions of both t D -O and D -p are equal to the size of the facial image and are much larger than the atoms' number, but for the dictionary D -f , the atom feature dimension is dependent on the type of LBP.
According to Eq. (18), fish-ratio is defined independently along each principal component vector direction.
We compute the fish-ratios of the three dictionaries along the bigger principal component vector directions.
As an example, Fig. 8 presents the fish-ratios of different dictionaries for the same testing images from ORL. The length of the LCP feature vector is 90, so we compute the fish-ratio of the first 90 principal component directions for the D -f , and for the other dictionaries, the principal component is less than the number of the atom. Figure 7b shows the cumulative sum of fish-ratio from the first-principal component to the given-principal component. We can conclude that the classification performance of the proposed dictionary in the paper is superior to the other two dictionaries.
Since the sparse dictionary requires the number of atoms to be greater than the feature number of atoms, the feature number of atoms is the image resolution, and the image resolution is far greater than the number of images; PCA dimensionality reduction is required to calculate the sparse coefficient.

Recognition accuracy
The testing image is first collaboratively represented with its neighbors labeled in the LCP feature subspace,  and then it is classified using its over-completed compact dictionary. In this paper, we use the recognition accuracy to measure the recognition performance.
Recognition acuracy ¼ Number of the testing samples classified correctly Total number of testing samples ð19Þ Figure 9 shows the curve between the right recognition rate and feature-dimension for different dictionaries on ORL. In which, PCA, SRC, and CRC_RLS have the same fixed dictionary D -O ; CRC_NLCP and SRC_NLCP have the same proposed adaptive dictionary D -p , and the difference between them is the former used collaborative representation while the later used sparse representation. CRC_LBP-riu2 and CRC_LBP-u2 employ the dictionary D -f , and they employed different kinds of LBP.
To be clearer, we listed the best recognition rate and the corresponding optimal feature number in Table 2. The proposed algorithm has the greatest recognition accuracy reached 97.5% and a relatively small number of features 95. CRC_LBP has the least recognition accuracy rate because the number of features is too small. Table 3 shows the recognition accuracy of the OR database for different numbers of feature. Obviously, the proposed algorithm is the best one for any dimension, and the recognition rate was improved by 0.5-4.3% compared with the second best. The robustness of this proposed method to occlusion (wears glasses or scarf) is authenticated on AR database and the results are presented in Table 4. Our algorithm recognition accuracy is increased by 20.5% for glass and by 4.9% for scarf. Each algorithm has different requirements for feature dimension, and the classification will not be performed if feature dimension is not satisfactory.

Recognition time
For those approaches based on the sparse representation, recognition time consists of a solution to representation vector (SRV) and pattern matching. In this paper, we employ the nearest neighbor classifier, which is the simplest and fast, to classify. The recognition time was mainly decided by SRV. Neither ℓ 1~ℓs used in SRC nor regularized least squares (RLS) used in CRC_RLS, the time to solve SRV is mainly determined both by the number of dictionary atoms and by feature dimension. Any increase in either of the two numbers will make the solution time longer. Figure 10 provided the curve of the time spent on one SRV with the number of atoms and feature dimensions on the database ORL.
For ORL, when feature dimension equals to 95, the time to solve one SRV with different numbers of atoms and different methods is listed in Table 5. For database AR, the time is given in Table 6. Experiment results show that the recognition time is greatly reduced as the number of atoms decreases and that the RLS method is much faster thanℓ 1~ℓs .
In addition, the number of atoms must be greater than the feature dimension, if not, there will be no solution.

Conclusion
Over-complete dictionaries are very important for sparse representation based on classification. In this paper, we presented an adaptive dictionary learning approach. We choose separately the training images that are closer to the testing image from each class as the atoms to adaptively make up the over-complete dictionary. The proposed dictionary changes with the different testing images. The closer training images are called nearest neighbors labeled class by class in the LCP feature subspace, so atoms are more similar to the testing in structure, which increases the recognition accuracy. In addition, the number of nearest neighboring images is much smaller than that of total training images, which greatly reduced the recognition time. Fisher's ratio also shows the proposed adaptive dictionary is more discriminatory. Experiment results also show that collaborative representation classification based on this proposed adaptive nearest neighbor dictionary is excellent in recognition accuracy and in recognition time.
To accurately and quickly identify the input testing images, we pay more attention to build an adaptive dictionary. The main idea is to find the nearest neighbors of testing images in each class. If the number of training samples is small for certain classes, then the advantages of this proposed algorithm will disappear. In addition, only Euclidean distance is selected to measure MiC similarity, and we did not investigate other distance formulas such as "cosine coefficient distance." We also did not consider the image noise. In the next work, we will employ different distances such as "Jeffreys and Matusita distance," "cosine coefficient distance," "Canberra distance," and "generalized Dice coefficients" to find similarity between images and investigate influence brought by noise.