You are on page 1of 5

See

discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/309776585

Hyperspectral image classification based on KNN


sparse representation

Conference Paper · July 2016


DOI: 10.1109/IGARSS.2016.7729622

CITATIONS READS

0 49

4 authors, including:

Shutao Li Xudong Kang


Hunan University () Hunan University
178 PUBLICATIONS 4,259 CITATIONS 23 PUBLICATIONS 602 CITATIONS

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Shutao Li on 02 January 2017.

The user has requested enhancement of the downloaded file.


HYPERSPECTRAL IMAGE CLASSIFICATION BASED ON KNN SPARSE
REPRESENTATION

Weiwei Song, Shutao Li, Xudong Kang, and Kunshan Huang

College of Electrical and Information Engineering, Hunan University, Changsha, China

ABSTRACT widely used in many applications such as monitoring of the


Traditional joint sparse representation based hyperspectral environment and disasters.
classification methods define a local region for each pix- To achieve the objective of HSI classification, assigning
el. Through representing the pixels within the local region pixels to one specific class based on their spectral characteris-
simultaneously, the class of the central pixel is able to be tics, various spectral classifiers have been developed such as
decided. A common limitation of this kind of methods is that neural networks [1], genetic algorithm [2], and support vec-
only local pixels are considered in such methods, and thus, tor machines(SVMs) [3]. In recent years, as a novel signal
non-local information will be ignored. In order to improve the representation tool, sparse representation has been success-
classification accuracy with the non-local information of hy- fully applied for HSI classification [4]. This method assumes
perspectral images, a novel hyperspectral image classification that each hyperspectral pixel and its neighbor pixels within a
based on K nearest neighbors (KNN) sparse representation local window can be simultaneously represented by a set of
is proposed in this paper. First, a feature space is defined atoms in a dictionary composed of training samples. In other
based on the first principal components of the hyperspectral words, pixels which has strong spatial correlations tend to be
image and the spatial coordinates of different pixels. Then, classified into the same class in this situation. Compared to
in the defined feature space, K non-local neighborhoods of the pixel-wise based classification methods, the joint sparse
each pixel are found by using the KNN searching scheme. representation (JSR) not only considers the spectral charac-
At last, through jointly representing the K pixels with the teristic of each pixel but also its spatial neighbors, and thus,
joint sparse model and comparing the representation residu- can obtain a better classification performance. However, it is
als, the label of each pixel can be determined. Experiments hard to decide the optimal window sizes for different scenes.
performed on a widely used real HSI data set show that the For example, a window of small size is appropriate for pixels
proposed method obtain better classification performances near edges, while pixels in smooth areas prefer large windows
when compared with the traditional joint sparse representa- for accurate classification. To solve these drawbacks, a multi-
tion method and other recently proposed hyperspectral image scale sparse representation scheme called the multiscale adap-
classification methods. tive sparse representation (MASR) is proposed in [5] to take
the advantages of different window sizes for classification.
Index Terms— Classification, hyperspectral images, K
Compared with the JSR method, this model achieves obvious
Nearest Neighbor(KNN), joint sparse representation.
improvements in terms of classification accuracy. However,
this model will be quite time-consuming due to the multi-
1. INTRODUCTION scale representation process. More importantly, a common
limitation of this kind of methods is that only local pixels are
Hyperspectral images (HSI) contain hundreds of spectral considered for these methods, and thus, non-local information
bands spanning from the visible to the infrared spectrum. will be ignored.
Each pixel in a HSI can be represented by a vector whose To make full use of the non-local information of hyper-
entries correspond to the spectral reflectance in a specific spectral images, a KNN based filtering is proposed in [6]
wavelength. With the rich spectral information of HSI, an which has been demonstrated to be quite effective for the
accurate classification of different materials becomes pos- post-processing of classification results. Different from [6], a
sible. Due to this advantage, HSI remote sensing has been novel K Nearest Neighbors based sparse representation mod-
This paper is supported by the National Natural Science Fund of Chi- el is proposed in this paper. First, a feature space is defined
na for Distinguished Young Scholars (No. 61325007), the National Natural based on the principal components and spatial coordinates of
Science Fund of China for International Cooperation and Exchanges (No.
61520106001), the Science and Technology Plan Projects Fund of Hunan
the hyperspectral pixels. Then, through performing globally
Province (No. 2015WK3001), and the Fundamental Research Funds for the searching in the designed feature space, K most similar pix-
Central Universities, Hunan els for each pixel of HSI are found. Finally, the K pixels

978-1-5090-3332-4/16/$31.00 ©2016 IEEE 2411 IGARSS 2016


are simultaneously represented with the joint sparse model to spatial information in sparse representation model,the joint s-
determine the label of each pixel in HSI. parse representation model is proposed in [4]. It assumes that
The remainder of this paper is organized as follows. In neighboring pixels within a fix region can be simultaneously
Section 2, the sparse representation for classification is intro- represented by a few common atoms from the structural dic-
duced briefly and a novel sparsity model is proposed. In Sec- tionary. Concretely, in a W × W square window centered
tion 3, experimental results on a real HSI data set are present- on xi , let X = [xi1 , xi2 , ..., xiW ×W ] ∈ Rd×(W ×W ) is a
ed, and the superiority of the proposed method is demonstrat- d × (W × W ) matrix. Then, these pixels can be compact-
ed by comparing it with other classification methods. Finally, ly represented as
conclusions are given in Section 4.
X = [xi1 , xi2 , ..., xiW ×W ] = [Ds1 , Ds2 , ..., DsW ×W ]
(5)
2. SPARSITY MODEL FOR CLASSIFICATION = D[s1 , s2 , ..., sW × W ] = DS

2.1. Pixelwise Sparsity Model where S is a sparse matrix, in which the nonzero rows are cor-
responding to the selected atoms (or training samples) from
HSI classification based sparse representation relies on an structural dictionary. Given the dictionary D, the sparse ma-
observation that spectral pixels belonging to same class trix can be recovered by solving the following optimization
are assumed to lie in a low-dimensional subspace, which problem
is spanned by dictionary atoms from all common class
training samples. For an unknown pixel, it can be rep- Ŝ = arg minkX − DSkF , s.t. kSkrow,0 ≤ β (6)
resented as a linear combination of all training samples.
Specifically, let xi ∈ Rd×1 be a d-dimensional vector and Once the sparse matrix is obtained, the residual error can be
D = {D1 , ..., Dn , ..., DN } ∈ RN ×d is structural dictionary, calculated, and finally, class label of centered pixel can be
where Dn is the nth sub-dictionary spanned by all the nth determined as follows:
training samples and N is number of class. Then xi can be
represented as rn (X) = kX − Dn Sn k2 , n = 1, 2, ..., N (7)
xi = Ds (1)
Class(X) = arg min rn (X) (8)
where s is sparse vector whose nonzero entries refer to those n=1,2,...,N
selected representing atoms. In other words,the positions and
weights of representing training samples can be obtained from
2.3. The Proposed Model
sparse vector s. Given structural dictionary D, the sparse vec-
tor s can be recovered by solving the following optimization Although the JSR method can improve the classification per-
problem: formance significantly in terms of accuracy, it only exploits
correlation of local pixels, and the non-local pixels are not
ŝ = arg minkxi − Dsk2 , s.t. ksk0 ≤ β (2) considered. To make full use of the nonlocal spatial infor-
mation of HSI pixels, a novel method called as K Nearest
where β is a predefined upper bound on sparsity level corre-
Neighbor sparse representation (KNNSR) is proposed in this
sponding to the number of nonzero entries in sparse vector.
paper. Compared with JSR, the KNNSR overcomes locality
Once the sparse vector is obtained, the nth residual error be-
of JSRM and non-locally searches the similar pixels with the
tween test samples and reconstructed samples can be repre-
centered pixel. Beside, it also avoids to decide the optimized
sented as
size of window, which is not a trivial matters in some practice
rn (xi ) = kxi − Dn sn k2 , n = 1, 2, ..., N (3) cases.
The main procedures of KNNSR can be described as fol-
where Dn refers to the sub-dictionary constructed by the lows: Firstly, the HSI is preprocessed by principal compo-
training samples belonging to the nth class. Then the class nents analysis (PCA), subsequently, a new feature space is
label of xi can be determined by minimizing the residual defined based on the obtained principal components and s-
error patial coordinates of the hyperspectral pixels. Then, through
Class(xi ) = arg min rn (xi ) (4) performing globally searching in the designed feature space,
n=1,2,...,N K most similar pixels for each pixel of HSI are found by using
KNN algorithm 1 . Finally, the K similar pixels are simultane-
2.2. Joint Sparsity Model ously represented with the joint sparse representation model.
The pseudocode of the KNNSR algorithm is illustrated in Al-
In HSI, pixels are highly correlated with each other, and it has gorithm 1.
become a common sense that incorporating spatial informa-
tion can enhance classification performances. To exploit the 1 http://www.vlfeat.org/

2412
Algorithm 1 KNNSR iment to evaluate the classification performance of different
Input: methods. OA measures the percentage of correctly classified
A set of labels, L = {1, ..., N }, in which n ∈ L refer to pixels, AA refers to means of percentage of correctly clas-
the nth class; sified pixels for each class, Kappa coefficient represents the
The hyperspectral image, x = (x1 , ..., xi ) ∈ Rd×i , in robust measure of the degree of agreement.
which each pixel is a d-dimensional pixel vector;
τ Training samples, Tτ ≡ {(x1 , c1 ), ..., (xτ , cτ )} ∈ 3.3. Contrast Experimental Results
(Rd × L)τ ;
1: Performing principal component analysis on the hyper- In this section, the proposed method is compared with the
spectral image to obtain the first s principal components edge-preserving filtering (EPF) method [7], the extended
p = (p1 , ..., pi ) ∈ Rs×i , in which each pixel is a s- morphological profiles (EMP) method [8], the logistic regres-
dimensional vector sion and multilevel logistic (LMLL) method [9], and the joint
2: Construct F = sparse representation (JSR) method [4]. All of the previous
 √ the feature space
methods are implemented with the default parameters settings
p; [a; b]/ A × A + B × B × γ, in which a and
b refer to the vertical and horizontal coordinates of given by the authors.
different pixels, A and B refer to the height and width Fig.1 and Table 1 show the classification results and clas-
of the image, γ controls the balance of the spectral and sification accuracies obtained by different methods (1034
spatial components in the feature space training samples are selected as training samples, and the
3: Performing KNN searching in the feature space to ob- experiments have been repeated ten times to obtain the accu-
tain K nearest neighbors of each pixel i, wi = racies in the table). It can be seen that the proposed method
 1 the give the best performance in terms of overall accuracy, aver-
xi , x2i , ..., xK
i
4: Construct the dictionary D = {x1 , ..., xτ } with the τ age accuracy, and Kappa coefficients.
labeled training samples.
5: Calculating the sparse matrix S with SOMP, i.e., Table 1. Class accuracies (CA), overall accuracies (OA), av-
arg minS kw − DSkF , s.t. kSkrow,0 ≤ β, in which β erage accuracies (AA), and Kappa coefficients (Kappa) of the
refers to the sparse degree SVM [3], EPF [7], EMP [8], LMLL [9], JSR [4] and the pro-
6: Classify each pixel by minimizing the residuals be- posed classification methods
tween the test samples and the reconstructed samples,
Class SVM EPF EMP LMLL JSR KNN-SR
Class(xi ) = arg minn rn (xi ), in which rn (xi ) =
1 66.18 98.67 92.71 49.25 94.39 99.52
kwi − Dn Sn k, Dn refers to the sub-dictionary con-
2 72.84 94.04 89.39 92.90 93.92 96.68
structed by the training samples belonging to the nth class 3 73.09 96.89 83.99 90.20 92.30 96.91
7: end 4 56.27 95.78 81.79 89.06 92.96 96.26
5 88.88 97.74 90.78 91.78 92.08 97.98
6 88.38 94.32 95.84 99.68 94.67 98.42
7 78.86 100 88.00 75.20 96.36 91.61
3. EXPERIMENTAL RESULTS 8 95.48 99.07 99.61 99.88 99.79 99.88
9 40.95 40 78.24 26.67 58.01 97.34
3.1. Data Set 10 74.92 92.88 90.63 88.11 93.46 95.71
11 78.58 90.09 92.91 95.22 97.01 97.83
To verify the superiority of the proposed method, several 12 81.14 97.13 87.83 94.61 92.80 96.99
contrast experiments are conducted on the Indian Pines data 13 91.25 99.95 97.45 99.40 90.84 98.82
14 93.09 95.18 99.43 97.88 97.79 99.68
set which is a widely-used Airborne Visible/Infrared Imaging 15 70.05 92.58 97.99 81.75 98.07 98.78
Spectrometer (AVIRIS) image. This data set took place over 16 98.99 96.75 98.66 72.77 80.91 99.64
the agricultural Indian Pine test site in Northwestern Indiana OA 80.46 93.91 92.36 93.32 94.97 97.73
and has 220 spectral channels whose spectral range from 0.2 AA 78.06 92.57 91.58 84.02 94.26 97.42
kappa 77.66 93.02 91.28 92.37 91.58 97.63
µm to 2.4 µm. It is of size 145×145 pixels, with a spatial res-
olution 20m per pixel. In this experiment, twelve very noisy
bands are removed and the remaining 200 spectral channels
are used for classification. A three-band false color image 4. CONCLUSIONS
and the reference data which contains 16 classes of interest
are presented in Fig. 1 (a) and (b). In this paper, a novel HSI classification mathod based on K
nearest neighbor and joint sparse representation is proposed.
3.2. Quantitative Metrics Different from previous works, this method makes full use of
the non-local spatial information of hyperspectral images for
Three metrics (overall accuracy (OA), average accuracy classification. In this algorithm, in the first place, the dimen-
(AA), and the Kappa coefficient) are adopted in this exper- sion of HSI data is reduced by PCA algorithms, subsequent-

2413
(a) Indian Pines (b) Color composite (c) SVM(OA=79.95%) (d) EPF(OA=93.76%)

(e) EMP(OA=91.71%) (f) LMLL(OA=92.97%) (g) JSR(OA=94.81%) (h) KNNJSR(OA=97.73%)

Fig. 1. Indian Pines data set. (a) Color composite. (b) Classification results obtained by the SVM [3] (c), EPF [7] (d), EMP [8]
(e), LMLL [9] (f), JSR [4] (g), and KNNSR methods (h) on the Indian Pines data set.

ly, a new feature space is defined based on the first princi- [5] L. Fang, S. Li, X. Kang, and J.A. Benediktsson,
pal component of the HSI and the spatial coordinate of each “Spectral-spatial hyperspectral image classification via
pixel. Then, in the defined feature space, K non-local neigh- multiscale adaptive sparse representation,” IEEE Tran-
borhoods of each pixel are found by using the KNN search- s. Geosci. Remote Sens., vol. 52, no. 12, pp. 7738–7749,
ing scheme. At last, through jointly representing the K pixels Dec 2014.
with the joint sparse model and comparing the representation
residuals, the label of each pixel can be determined. Exper- [6] K. Huang, S. Li, X. Kang, and L. Fang, “Spectral-patial
iments performed on a widely used real hyperspectral data hyperspectral image classification based on KNN,” Sens-
demonstrate the effectiveness of the proposed method com- ing and Imaging, vol. 17, no. 1, 2015.
pered with other local joint sparse representation methods and [7] X. Kang, S. Li, and J. A. Benediktsson, “Spectral-spatial
some classical classification methods. hyperspectral image classification with edge-preserving
filtering,” IEEE Trans. Geosci. Remote Sens., vol. 52, no.
5. REFERENCES 5, pp. 2666–2677, May 2014.

[1] F. Ratle, G. Camps-Valls, and J. Weston, “Semisuper- [8] J. A. Benediktsson, J. A. Palmason, and J. R. Sveins-
vised neural networks for efficient hyperspectral image son, “Classification of hyperspectral data from urban
classification,” IEEE Trans. Geosci. Remote Sens., vol. areas based on extended morphological profiles,” IEEE
48, no. 5, pp. 2271–2282, May 2010. Trans. Geosci. Remote Sens., vol. 43, no. 3, pp. 480–491,
Mar. 2005.
[2] D. G. Stavrakoudis, G. N. Galidaki, I. Z. Gitas, and
[9] J. Li, J. M. Bioucas-Dias, and A. Plaza, “Hyperspectral
J. B. Theocharis, “A genetic fuzzy-rule-based classifier
image segmentation using a new Bayesian approach with
for land cover classification from hyperspectral imagery,”
active learning,” IEEE Trans. Geosci. Remote Sens., vol.
IEEE Trans. Geosci. Remote Sens., vol. 50, no. 1, pp.
49, no. 10, pp. 3947–3960, Oct. 2011.
130–148, Jan. 2012.

[3] F. Melgani and L. Bruzzone, “Classification of hyper-


spectral remote sensing images with Support Vector Ma-
chines,” IEEE Trans. Geosci. Remote Sens., vol. 42, no.
8, pp. 1778–1790, Aug. 2004.

[4] Y. Chen, N.M. Nasrabadi, and T.D. Tran, “Hyperspectral


image classification using dictionary-based sparse repre-
sentation,” IEEE Trans. Geosci. Remote Sens., vol. 49,
no. 10, pp. 3973–3985, Oct 2011.

2414

View publication stats

You might also like