HSI classification method based on stable quaternion generalized SVD and e-commerce application device
By using the method based on stable quaternion generalized SVD, the quaternion singular value decomposition and orthogonal triangle decomposition are used to solve the problem of low classification accuracy of the quaternion discrimination method when there are few sample data, and the hyperspectral image is realized Effective classification and improved the universality of classification methods.
Patent Information
- Application Number
- CN202411369335.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing quaternion discrimination method is difficult to achieve hyperspectral image classification when there is little sample data, resulting in insufficient classification accuracy and insufficient universality.
Using a method based on stable quaternion generalized SVD, the feature information of the high-spectral image is extracted through quaternion singular value decomposition and orthogonal triangle decomposition, and a strict diagonal matrix is obtained, thereby improving classification accuracy and universality.
Hyperspectral image classification can be effectively realized when there is little sample data, which improves the universality and accuracy of the classification method and can better capture and utilize the spatial and spectral information of the data.
Smart Images

Figure CN119251574A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of hyperspectral image classification, and in particular to an HSI classification method and an e-commerce application device based on stable quaternion generalized SVD. Background Art
[0002] Hyperspectral imaging technology combines imaging technology with spectral technology. While obtaining photos of samples, it can also obtain the chemical composition and spatial distribution information of the samples. It can detect the two-dimensional geometric spatial information and one-dimensional spectral information of the target. Therefore, it has a wide range of applications in food safety, medical diagnosis, aerospace, etc. An important step in hyperspectral imaging technology is hyperspectral image (HSI) classification. Hyperspectral image (HSI) classification first converts the spatial, spectral and radiation information contained in the hyperspectral image into an effective feature vector through a specific method, and then classifies and analyzes the sample components based on the feature vector. Traditional HSI classification methods usually rely on technologies such as spatial texture and morphological feature extraction, spatial neighborhood information acquisition, and spatial information post-processing. Although these methods have small computational requirements and sample requirements, their classification accuracy is difficult to meet the requirements. With the development of technology, the use of quaternion discrimination methods to process HSI classification is becoming more and more widespread. Quaternion is an extended complex number that contains a real part and three imaginary parts and can simultaneously represent multiple dimensions in space. In HSI classification, the application of quaternions can better capture and utilize the spatial and spectral information of data, thereby improving classification accuracy. The quaternion singular value decomposition (SVD) used is a powerful mathematical tool that is widely used in signal processing, data compression, dimensionality reduction, recommendation systems, and natural language processing. It decomposes matrices in a specific way to extract useful information. However, the use of quaternion discrimination methods to process HSI classification requires a large amount of sample data. When the sample data is small, it is difficult to use the existing quaternion discrimination method to implement HSI classification. Therefore, the existing HSI classification method is not universal enough. Therefore, it is necessary to improve the existing HSI classification method based on quaternion discrimination so that HSI classification can be achieved through quaternion discrimination even when the sample data is small, thereby improving the universality of the HSI classification method. Summary of the invention
[0003] The present invention provides an HSI classification method and an e-commerce application device based on stable quaternion generalized SVD, so as to realize HSI classification through quaternion discrimination even when the sample data is small, thereby improving the universality of the HSI classification method. In order to solve the above technical problems, the first aspect of the present invention discloses an HSI classification method based on stable quaternion generalized SVD, which is used to classify a hyperspectral image to be classified, and the method comprises: Use quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified, and obtain the quaternion set Q corresponding to the hyperspectral image to be classified h×N , where N is the number of the pixel vectors, and h is the number of the quaternion vectors corresponding to each pixel vector; Determine m training pixel vectors from the N pixel vectors to obtain a training data set Q h×m The data category set R corresponding to the training data set C×m , where m is the preset number of training samples and C is the total number of spectral categories; According to the training data set Q h×m The data category set R corresponding to the training data set C×m , determine a first quaternion matrix B to be decomposed; perform quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain a second quaternion matrix E to be decomposed; Divide the second quaternion matrix E to be decomposed into a first submatrix and a second submatrix, wherein the first submatrix is the 1st to Cth row matrix of the second quaternion matrix E to be decomposed, and the second submatrix is the C+1th to C+mth row matrix of the second quaternion matrix E to be decomposed; Performing quaternion singular value decomposition on the first sub-matrix to obtain a first decomposition matrix; Performing quaternion orthogonal triangular decomposition on the second submatrix to obtain a second decomposition matrix, and performing quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix; Determine a target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix and the second decomposition diagonal matrix; The hyperspectral image to be classified is classified according to the target projection vector matrix. As an optional implementation, in the first aspect of the present invention, the hyperspectral image to be classified includes N pixel vectors, each of the pixel vectors includes M spectral bands and the radiation value corresponding to each of the spectral bands, wherein N and M are both positive integers; the method of using quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified includes: For each pixel vector on the hyperspectral image to be classified, the M spectral bands of the pixel vector are determined as corresponding h quaternion vectors, where To round up the sign, each of the first h-1 quaternion vectors corresponding to the pixel vector is used to represent the 4 consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band, and the hth quaternion vector corresponding to the pixel vector is used to represent the M-4·h consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band. As an optional implementation, in the first aspect of the present invention, the training data set Q h×m The data category set R corresponding to the training data set C×m , determine the first quaternion matrix B to be decomposed, including: According to the training data set Q h×m The data category set R corresponding to the training data set C×m , determine the test data matrix A te ∈Q h×(N-m) , training data matrix A t ∈Q h×m The category matrix C corresponding to the training data matrix t ∈R c×m ; According to the training data matrix A t and the category matrix C t , determine the first intermediate matrix A i and the second intermediate matrix A b ; According to the first intermediate matrix A g and the second intermediate matrix A b , determine the first quaternion matrix to be decomposed B = (A b ; A i ); Among them, the first intermediate matrix A i and the second intermediate matrix A b Determined by the following formula: In the above formula, A c is the c-th type quaternion vector, is the mean vector of all c-th quaternion vectors corresponding to the hyperspectral image to be classified, For a system with 1 row m c A row vector with m elements and each element is 1, where m c is the number of c-th quaternion vectors. As an optional implementation, in the first aspect of the present invention, quaternion singular value decomposition is performed on the first quaternion matrix B to be decomposed to obtain a second quaternion matrix E to be decomposed, including: Perform quaternion singular value decomposition on the first quaternion matrix \(B\) to be decomposed according to the following formula: where \(F\) is the first auxiliary matrix, \(G\) is a real diagonal square matrix, \(E\) is the second quaternion matrix to be decomposed, and the rank of the first quaternion matrix \(B\) to be decomposed is \(k\); And, the splitting of the second quaternion matrix \(E\) into a first sub-matrix and a second sub-matrix includes: Extract the first \(k\) columns of the second quaternion matrix \(E\) as the intermediate matrix \(E(1:C + m,1:k)\); Extract the first to \(C\) rows of the intermediate matrix \(E(1:C + m,1:k)\) as the first sub-matrix \(E(1:C,1:k)\), and extract the \((C + 1)\)th to \((C + m)\)th rows of the intermediate matrix \(E(1:C,1:k)\) as the second sub-matrix \(E(C + 1:C + m,1:k)\). As an alternative implementation, in the first aspect of the present invention, performing quaternion singular value decomposition on the first sub-matrix to obtain a first decomposition matrix includes: Perform quaternion singular value decomposition on the first sub-matrix \(E(1:C,1:k)\) according to the following formula: where, is the second auxiliary matrix, \(V\) 1 is the third auxiliary matrix, \(Z\) 11 is the first decomposition diagonal matrix, and the first decomposition diagonal matrix \(Z\) 11 is a diagonal matrix with \(C\) rows and \(C\) columns of elements, and the diagonal elements of the first decomposition diagonal matrix \(Z\) 11 are all non-negative real numbers; \(\sum\) 11 is the first decomposition zero matrix, and the first decomposition zero matrix \(\sum\) 11 has \(C\) rows and \((k - C)\) columns of elements, and the elements of the first decomposition zero matrix \(\sum\) 11 are all 0; where the first decomposition matrix includes the first decomposition diagonal matrix \(Z\) 11 and the first decomposition zero matrix \(\sum\) 11 . As an alternative implementation, in the first aspect of the present invention, the quaternion orthogonal triangular decomposition of the second sub-matrix to obtain a second decomposition matrix includes: Compare the size between the preset number of training samples \(m\) and the number of columns \(k\) of the second sub-matrix \(E(C + 1:C + m,1:k)\); If \(m\lt k\), perform quaternion orthogonal triangular decomposition on the second sub-matrix \(E(C + 1:C + m,1:k)\) according to the following formula: Among them, is the fourth auxiliary matrix, and the fourth auxiliary matrix is an orthogonal quaternion matrix, and V 1 is the fifth auxiliary matrix, is the first decomposition triangular matrix, and the first decomposition triangular matrix is an upper triangular matrix with m rows and m columns of elements, is the first decomposition zero matrix, and the elements of the first decomposition zero matrix are all 0; Among them, the second decomposition matrix includes the first decomposition triangular matrix and the first decomposition zero matrix If m ≥ k, then perform quaternion orthogonal triangular decomposition on the second sub-matrix E(C+1:C+m,,1:k) according to the following formula: Among them, Σ 2,1 is the second decomposition triangular matrix, and the second decomposition triangular matrix Σ 2,1 is an upper triangular matrix with k rows and k columns of elements, and Z 21 is the second decomposition zero matrix, and the elements of the second decomposition zero matrix Z 21 are all 0; Among them, the second decomposition matrix includes the second decomposition triangular matrix Σ 2,1 and the second decomposition zero matrix Z 21 . As an alternative implementation manner, in the first aspect of the present invention, the performing quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix includes: Compare the size between the preset number of training samples m and the number of columns k of the second sub-matrix E(C+1:C+m,1:k); If m < k, then determine that the region of the elements from the (k - j + 1)-th row to the m-th row and from the (k - j + 1)-th column to the m-th column of the first decomposition triangular matrix is the first non-diagonal region, and determine the first re-decomposition sub-matrix Perform quaternion singular value decomposition on the first re-decomposition sub-matrix according to the following formula: Among them, is the sixth auxiliary matrix, is the seventh auxiliary matrix, is the eighth auxiliary matrix; Among them, the second decomposed diagonal matrix includes the seventh auxiliary matrix If m≥k, then determine the second decomposed triangular matrix Σ 2,1 The area where the elements from the (k - j + 1)-th row to the k-th row and from the (k - j + 1)-th column to the k-th column of are the second non-diagonal area, and determine the second re-decomposed sub-matrix Perform quaternion singular value decomposition on the second re-decomposed sub-matrix according to the following formula: where is the ninth auxiliary matrix, is the tenth auxiliary matrix, is the eleventh auxiliary matrix; Among them, the second decomposed diagonal matrix includes the tenth auxiliary matrix As an alternative implementation manner, in the first aspect of the present invention, the determining the target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix, and the second decomposed diagonal matrix includes: Compare the size between the preset number of training samples m and the number of columns k of the second sub-matrix E(C + 1:C + m, 1:k); If m < k, then according to the seventh auxiliary matrix determine the seventh intermediate matrix V corresponding to the seventh auxiliary matrix , and determine the first projection matrix V = V 21 ·V 1 ·V 21 ; Determine the second projection matrix I according to the following formula: Determine the initial projection vector matrix corresponding to the hyperspectral image to be classified according to the following formula: Determine the target projection vector matrix W g = W(:, q:k), where q is a preset threshold, and the threshold q ∈ {k - C + 2, k - C + 1, k - C,..., k}; If m≥k, then according to the tenth auxiliary matrix determine the tenth intermediate matrix V corresponding to the tenth auxiliary matrix , and determine the first projection matrix V = V 22 ·V 1 ·V 22 ; The second projection matrix I is determined according to the following formula: The initial projection vector matrix corresponding to the hyperspectral image to be classified is determined according to the following formula: Determine the target projection vector matrix W g =W(:,q:k), where q is a preset threshold, and the threshold q∈{k-C+2,k-C+1,kC,…,k}. As an optional implementation, in the first aspect of the present invention, the hyperspectral image to be classified is a hyperspectral image corresponding to the target sample, and the method further includes: According to the classification result obtained after classifying the hyperspectral image to be classified, multiple target chemical components on the target sample and the spatial distribution information corresponding to each of the target chemical components are determined. The second aspect of the present invention discloses an HSI classification e-commerce application device based on stable quaternion generalized SVD, the device is used to classify the hyperspectral images to be classified in e-commerce, and the device comprises: The data conversion module is used to use quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified, and obtain the quaternion set Q corresponding to the hyperspectral image to be classified. h×N , where N is the number of the pixel vectors, and h is the number of the quaternion vectors corresponding to each pixel vector; A vector analysis module is used to determine m training pixel vectors from the N pixel vectors to obtain a training data set Q h×m The data category set R corresponding to the training data set C×m , where m is the preset number of training samples and C is the total number of spectral categories; The first decomposition module is used to decompose the training data set Q h×m The data category set R corresponding to the training data set C×m , determine a first quaternion matrix B to be decomposed; perform quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain a second quaternion matrix E to be decomposed; A matrix splitting module, used for dividing the second quaternion matrix E to be decomposed into a first sub-matrix and a second sub-matrix, wherein the first sub-matrix is the 1st to Cth row matrix of the second quaternion matrix E to be decomposed, and the second sub-matrix is the C+1th to C+mth row matrix of the second quaternion matrix E to be decomposed; A second decomposition module, used for performing quaternion singular value decomposition on the first sub-matrix to obtain a first decomposition matrix; A third decomposition module is used to perform quaternion orthogonal triangular decomposition on the second sub-matrix to obtain a second decomposition matrix, and perform quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix; A projection decomposition module, used for determining a target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix and the second decomposition diagonal matrix; An image analysis module is used to classify the hyperspectral image to be classified according to the target projection vector matrix. As an optional implementation, in the second aspect of the present invention, the hyperspectral image to be classified includes N pixel vectors, each of the pixel vectors includes M spectral bands and the radiation value corresponding to each of the spectral bands, wherein N and M are both positive integers; the specific manner in which the data conversion module uses quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified includes: For each pixel vector on the hyperspectral image to be classified, the M spectral bands of the pixel vector are determined as corresponding h quaternion vectors, where To round up the sign, each of the first h-1 quaternion vectors corresponding to the pixel vector is used to represent the 4 consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band, and the hth quaternion vector corresponding to the pixel vector is used to represent the M-4·h consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band. As an optional implementation, in the second aspect of the present invention, the first decomposition module is based on the training data set Q h×m The data category set R corresponding to the training data set C×m , a specific method for determining the first quaternion matrix B to be decomposed includes: According to the training data set Q h×m The data category set R corresponding to the training data set C×m , determine the test data matrix A te ∈Q h×(N-m) , training data matrix A t ∈Q h×m The category matrix C corresponding to the training data matrix t ∈R c×m ; According to the training data matrix A t and the category matrix C t , determine the first intermediate matrix A i and the second intermediate matrix A b ; According to the first intermediate matrix A g and the second intermediate matrix A b , determine the first quaternion matrix to be decomposed B = (A b ; A i ); Among them, the first intermediate matrix A i and the second intermediate matrix A b Determined by the following formula: In the above formula, A c is the c-th type quaternion vector, is the mean vector of all c-th quaternion vectors corresponding to the hyperspectral image to be classified, For a system with 1 row m c A row vector with m elements and each element is 1, where m c is the number of c-th quaternion vectors. As an optional implementation, in the second aspect of the present invention, the first decomposition module performs quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain a specific manner of the second quaternion matrix E to be decomposed, including: The first quaternion matrix B to be decomposed is subjected to quaternion singular value decomposition according to the following formula: Wherein, F is the first auxiliary matrix, G is a real diagonal matrix, E is the second quaternion matrix to be decomposed, and the rank of the first quaternion matrix to be decomposed B is k; And, the specific manner in which the matrix splitting module divides the second quaternion matrix E to be decomposed into a first sub-matrix and a second sub-matrix includes: Extracting the first k columns of the second quaternion matrix E to be decomposed as an intermediate matrix E (1:C+m, 1:k); The contents of the 1st to Cth rows of the intermediate matrix E(1:C+m,1:k) are extracted as the first submatrix E(1:C,1:k), and the contents of the C+1th to C+mth rows of the intermediate matrix E(1:C,1:k) are extracted as the second submatrix E(C+1:C+m,1:k). As an optional implementation, in the second aspect of the present invention, the second decomposition module performs quaternion singular value decomposition on the first sub-matrix to obtain a specific manner of the first decomposition matrix, including: The first sub-matrix E(1:C, 1:k) is subjected to quaternion singular value decomposition according to the following formula: in, is the second auxiliary matrix, V 1is the third auxiliary matrix, Z 11 is the first decomposition diagonal matrix, and the first decomposition diagonal matrix Z 11 is a diagonal matrix with C rows and C columns of elements, and the diagonal elements of the first decomposition diagonal matrix Z 11 are all non - negative real numbers; Σ 11 is the first decomposition zero matrix, and the first decomposition zero matrix Σ 11 has C rows and (k - C) columns of elements, and the elements of the first decomposition zero matrix Σ 11 are all 0; Among them, the first decomposition matrix includes the first decomposition diagonal matrix Z 11 and the first decomposition zero matrix Σ 11 . As an alternative implementation, in the second aspect of the present invention, the specific manner in which the third decomposition module performs quaternion orthogonal triangular decomposition on the second sub - matrix to obtain the second decomposition matrix includes: Compare the size between the preset number of training samples m and the number of columns k of the second sub - matrix E(C + 1:C + m, 1:k); If m < k, then perform quaternion orthogonal triangular decomposition on the second sub - matrix E(C + 1:C + m, 1:k) according to the following formula: Among them, is the fourth auxiliary matrix, and the fourth auxiliary matrix is an orthogonal quaternion matrix, V 1 is the fifth auxiliary matrix, is the first decomposition triangular matrix, and the first decomposition triangular matrix is an upper triangular matrix with m rows and m columns of elements, is the first decomposition zero matrix, and the elements of the first decomposition zero matrix are all 0; Among them, the second decomposition matrix includes the first decomposition triangular matrix and the first decomposition zero matrix If m≥k, then perform quaternion orthogonal triangular decomposition on the second sub - matrix E(C + 1:C + m, 1:k) according to the following formula: Among them, Σ 2,1 is the second decomposition triangular matrix, and the second decomposition triangular matrix Σ 2,1 is an upper triangular matrix with k rows and k columns of elements, Z 21 is the second decomposition zero matrix, and the elements of the second decomposition zero matrix Z 21 are all 0; Among them, the second decomposition matrix includes the second decomposition triangular matrix Σ 2,1 and the second decomposition zero matrix Z 21 . As an alternative implementation, in the second aspect of the present invention, the specific manner in which the third decomposition module performs quaternion singular value decomposition on the second decomposition matrix to obtain the second decomposition diagonal matrix includes: Compare the size between the preset number of training samples m and the number of columns k of the second sub-matrix E(C + 1:C + m, 1:k); If m < k, determine that the area of the elements in the (k - j + 1)-th row to the m-th row and the (k - j + 1)-th column to the m-th column of the first decomposition triangular matrix is the first non-diagonal area, and determine the first re-decomposition sub-matrix Perform quaternion singular value decomposition on the first re-decomposition sub-matrix according to the following formula: where, is the sixth auxiliary matrix, is the seventh auxiliary matrix, is the eighth auxiliary matrix; where, the second decomposition diagonal matrix includes the seventh auxiliary matrix If m ≥ k, determine that the area of the elements in the (k - j + 1)-th row to the k-th row and the (k - j + 1)-th column to the k-th column of the second decomposition triangular matrix Σ 2,1 is the second non-diagonal area, and determine the second re-decomposition sub-matrix Perform quaternion singular value decomposition on the second re-decomposition sub-matrix according to the following formula: where, is the ninth auxiliary matrix, is the tenth auxiliary matrix, is the eleventh auxiliary matrix; where, the second decomposition diagonal matrix includes the tenth auxiliary matrix As an alternative implementation, in the second aspect of the present invention, the specific manner in which the projection decomposition module determines the target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix, and the second decomposition diagonal matrix includes: Compare the size between the preset number m of training samples and the number k of columns of the second sub-matrix E(C+1:C+m, 1:k); If m < k, then according to the seventh auxiliary matrix Determine the seventh auxiliary matrix The corresponding seventh intermediate matrix V 21 , and determine the first projection matrix V = V 1 ·V 21 ; Determine the second projection matrix I according to the following formula: Determine the initial projection vector matrix corresponding to the hyperspectral image to be classified according to the following formula: Determine the target projection vector matrix W g = W(:, q:k), where q is a preset threshold, and the threshold q ∈ {k - C + 2, k - C + 1, k - C,..., k}; If m ≥ k, then according to the tenth auxiliary matrix Determine the tenth auxiliary matrix The corresponding tenth intermediate matrix V 22 , and determine the first projection matrix V = V 1 ·V 22 ; Determine the second projection matrix I according to the following formula: Determine the initial projection vector matrix corresponding to the hyperspectral image to be classified according to the following formula: Determine the target projection vector matrix W g = W(:, q:k), where q is a preset threshold, and the threshold q ∈ {k - C + 2, k - C + 1, k - C,..., k}. As an optional implementation manner, in the second aspect of the present invention, the hyperspectral image to be classified is the hyperspectral image corresponding to the target sample, and the device further includes: A composition analysis module, configured to determine multiple target chemical components on the target sample and the spatial distribution information corresponding to each target chemical component according to the classification result obtained by classifying the hyperspectral image to be classified. Compared with the prior art, the present invention has the following beneficial effects: The present invention performs quaternion singular value decomposition on the first submatrix to obtain a first decomposition matrix; performs quaternion orthogonal triangular decomposition on the second submatrix to obtain a second decomposition matrix, performs quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix; and determines the target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix and the second decomposition diagonal matrix. Perform a second quaternion singular value decomposition on the diagonal submatrix with a smaller eigenvalue obtained by the first decomposition, thereby ensuring that the obtained diagonal matrix is a strict diagonal matrix, so that HSI classification can be achieved through quaternion discrimination even when the sample data is small, thereby improving the universality of the HSI classification method. BRIEF DESCRIPTION OF THE DRAWINGS In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Figure 1 It is a flowchart of an HSI classification method based on stable quaternion generalized SVD disclosed in an embodiment of the present invention; Figure 2 It is a structural schematic diagram of an HSI classification e-commerce application device based on stable quaternion generalized SVD disclosed in an embodiment of the present invention; Figure 3 It is a structural schematic diagram of another HSI classification e-commerce application device based on stable quaternion generalized SVD disclosed in an embodiment of the present invention; Figure 4 It is a structural schematic diagram of another HSI classification e-commerce application device based on stable quaternion generalized SVD disclosed in an embodiment of the present invention. DETAILED DESCRIPTION In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or end including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or ends. Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments. The present invention discloses an HSI classification method and an e-commerce application device based on stable quaternion generalized SVD, so as to realize HSI classification through quaternion discrimination even when the sample data is small, thereby improving the universality of the HSI classification method. Embodiment 1 See also Figure 1 , Figure 1 : is a flow chart of an HSI classification method based on stable quaternion generalized SVD disclosed in an embodiment of the present invention. Figure 1 The described HSI classification method based on stable quaternion generalized SVD can be applied to an HSI classification e-commerce application device based on stable quaternion generalized SVD, and the HSI classification e-commerce application device based on stable quaternion generalized SVD can be integrated in a cloud server or a local server, which is not limited in the embodiments of the present invention. Figure 1 As shown, the HSI classification method based on stable quaternion generalized SVD may include the following operations: Step 101: Use quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified, and obtain the quaternion set Q corresponding to the hyperspectral image to be classified h×N . In the embodiment of the present invention, N is the number of pixel vectors, and h is the number of quaternion vectors corresponding to each pixel vector; a quaternion is an extended complex number, including a real part and three imaginary parts, and can simultaneously represent multiple dimensions in space. Optionally, the spectral vector of each pixel can be mapped to the imaginary part of the quaternion, and the real part can be set to zero or a constant. For example, the hyperspectral image to be classified may include N pixel vectors, each pixel vector includes M spectral bands and the radiation value corresponding to each spectral band, where N and M are both positive integers. In the embodiment of the present invention, further optionally, using quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified may include: For each pixel vector on the hyperspectral image to be classified, the M spectral bands of the pixel vector are determined as corresponding h quaternion vectors, where: To round up the sign, each of the first h-1 quaternion vectors corresponding to the pixel vector is used to represent the 4 consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band, and the hth quaternion vector corresponding to the pixel vector is used to represent the M-4·h consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band. This embodiment determines the M spectral bands of each pixel vector as corresponding h quaternion vectors, wherein each quaternion vector represents four consecutive spectra in the M spectral bands of the corresponding pixel vector. For example, the pixel vector A is: {(Band: infrared light; intensity: 21)(Band: red light 1; intensity: 15)(Band: red light 2; intensity: 14)(Band: yellow light; intensity: 45)(Band: green light; intensity: 33)(Band: blue light; intensity: 78)(Band: purple light; intensity: 27)(Band: ultraviolet light; intensity: 33)} Represent the pixel vector A with a quaternion, then the four consecutive bands in the pixel vector A: {(band: infrared light; intensity: 21)(band: red light 1; intensity: 15)(band: red light 2; intensity: 14)(band: yellow light; intensity: 45)} are represented by a quaternion q1; the other four consecutive bands in the pixel vector A: {(band: green light; intensity: 33)(band: blue light; intensity: 78)(band: purple light; intensity: 27)(band: ultraviolet light; intensity: 33)} are represented by a quaternion q2. It can be seen that this embodiment can more efficiently use quaternions to represent pixel vectors, thereby obtaining a more efficient and practical quaternion set corresponding to the hyperspectral image to be classified. Step 102: Determine m training pixel vectors from the N pixel vectors to obtain a training data set Q h×m The data category set R corresponding to the training data set C×m . In the embodiment of the present invention, m is the preset number of training samples, and C is the total number of spectral categories. Step 103: Based on the training data set Q h×m The data category set R corresponding to the training data set C×m, determine the first quaternion matrix B to be decomposed; perform quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain the second quaternion matrix E to be decomposed. In an embodiment of the present invention, quaternion singular value decomposition is a mathematical method for processing quaternion matrices. In the singular value decomposition of a quaternion matrix, a quaternion matrix can be decomposed into the product of three matrices: the left singular vectors, the right singular vectors and the diagonal matrix of the quaternion matrix, wherein the left singular vectors and the right singular vectors of the quaternion matrix are orthogonal; the elements on the diagonal are singular values, which are the square roots of the eigenvalues of the decomposed matrix. Step 104: divide the second quaternion matrix E to be decomposed into a first sub-matrix and a second sub-matrix. In the embodiment of the present invention, the first submatrix is the 1st to Cth row matrices of the second quaternion matrix E to be decomposed, and the second submatrix is the C+1th to C+mth row matrices of the second quaternion matrix E to be decomposed. Step 105: Perform quaternion singular value decomposition on the first sub-matrix to obtain a first decomposition matrix. Step 106: Perform quaternion orthogonal triangular decomposition on the second submatrix to obtain a second decomposition matrix, and perform quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix. In the case of small samples, the traditional discriminant analysis based on quaternion generalized singular value decomposition (QUR) does not obtain a diagonal matrix with smaller eigenvalues in the strict sense, resulting in a low accuracy rate in extracting HSI feature information. In view of the above problem, an HSI classification method based on stable quaternion generalized SVD is proposed in an embodiment of the present invention for HSI feature extraction, and a second quaternion singular value decomposition is performed on the diagonal submatrix with smaller eigenvalues obtained by the first decomposition, thereby ensuring that the obtained diagonal matrix is a strict diagonal matrix. Step 107: determining a target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix and the second decomposition diagonal matrix; Traditional methods such as principal component analysis (PCA) and linear discriminant analysis (LDA) are projection classification methods in the real number domain. The vector expression ability is limited, and they cannot solve the crosstalk of strong correlation between adjacent spectral bands, nor can they fully utilize the dimensional information of hyperspectral images. The quaternion projection vector matrix expresses the characteristics of the quaternion in a specific direction and reduces the interference between adjacent spectra. Step 108: classify the hyperspectral image to be classified according to the target projection vector matrix. Usually, the number of bands of remote sensing images is very large, and it is not easy to obtain training samples. Therefore, the number of samples is usually small. Especially when the dimension of the number of samples does not reach the number of bands of the quaternion, it is difficult to use the existing quaternion discrimination method to realize HSI classification. In the embodiment of the present invention, the first submatrix is subjected to quaternion singular value decomposition to obtain a first decomposition matrix; the second submatrix is subjected to quaternion orthogonal triangular decomposition to obtain a second decomposition matrix; the second decomposition matrix is subjected to quaternion singular value decomposition to obtain a second decomposition diagonal matrix; the target projection vector matrix corresponding to the hyperspectral image to be classified is determined according to the first decomposition matrix, the second decomposition matrix and the second decomposition diagonal matrix. The diagonal submatrix with a smaller eigenvalue obtained by the first decomposition is subjected to a second quaternion singular value decomposition to ensure that the obtained diagonal matrix is a strict diagonal matrix, so that HSI classification can be achieved through quaternion discrimination even when the sample data is small, thereby improving the universality of the HSI classification method. In an optional embodiment, according to the training data set Q h×m The data category set R corresponding to the training data set C×m , determining the first quaternion matrix B to be decomposed may include: According to the training data set Q h×m The data category set R corresponding to the training data set C×m , determine the test data matrix A te ∈Q h×(N-m) , training data matrix A t ∈Q h×m The category matrix C corresponding to the training data matrix t ∈R c×m ; According to the training data matrix A t and the category matrix C t , determine the first intermediate matrix A i and the second intermediate matrix A b ; According to the first intermediate matrix A g and the second intermediate matrix A b , determine the first quaternion matrix to be decomposed B = (A b ; A i ); In this optional embodiment, the first intermediate matrix A i and the second intermediate matrix A b Determined by the following formula: In the above formula, A c is the c-th type quaternion vector, is the mean vector of all c-th quaternion vectors corresponding to the hyperspectral image to be classified, For a system with 1 row m c A row vector with m elements and each element is 1, where m c is the number of c-th quaternion vectors. In another optional embodiment, performing quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain the second quaternion matrix E to be decomposed may include: The first quaternion matrix B to be decomposed is subjected to quaternion singular value decomposition according to the following formula: Wherein, F is the first auxiliary matrix, G is a real diagonal matrix, E is the second quaternion matrix to be decomposed, and the rank of the first quaternion matrix to be decomposed B is k; And, dividing the second quaternion matrix E to be decomposed into a first sub-matrix and a second sub-matrix, including: Extract the first k columns of the second quaternion matrix E to be decomposed as the intermediate matrix E (1:C+m, 1:k); The contents of the 1st to Cth rows of the intermediate matrix E(1:C+m,1:k) are extracted as the first submatrix E(1:C,1:k), and the contents of the C+1th to C+mth rows of the intermediate matrix E(1:C,1:k) are extracted as the second submatrix E(C+1:C+m,1:k). In yet another optional embodiment, performing quaternion singular value decomposition on the first submatrix to obtain a first decomposition matrix may include: The quaternion singular value decomposition of the first submatrix E(1:C,1:k) is performed according to the following formula: in, is the second auxiliary matrix, V 1 is the third auxiliary matrix, Z 11 is the first decomposition diagonal matrix, the first decomposition diagonal matrix Z 11 is a diagonal matrix with C rows by C columns, and the first decomposition diagonal matrix Z 11 The diagonal elements of are all non-negative real numbers; 11 is the first decomposition zero matrix, the first decomposition zero matrix Σ 11 has C rows by (kC) columns of elements, and the first decomposition is a zero matrix Σ 11 The elements of are all 0; The first decomposition matrix includes the first decomposition diagonal matrix Z 11 and the first decomposition zero matrix Σ 11 . In yet another optional embodiment, performing quaternion orthogonal triangular decomposition on the second submatrix to obtain a second decomposition matrix may include: Compare the size between the preset number of training samples \(m\) and the number of columns \(k\) of the second sub-matrix \(E(C + 1:C + m,1:k)\); If \(m\lt k\), perform quaternion orthogonal triangular decomposition on the second sub-matrix \(E(C + 1:C + m,1:k)\) according to the following formula: Among them, is the fourth auxiliary matrix, and the fourth auxiliary matrix is an orthogonal quaternion matrix, \(V\) 1 is the fifth auxiliary matrix, is the first decomposition triangular matrix, and the first decomposition triangular matrix is an upper triangular matrix with \(m\) rows and \(m\) columns of elements, is the first decomposition zero matrix, and the first decomposition zero matrix has all elements equal to 0; Among them, the second decomposition matrix includes the first decomposition triangular matrix and the first decomposition zero matrix If \(m\geq k\), perform quaternion orthogonal triangular decomposition on the second sub-matrix \(E(C + 1:C + m,1:k)\) according to the following formula: Among them, \(\sum\) 2,1 is the second decomposition triangular matrix, and the second decomposition triangular matrix \(\sum\) 2,1 is an upper triangular matrix with \(k\) rows and \(k\) columns of elements, \(Z\) 21 is the second decomposition zero matrix, and the second decomposition zero matrix \(Z\) 21 has all elements equal to 0; Among them, the second decomposition matrix includes the second decomposition triangular matrix \(\sum\) 2,1 and the second decomposition zero matrix \(Z\) 21 . In yet another alternative embodiment, performing quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix may include: Compare the size between the preset number of training samples \(m\) and the number of columns \(k\) of the second sub-matrix \(E(C + 1:C + m,1:k)\); If \(m\lt k\), determine that the region of the elements in the \(k - j+1\)th row to the \(m\)th row and the \(k - j+1\)th column to the \(m\)th column of the first decomposition triangular matrix is the first non-diagonal region, and determine the first re-decomposition sub-matrix Perform quaternion singular value decomposition on the first re-decomposition sub-matrix according to the following formula:: Among them, is the sixth auxiliary matrix, is the seventh auxiliary matrix, is the eighth auxiliary matrix; Among them, the second decomposition diagonal matrix includes the seventh auxiliary matrix If m≥k, then determine the elements in the (k - j + 1)-th row to the k-th row and the (k - j + 1)-th column to the k-th column of the second decomposition triangular matrix Σ 2,1 as the second non-diagonal region, and determine the second re-decomposition sub-matrix Perform quaternion singular value decomposition on the second re-decomposition sub-matrix according to the following formula: Among them, is the ninth auxiliary matrix, is the tenth auxiliary matrix, is the eleventh auxiliary matrix; Among them, the second decomposition diagonal matrix includes the tenth auxiliary matrix In another optional embodiment, determining the target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix, and the second decomposition diagonal matrix may include: Compare the size between the preset number of training samples m and the number of columns k of the second sub-matrix E(C + 1:C + m, 1:k); If m < k, then determine the seventh intermediate matrix V corresponding to the seventh auxiliary matrix according to the seventh auxiliary matrix 21 , and determine the first projection matrix V = V 1 ·V 21 ; Determine the second projection matrix I according to the following formula: Determine the initial projection vector matrix corresponding to the hyperspectral image to be classified according to the following formula: Determine the target projection vector matrix W g = W(:, q:k), where q is a preset threshold, and the threshold q ∈ {k - C + 2, k - C + 1, k - C,..., k}; If m≥k, then determine the tenth intermediate matrix V corresponding to the tenth auxiliary matrix according to the tenth auxiliary matrix 22 , and determine the first projection matrix V = V 1 ·V 22 ; The second projection matrix I is determined according to the following formula: Determine the initial projection vector matrix corresponding to the hyperspectral image to be classified according to the following formula: Determine the target projection vector matrix W g =W(:,q:k), where q is a preset threshold, threshold q∈{k-C+2,k-C+1,kC,…,k}. In yet another optional embodiment, the hyperspectral image to be classified is a hyperspectral image corresponding to the target sample, and the method may further include: According to the classification results obtained after classifying the hyperspectral image to be classified, multiple target chemical components on the target sample and the spatial distribution information corresponding to each target chemical component are determined. An optional application scenario of this optional embodiment is: quality monitoring of agricultural products in e-commerce. The rapid development of e-commerce has enabled agricultural products to be quickly sold to customers, but the quality of agricultural products sold online is mixed, and the quality of agricultural products cannot be effectively guaranteed. For example, the bright and shiny fruit on the surface may have been eaten by insects or rotted inside. For another example, there are many varieties of crop seeds in the seed market. The counterfeiting behavior of some illegal vendors makes it difficult to distinguish the authenticity of seeds, and seed buyers cannot distinguish the authenticity of seeds. Therefore, the detection and authenticity of agricultural product quality is an urgent problem to be solved. Most traditional detection methods are based on manual detection and supplemented by chemical analysis methods. These methods are time-consuming and laborious, and cannot achieve large-scale detection. Machine vision technology can identify the size, shape, color and texture of objects; but it is not helpful for detecting damage under the peel, nor can it be used to evaluate the internal quality of fruits. Hyperspectral imaging technology combines imaging technology and spectroscopy technology to obtain spatial and continuous spectral information from samples, which can greatly enhance the ability to identify and detect various chemical components and their spatial distribution of fruits, and judge the internal quality of fruits. In another optional embodiment, the sample spectra can be divided into training sample spectra and test sample spectra, and the training sample spectra can be divided into agricultural products bitten by insects, infected by fungi such as aflatoxin, penicillium, glaucocyanin, and niger, and normal agricultural products. In the case of small samples, the traditional discriminant analysis based on quaternion generalized singular value decomposition (QUR) is not a strictly diagonal matrix with a small eigenvalue obtained by the first orthogonal triangular decomposition (QUR), resulting in errors in the extraction of HSI feature information. The HSI classification method based on stable quaternion generalized SVD in the embodiment of the present invention is used for HSI feature extraction, and the diagonal submatrix with a small eigenvalue obtained by the first QUR is subjected to a second quaternion singular value decomposition, thereby ensuring that the obtained diagonal matrix is a strictly diagonal matrix. Further, the principle of the embodiment of the present invention is described as follows: Input quaternion HSI test dataset A tte ∈Q h×(N-m) , quaternion HSI training dataset A t ∈Q h×m And the category matrix C to which the pixels in the training dataset belong t ∈R C×m , where m is the number of training samples, C is the total number of categories, h is the number of quaternion bands of hyperspectral data, and the output is the quaternion projection vector W g ∈Q H×C And the quaternion features of the extracted test samples make Where c=1,2,…,C, is the quaternion mean vector of all training samples, A c is the c-th type quaternion training sample, is the mean vector of the quaternion of the c-th training sample, is a row vector whose elements are all 1, where m c is the number of training samples in the cth category. For the quaternion combination matrix B = [A b ; A i ]∈Q (C+m)×h Perform quaternion singular value decomposition and obtain the following formula: Where G is a real diagonal matrix. Let the rank of matrix B be k = rank(B), then k is also the number of rows or columns of matrix G. Perform CS decomposition on the first k columns of the column orthogonal matrix E (1: (C + m), 1: k), the specific process is as follows. b )=C-1,rank(A i)=m≥C, so rank([A b ; A i ])≥C, that is, k≥C. The result of quaternion singular value decomposition (QSVD) of the sub-quaternion matrix E(1:C,1:k) of the quaternion matrix E(1:(C+m),1:k) is U 11 H E(1:C,1::k)V 1 =[Z 11 ,Σ 11 ], where Σ 11 ∈R C×C is a diagonal matrix with non-negative real elements. The matrix Z 11 ∈R C×(k-C) The elements of are all 0. Let Σ 11 =diag(α C ,α C-1 ,…,α 1 ), with γ as the boundary, put Σ 11 The diagonal elements of are divided into two parts, 0 = α C ≤α C-1 ≤…≤α j+1 ≤γ<α j ≤…≤α 2 ≤α 1 ≤1, let γ=2 -0.1 . Another quaternion submatrix E(C+1:C+m,1:k) of the quaternion matrix E(1:(C+m),1:k) and V 1 The product matrix E(C+1:C+m,1:k)V 1 Perform an orthogonal triangular decomposition (QUR decomposition) of the quaternion matrix, the result of which is: Among them U 21 ∈Q m×m is an orthogonal quaternion matrix, Σ 2,1 and is an upper triangular matrix, the matrix Z 21 and The elements of are all 0. According to the previous analysis, we can get the following formula: The fourth step of the above formula uses the multiplication of block quaternion matrices. 21 H E(C+1:C+m,1:k)V) H U 21 H E(C+1:C+m,1:k) is a diagonal matrix. According to the properties of matrix multiplication, E(C+1:C+m,1:k)V 1 The upper triangular matrix obtained from the QUR decomposition of 2,1 and is also a diagonal matrix, that is, Σ Combining the above formulas gives the following results: When m < k, When m ≥ k, Let where 1 ≥ β m ≥ β m-1 ≥ … ≥ β k-j ≥ … ≥ β 2 ≥ β 1 ≥ 0; Let Σ 2,1 = diag(δ k , …, δ 1 ), where 1 ≥ δ k ≥ δ k-1 ≥ … δ j+1 ≥ δ j ≥ … ≥ δ 2 ≥ δ 1 ≥ 0. Although the theoretical proof is a real diagonal matrix, but when the nuclear norm or l 1 norm of E(C+1:C+m,1:k)V 2,1 is too small, due to the computing precision of the computer and the characteristics of the QSVD and QUR algorithms themselves, it will cause not to be a completely diagonal matrix. Specifically, the elements on the diagonal of the lower right sub-square matrix of are very small and are approximately the same size as the elements on the non-diagonal. To avoid this situation, the embodiments of the present invention perform another CS decomposition on the lower right non-diagonal sub-matrix of When m > k, That is, That is, At this time, Let Then is the sub-matrix that needs to perform quaternion singular value decomposition. The result of performing quaternion singular value decomposition on the matrix is where is a real diagonal matrix. Let be a column orthogonal matrix. For The result of performing QUR decomposition is Since is a diagonal matrix and all diagonal elements are greater than Υ, so is guaranteed to be a real diagonal matrix. Let where Then U 1 = U 11 U 12 . Let where Let V = V 1 V 2 . Let where where m is the order of the square matrix U 21 Then U 2 = U 21 U 22 . Let According to the multiplication rule of block matrices, we can get: where is Σ 2,1 (1:k - j, 1:k - j), and is a real diagonal matrix; where Let According to the multiplication rule of block matrices, we can get: Similar to the above derivation process, it is easy to obtain the following formula: When m < k, since That is That is where and are diagonal matrices. Let where Since So and is the submatrix in the lower right corner Since is not a standard diagonal matrix, so is the submatrix that needs to be decomposed by quaternion singular value decomposition again. It should be noted that m - (k - j) = j - (k - m). The result of performing quaternion singular value decomposition on the matrix is at this time is a real diagonal matrix, let make Among them I U221 ∈R (k-j)×(k-j) , then U 2 =U 21 U 22 .make Among them I V21 ∈R (k-j)×(k-j) , I V23 ∈R (k-m)×(k-m) , then V=V 1 V 2 , because V 2 is a quaternion orthogonal matrix, so V is also a quaternion orthogonal matrix. This gives: Let Σ 11 The submatrix corresponding to the lower right corner block (C-j+1:C-(km),C-j+1:C-(km)) is at this time: Right now right The result of UR decomposition is make Among them I u121 ∈R (C-j)×(C-j) , I u123 ∈R (k-m)×(k-m) , then U 1 =U 11 U 12 ;make Then we can get: It is easy to conclude that: make Then the quaternion projection matrix of quaternion discriminant analysis based on the stable QDASGSVD method is W g =W(:,q:k) Where q∈{k-C+2,k-C+1,…,k}, the optimal value of q can be preset according to the specific scenario. g The column vectors of are right linearly independent. When q = k-C + 2, the discriminant formula between the inter-class scatter matrix Sb and the global scatter matrix St of the stable QDASGSVD method is: It can be concluded that: because all And because Σ BT Σ B +Σ w T Σ w =I, where I is the identity matrix, so Therefore, when q = k-C + 2, the root QDASGSVD discriminant coefficient is Embodiment 2 See also Figure 2 , Figure 2 Schematic diagram of the structure of an HSI classification e-commerce application device based on stable quaternion generalized SVD disclosed in an embodiment of the present invention. The HSI classification e-commerce application device based on stable quaternion generalized SVD is used to classify hyperspectral images to be classified in e-commerce, such as Figure 2 As shown, the HSI classification e-commerce application device based on stable quaternion generalized SVD may include: The data conversion module 201 is used to use quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified, and obtain the quaternion set Q corresponding to the hyperspectral image to be classified h×N , where N is the number of pixel vectors, and h is the number of quaternion vectors corresponding to each pixel vector; The vector analysis module 202 is used to determine m training pixel vectors from N pixel vectors and obtain a training data set Q h×m The data category set R corresponding to the training data set C×m , where m is the preset number of training samples and C is the total number of spectral categories; The first decomposition module 203 is used to decompose the training data set Q h×m The data category set R corresponding to the training data set C×m , determine a first quaternion matrix B to be decomposed; perform quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain a second quaternion matrix E to be decomposed; A matrix splitting module 204 is used to split the second quaternion matrix E to be decomposed into a first sub-matrix and a second sub-matrix, wherein the first sub-matrix is the 1st to Cth row matrix of the second quaternion matrix E to be decomposed, and the second sub-matrix is the C+1th to C+mth row matrix of the second quaternion matrix E to be decomposed; A second decomposition module 205 is used to perform quaternion singular value decomposition on the first sub-matrix to obtain a first decomposition matrix; A third decomposition module 206 is used to perform quaternion orthogonal triangular decomposition on the second submatrix to obtain a second decomposition matrix, and perform quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix; A projection decomposition module 207 is used to determine a target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix and the second decomposition diagonal matrix; The image analysis module 208 is used to classify the hyperspectral image to be classified according to the target projection vector matrix. In the embodiment of the present invention, the first submatrix is subjected to quaternion singular value decomposition to obtain a first decomposition matrix; the second submatrix is subjected to quaternion orthogonal triangular decomposition to obtain a second decomposition matrix; the second decomposition matrix is subjected to quaternion singular value decomposition to obtain a second decomposition diagonal matrix; the target projection vector matrix corresponding to the hyperspectral image to be classified is determined according to the first decomposition matrix, the second decomposition matrix and the second decomposition diagonal matrix. The diagonal submatrix with a smaller eigenvalue obtained by the first decomposition is subjected to a second quaternion singular value decomposition to ensure that the obtained diagonal matrix is a strict diagonal matrix, so that HSI classification can be achieved through quaternion discrimination even when the sample data is small, thereby improving the universality of the HSI classification method. In an optional embodiment, the hyperspectral image to be classified may include N pixel vectors, each pixel vector may include M spectral bands and the radiation value corresponding to each spectral band, wherein N and M are both positive integers; the specific manner in which the data conversion module 201 uses quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified may include: For each pixel vector on the hyperspectral image to be classified, the M spectral bands of the pixel vector are determined as corresponding h quaternion vectors, where: To round up the sign, each of the first h-1 quaternion vectors corresponding to the pixel vector is used to represent the 4 consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band, and the hth quaternion vector corresponding to the pixel vector is used to represent the M-4·h consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band. It can be seen that this embodiment can more efficiently use quaternions to represent pixel vectors, thereby obtaining a more efficient and practical quaternion set corresponding to the hyperspectral image to be classified. In another optional embodiment, the first decomposition module 203 is based on the training data set Q h×m The data category set R corresponding to the training data set C×m , a specific method for determining the first quaternion matrix B to be decomposed may include: According to the training data set Q h×m The data category set R corresponding to the training data set C×m , determine the test data matrix A te ∈Q h×(N-m) , training data matrix A t ∈Qh×m The category matrix C corresponding to the training data matrix t ∈R c×m ; According to the training data matrix A t and the category matrix C t , determine the first intermediate matrix A i and the second intermediate matrix A b ; According to the first intermediate matrix A g and the second intermediate matrix A b , determine the first quaternion matrix to be decomposed B = (A b ; A i ); Among them, the first intermediate matrix A i and the second intermediate matrix A b Determined by the following formula: In the above formula, A c is the c-th type quaternion vector, is the mean vector of all c-th quaternion vectors corresponding to the hyperspectral image to be classified, For a system with 1 row m c A row vector with m elements and each element is 1, where m c is the number of c-th quaternion vectors. In another optional embodiment, the first decomposition module 203 performs quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain the second quaternion matrix E to be decomposed, which may include: The first quaternion matrix B to be decomposed is subjected to quaternion singular value decomposition according to the following formula: Wherein, F is the first auxiliary matrix, G is a real diagonal matrix, E is the second quaternion matrix to be decomposed, and the rank of the first quaternion matrix to be decomposed B is k; And, the specific manner in which the matrix splitting module 204 divides the second quaternion matrix E to be decomposed into the first sub-matrix and the second sub-matrix may include: Extract the first k columns of the second quaternion matrix E to be decomposed as the intermediate matrix E (1:C+m, 1:k); The contents of the 1st to Cth rows of the intermediate matrix E(1:C+m,1:k) are extracted as the first submatrix E(1:C,1:k), and the contents of the C+1th to C+mth rows of the intermediate matrix E(1:C,1:k) are extracted as the second submatrix E(C+1:C+m,1:k). In yet another alternative embodiment, the specific manner in which the second decomposition module 205 performs quaternion singular value decomposition on the first sub-matrix to obtain the first decomposition matrix may include: Perform quaternion singular value decomposition on the first sub-matrix E(1:C, 1:k) according to the following formula: wherein, is the second auxiliary matrix, V 1 is the third auxiliary matrix, Z 11 is the first decomposition diagonal matrix, and the first decomposition diagonal matrix Z 11 is a diagonal matrix with C rows by C columns of elements, and the diagonal elements of the first decomposition diagonal matrix Z 11 are all non-negative real numbers; Σ 11 is the first decomposition zero matrix, and the first decomposition zero matrix Σ 11 has C rows by (k - C) columns of elements, and the elements of the first decomposition zero matrix Σ 11 are all 0; wherein, the first decomposition matrix may include the first decomposition diagonal matrix Z 11 and the first decomposition zero matrix Σ 11 . In yet another alternative embodiment, the specific manner in which the third decomposition module 206 performs quaternion orthogonal triangular decomposition on the second sub-matrix to obtain the second decomposition matrix may include: Compare the size between the preset number of training samples m and the number of columns k of the second sub-matrix E(C + 1:C + m, 1:k); If m < k, then perform quaternion orthogonal triangular decomposition on the second sub-matrix E(C + 1:C + m, 1:k) according to the following formula: wherein, is the fourth auxiliary matrix, and the fourth auxiliary matrix is an orthogonal quaternion matrix, V 1 is the fifth auxiliary matrix, is the first decomposition triangular matrix, and the first decomposition triangular matrix is an upper triangular matrix with m rows by m columns of elements, is the first decomposition zero matrix, and the elements of the first decomposition zero matrix are all 0; wherein, the second decomposition matrix may include the first decomposition triangular matrix and the first decomposition zero matrix If m ≥ k, then perform quaternion orthogonal triangular decomposition on the second sub-matrix E(C + 1:C + m, 1:k) according to the following formula: Among them, Σ 2,1 is the second decomposition triangular matrix, and the second decomposition triangular matrix Σ 2,1 is an upper triangular matrix with k rows and k columns of elements, and Z 21 is the second decomposition zero matrix, and all elements of the second decomposition zero matrix Z 21 are 0; Among them, the second decomposition matrix may include the second decomposition triangular matrix Σ 2,1 and the second decomposition zero matrix Z 21 . In yet another alternative embodiment, the specific manner in which the third decomposition module 206 performs quaternion singular value decomposition on the second decomposition matrix to obtain the second decomposition diagonal matrix may include: Compare the size between the preset number of training samples m and the number of columns k of the second submatrix E(C + 1:C + m, 1:k); If m < k, then determine that the region of the elements in the (k - j + 1)-th row to the m-th row and the (k - j + 1)-th column to the m-th column of the first decomposition triangular matrix is the first non-diagonal region, and determine the first re-decomposition submatrix Perform quaternion singular value decomposition on the first re-decomposition submatrix according to the following formula:: Among them, is the sixth auxiliary matrix, is the seventh auxiliary matrix, is the eighth auxiliary matrix; Among them, the second decomposition diagonal matrix may include the seventh auxiliary matrix If m ≥ k, then determine that the region of the elements in the (k - j + 1)-th row to the k-th row and the (k - j + 1)-th column to the k-th column of the second decomposition triangular matrix Σ 2,1 is the second non-diagonal region, and determine the second re-decomposition submatrix Perform quaternion singular value decomposition on the second re-decomposition submatrix according to the following formula: Among them, is the ninth auxiliary matrix, is the tenth auxiliary matrix, is the eleventh auxiliary matrix; Among them, the second decomposition diagonal matrix may include the tenth auxiliary matrix In yet another alternative embodiment, the specific manner in which the projection decomposition module 207 determines the target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix, and the second decomposition diagonal matrix may include: Compare the size between the preset number of training samples m and the number of columns k of the second sub-matrix E(C+1:C+m,1:k); If m < k, then according to the seventh auxiliary matrix Determine the seventh auxiliary matrix The corresponding seventh intermediate matrix V 21 , and determine the first projection matrix V = V 1 ·V 21 ; Determine the second projection matrix I according to the following formula: Determine the initial projection vector matrix corresponding to the hyperspectral image to be classified according to the following formula: Determine the target projection vector matrix W g = W(:,q:k), where q is a preset threshold, and the threshold q ∈ {k-C+2,k-C+1,k-C,…,k}; If m ≥ k, then according to the tenth auxiliary matrix Determine the tenth auxiliary matrix The corresponding tenth intermediate matrix V 22 , and determine the first projection matrix V = V 1 ·V 22 ; Determine the second projection matrix I according to the following formula: Determine the initial projection vector matrix corresponding to the hyperspectral image to be classified according to the following formula: Determine the target projection vector matrix W g = W(:,q:k), where q is a preset threshold, and the threshold q ∈ {k-C+2,k-C+1,k-C,…,k}. In yet another alternative embodiment, the hyperspectral image to be classified is the hyperspectral image corresponding to the target sample, as Figure 3 shown, the device may further include: A composition analysis module 209, configured to determine a plurality of target chemical components on the target sample and the spatial distribution information corresponding to each target chemical component according to the classification result obtained by classifying the hyperspectral image to be classified. Embodiment III Please refer to Figure 4, Figure 4 is a schematic diagram of the structure of another HSI classification e-commerce application device based on stable quaternion generalized SVD disclosed in an embodiment of the present invention. The device is used to classify hyperspectral images to be classified in e-commerce, such as Figure 4 As shown, the HSI classification e-commerce application device based on stable quaternion generalized SVD may include: A memory 301 storing executable program codes; a processor 302 coupled to the memory 301; The processor 302 calls the executable program code stored in the memory 301 to execute the steps of the HSI classification method based on stable quaternion generalized SVD described in the first embodiment of the present invention. Embodiment 4 An embodiment of the present invention discloses a computer storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute the steps of the HSI classification method based on stable quaternion generalized SVD described in the first embodiment of the present invention. Embodiment 5 An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable a computer to execute the steps in the HSI classification method based on stable quaternion generalized SVD described in Embodiment 1. The device embodiments described above are only illustrative, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, i.e., they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work. Through the specific description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solution can be essentially or partly contributed to the prior art in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data. Finally, it should be noted that the HSI classification method based on stable quaternion generalized SVD and the e-commerce application device disclosed in the embodiment of the present invention are only the preferred embodiments of the present invention, which are only used to illustrate the technical solution of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A HSI classification method based on stable quaternion generalized SVD, characterized in that: The method is used for classifying a hyperspectral image to be classified, and the method includes: Use quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified, and obtain the quaternion set Q corresponding to the hyperspectral image to be classified h×N , where N is the number of the pixel vectors, and h is the number of the quaternion vectors corresponding to each pixel vector; Determine m training pixel vectors from the N pixel vectors to obtain a training data set Q h×m The data category set R corresponding to the training data set C×m , where m is the preset number of training samples and C is the total number of spectral categories; According to the training data set Q h×m The data category set R corresponding to the training data set C×m , determine a first quaternion matrix B to be decomposed; perform quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain a second quaternion matrix E to be decomposed; Dividing the second quaternion matrix E to be decomposed into a first sub-matrix and a second sub-matrix, where the first sub-matrix is the matrix of the 1st to Cth rows of the second quaternion matrix E to be decomposed, and the second sub-matrix is the matrix of the (C + 1)th to (C + m)th rows of the second quaternion matrix E to be decomposed; Performing quaternion singular value decomposition on the first sub-matrix to obtain a first decomposition matrix; Performing quaternion orthogonal triangular decomposition on the second sub-matrix to obtain a second decomposition matrix, and performing quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix; Determining a target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix, and the second decomposition diagonal matrix; Classifying the hyperspectral image to be classified according to the target projection vector matrix.
2. The HSI classification method based on stable quaternion generalized SVD according to claim 1, characterized in that: The hyperspectral image to be classified includes N pixel vectors, each pixel vector includes M spectral bands and the radiation value corresponding to each spectral band, where both N and M are positive integers; Representing all pixel vectors of the hyperspectral image to be classified using quaternion vectors, including: For each pixel vector on the hyperspectral image to be classified, the M spectral bands of the pixel vector are determined as corresponding h quaternion vectors, where To round up the sign, each of the first h-1 quaternion vectors corresponding to the pixel vector is used to represent the 4 consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band, and the hth quaternion vector corresponding to the pixel vector is used to represent the M-4·h consecutive spectral bands on the pixel vector and the radiation value corresponding to each spectral band.
3. The HSI classification method based on stable quaternion generalized SVD according to claim 2, characterized in that: According to the training data set Q h×m The data category set R corresponding to the training data set C×m , determine the first quaternion matrix B to be decomposed, including: According to the training data set Q h×m The data category set R corresponding to the training data set C×m , determine the test data matrix A te ∈Q h×(N-m) , training data matrix A t ∈Q h×m The category matrix C corresponding to the training data matrix t ∈R c×m ; According to the training data matrix A t and the category matrix C t , determine the first intermediate matrix A i and the second intermediate matrix A b ; According to the first intermediate matrix A g and the second intermediate matrix A b , determine the first quaternion matrix to be decomposed B = (A b ; A i ); Among them, the first intermediate matrix A i and the second intermediate matrix A b Determined by the following formula: In the above formula, A c is the c-th type quaternion vector, is the mean vector of all c-th quaternion vectors corresponding to the hyperspectral image to be classified, For a system with 1 row m c A row vector with m elements and each element is 1, where m c is the number of c-th quaternion vectors.
4. The HSI classification method based on stable quaternion generalized SVD according to claim 3, characterized in that: Performing quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain a second quaternion matrix E to be decomposed, including: Performing quaternion singular value decomposition on the first quaternion matrix B to be decomposed according to the following formula: where F is a first auxiliary matrix, G is a real diagonal square matrix, E is a second quaternion matrix to be decomposed, and the rank of the first quaternion matrix B to be decomposed is k; And, the dividing the second quaternion matrix E to be decomposed into a first sub-matrix and a second sub-matrix includes: Extracting the first k columns of the second quaternion matrix E to be decomposed as an intermediate matrix E(1:C + m,1:k); Extracting the content of the 1st to Cth rows of the intermediate matrix E(1:C + m,1:k) as a first sub-matrix E(1:C,1:k), and extracting the content of the (C + 1)th to (C + m)th rows of the intermediate matrix E(1:C,1:k) as a second sub-matrix E(C + 1:C + m,1:k).
5. The HSI classification method based on stable quaternion generalized SVD according to claim 4, characterized in that: Performing quaternion singular value decomposition on the first sub-matrix to obtain a first decomposition matrix, including: Performing quaternion singular value decomposition on the first sub-matrix E(1:C,1:k) according to the following formula: in, is the second auxiliary matrix, V1 is the third auxiliary matrix, Z 11 is the first decomposition diagonal matrix, wherein the first decomposition diagonal matrix Z 11 is a diagonal matrix with C rows and C columns, and the first decomposed diagonal matrix Z 11 The diagonal elements of are all non-negative real numbers; 11 is the first decomposition zero matrix, the first decomposition zero matrix Σ 11 has C rows by (kC) columns of elements, and the first decomposition zero matrix Σ 11 The elements of are all 0; The first decomposition matrix includes the first decomposition diagonal matrix Z 11 and the first decomposition zero matrix Σ 11 .
6. The HSI classification method based on stable quaternion generalized SVD according to claim 5, characterized in that: The performing quaternion orthogonal triangular decomposition on the second sub-matrix to obtain a second decomposition matrix includes: Comparing the size between the preset number of training samples m and the number of columns k of the second sub-matrix E(C + 1:C + m,1:k); If m < k, then performing quaternion orthogonal triangular decomposition on the second sub-matrix E(C + 1:C + m,1:k) according to the following formula: in, is the fourth auxiliary matrix, the fourth auxiliary matrix is the orthogonal quaternion matrix, V1 is the fifth auxiliary matrix, is a first decomposed triangular matrix, and the first decomposed triangular matrix is an upper triangular matrix with m rows by m columns of elements, is the first decomposition zero matrix, and the first decomposition zero matrix The elements of are all 0; The second decomposition matrix includes the first decomposition triangular matrix and the first decomposition zero matrix If m ≥ k, then performing quaternion orthogonal triangular decomposition on the second sub-matrix E(C + 1:C + m,1:k) according to the following formula: Among them, Σ 2,1 is the second decomposed triangular matrix, and the second decomposed triangular matrix Σ 2,1 is an upper triangular matrix with k rows by k columns, Z 21 is the second decomposition zero matrix, and the second decomposition zero matrix Z 21 The elements of are all 0; The second decomposition matrix includes the second decomposition triangular matrix Σ 2,1 and the second decomposition zero matrix Z 21 .
7. The HSI classification method based on stable quaternion generalized SVD according to claim 6, characterized in that: The performing quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix includes: Comparing the preset number of training samples m with the number of columns k of the second submatrix E(C+1:C+m,1:k); If m < k, determine the region of elements in the (k - j + 1)-th row to the m-th row and the (k - j + 1)-th column to the m-th column of the first decomposed triangular matrix as the first non-diagonal region, and determine the first re-decomposed sub-matrix The first sub-matrix is decomposed according to the following formula Perform quaternion singular value decomposition: in, is the sixth auxiliary matrix, is the seventh auxiliary matrix, is the eighth auxiliary matrix; Wherein, the second decomposition diagonal matrix includes the seventh auxiliary matrix If m ≥ k, then determine the second decomposition triangular matrix Σ 2,1 The area where the elements from the k-j+1th row to the kth row and the k-j+1th column to the kth column are located is the second non-diagonal area, and the second decomposition submatrix is determined The second sub-matrix is decomposed according to the following formula Perform quaternion singular value decomposition: in, is the ninth auxiliary matrix, is the tenth auxiliary matrix, is the eleventh auxiliary matrix; Wherein, the second decomposition diagonal matrix includes the tenth auxiliary matrix 8. The HSI classification method based on stable quaternion generalized SVD according to claim 7, characterized in that: The step of determining a target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix and the second decomposition diagonal matrix includes: Comparing the preset number of training samples m with the number of columns k of the second submatrix E(C+1:C+m,1:k); If m < k, then according to the seventh auxiliary matrix determine the seventh auxiliary matrix corresponding seventh intermediate matrix V 21 , and determine the first projection matrix V = V1·V 21 ; The second projection matrix I is determined according to the following formula: The initial projection vector matrix corresponding to the hyperspectral image to be classified is determined according to the following formula: Determine the target projection vector matrix W g =W(:,q:k), where q is a preset threshold, and the threshold q∈{k-C+2,k-C+1,kC,…,k}; If m ≥ k, then according to the tenth auxiliary matrix Determine the tenth auxiliary matrix The corresponding tenth intermediate matrix V 22 , and determine the first projection matrix V = V1·V 22 ; The second projection matrix I is determined according to the following formula: The initial projection vector matrix corresponding to the hyperspectral image to be classified is determined according to the following formula: Determine the target projection vector matrix W g =W(:,q:k), where q is a preset threshold, and the threshold q∈{k-C+2,k-C+1,kC,…,k}.
9. The HSI classification method based on stable quaternion generalized SVD according to any one of claims 1 to 8, characterized in that: The hyperspectral image to be classified is a hyperspectral image corresponding to the target sample, and the method further includes: According to the classification result obtained after classifying the hyperspectral image to be classified, multiple target chemical components on the target sample and the spatial distribution information corresponding to each of the target chemical components are determined.
10. An HSI classification e-commerce application device based on stable quaternion generalized SVD, characterized in that: The device is used to classify hyperspectral images to be classified in e-commerce, and the device comprises: The data conversion module is used to use quaternion vectors to represent all pixel vectors of the hyperspectral image to be classified, and obtain the quaternion set Q corresponding to the hyperspectral image to be classified. h×N , where N is the number of the pixel vectors, and h is the number of the quaternion vectors corresponding to each pixel vector; A vector analysis module is used to determine m training pixel vectors from the N pixel vectors to obtain a training data set Q h×m The data category set R corresponding to the training data set C×m , where m is the preset number of training samples and C is the total number of spectral categories; The first decomposition module is used to decompose the training data set Q h×m The data category set R corresponding to the training data set C×m , determine a first quaternion matrix B to be decomposed; perform quaternion singular value decomposition on the first quaternion matrix B to be decomposed to obtain a second quaternion matrix E to be decomposed; A matrix splitting module, used for dividing the second quaternion matrix E to be decomposed into a first sub-matrix and a second sub-matrix, wherein the first sub-matrix is the 1st to Cth row matrix of the second quaternion matrix E to be decomposed, and the second sub-matrix is the C+1th to C+mth row matrix of the second quaternion matrix E to be decomposed; A second decomposition module, used for performing quaternion singular value decomposition on the first sub-matrix to obtain a first decomposition matrix; A third decomposition module is used to perform quaternion orthogonal triangular decomposition on the second sub-matrix to obtain a second decomposition matrix, and perform quaternion singular value decomposition on the second decomposition matrix to obtain a second decomposition diagonal matrix; A projection decomposition module, used for determining a target projection vector matrix corresponding to the hyperspectral image to be classified according to the first decomposition matrix, the second decomposition matrix and the second decomposition diagonal matrix; An image analysis module is used to classify the hyperspectral image to be classified according to the target projection vector matrix.
