A data processing method and device, equipment, and storage medium
By using an autoencoder network to nonlinearly map high-dimensional data to a latent space and reduce its dimensionality, and then using the representation coefficient matrix to construct a similarity matrix for clustering, the bottleneck problem of high-dimensional data clustering is solved, and more accurate clustering results are achieved.
Patent Information
- Application Number
- CN202110220904.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-26
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-02-26
AI Technical Summary
Existing clustering methods encounter bottlenecks when dealing with high-dimensional data, failing to meet sparsity requirements and avoid the "curse of dimensionality," resulting in poor clustering performance.
The data to be clustered is nonlinearly mapped to the latent space through an autoencoder network, and then reconstructed after dimensionality reduction. A similarity matrix is constructed using the representation coefficient matrix, and clustering is performed based on the similarity matrix.
It achieves accurate clustering of high-dimensional data, effectively reducing data dimensionality and improving clustering results, and is suitable for high-dimensional application scenarios such as video segmentation and image clustering.
Smart Images

Figure CN114970652B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of data processing, and relate to but are not limited to a data processing method and device, equipment and storage medium. BACKGROUND
[0002] With the continuous change of application environment, especially in the era of "big data", the huge size and complex structure of data pose increasingly severe challenges to clustering analysis. High dimensionality of data is increasingly common, including image data, biological gene expression data and search engine data, which often have dimensions up to tens of thousands. Current clustering methods are usually designed and developed for low-dimensional data. When analyzing and processing high-dimensional data, serious bottlenecks are usually encountered, which cannot meet the sparsity of high-dimensional data and avoid the influence of "curse of dimensionality", and the desired results cannot be obtained. SUMMARY
[0003] Embodiments of the present application provide a data processing method and device, equipment and storage medium, which can accurately cluster high-dimensional data.
[0004] The technical solution of the embodiments of the present application is as follows:
[0005] The embodiments of the present application provide a data processing method, comprising:
[0006] The dimension of the mapping data is lower than the dimension of the data to be clustered.
[0007] According to the data to be clustered and the reconstructed data, an expression coefficient matrix of the mapping data in the latent space is obtained.
[0008] A similarity matrix is constructed using the expression coefficient matrix.
[0009] Based on the similarity matrix, the data to be clustered is clustered.
[0010] The embodiments of the present application provide a data processing device, comprising:
[0011] The dimension of the mapping data is lower than the dimension of the data to be clustered.
[0012] A first calculation module is configured to obtain an expression coefficient matrix of the mapping data in the latent space according to the data to be clustered and the reconstructed data.
[0013] a second calculation module, configured to construct a similarity matrix by using the representation coefficient matrix;
[0014] a clustering module, configured to cluster the data to be clustered based on the similarity matrix.
[0015] The embodiment of the present application further provides an electronic device, including a memory and a processor, the memory stores a computer program which can run on the processor, and the processor implements the data processing method when executing the program.
[0016] The embodiment of the present application further provides a storage medium, which stores a computer program, and the computer program is executed by a processor to implement the data processing method.
[0017] The data processing method, device, equipment and storage medium provided by the embodiment of the present application, through the auto-encoding network, the data to be clustered is nonlinearly mapped to the potential space to obtain the mapping data, and the mapping data is reconstructed to obtain the reconstructed data; the dimension of the mapping data is lower than that of the data to be clustered; the representation coefficient matrix of the mapping data in the potential space is obtained according to the data to be clustered and the reconstructed data; the similarity matrix is constructed by using the representation coefficient matrix; the data to be clustered is clustered based on the similarity matrix; thereby through the auto-encoding network, the data to be clustered is nonlinearly mapped to the potential space, the dimension of the mapped data is lower than that of the data to be clustered, and the clustering is based on the nonlinear representation, which can be applied to common high-dimensional clustering application scenarios such as video segmentation and image clustering, and the high-dimensional data is accurately clustered. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 An optional structure schematic diagram of the data processing system provided by the embodiment of the present application;
[0019] Figure 2 An optional flow schematic diagram of the data processing method provided by the embodiment of the present application;
[0020] Figure 3 An optional structure schematic diagram of the auto-encoding network provided by the embodiment of the present application;
[0021] Figure 4 An optional flow schematic diagram of the data processing method provided by the embodiment of the present application;
[0022] Figure 5 An optional structure schematic diagram of the auto-encoding network data processing provided by the embodiment of the present application;
[0023] Figure 6 An optional effect schematic diagram of the representation coefficient matrix provided by the embodiment of the present application;
[0024] Figure 7 An optional structural diagram of a data processing apparatus provided by an embodiment of the present application is provided.
[0025] Figure 8 An optional structural diagram of an electronic device provided by an embodiment of the present application is provided. DETAILED DESCRIPTION
[0026] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the following will further describe the specific technical solutions of the present application with reference to the accompanying drawings of the embodiments of the present application. The following embodiments are used to illustrate the present application, but not to limit the scope of the present application.
[0027] The embodiments of the present application can be provided as a data processing method and apparatus, an electronic device and a storage medium. In actual application, the data processing method can be implemented by a data processing apparatus, and each functional entity in the data processing apparatus can be implemented by hardware resources of an electronic device (such as a terminal device), such as a processor and other computing resources, and communication resources (such as those used to support various communication modes such as optical cable and cellular communication).
[0028] The data processing method provided by the embodiments of the present application is applied to a data processing system, and the data processing system is composed of a client, i.e., a business system end, and a data processing end.
[0029] As an example, the structure of the data processing system can be as shown in Figure 1 , which includes a client 10 and a data processing end 20.
[0030] In an example, the client 10 and the data processing end 20 can be the same physical entity; in an example, as shown in Figure 1 , the client 10 and the data processing end 20 are different physical entities, and the client 10 and the data processing end 20 interact through a network 30.
[0031] Here, the client 10 is installed with an application program capable of inputting high-dimensional data such as pictures, and the user sends a clustering request to the data processing end 20 through the operation of the application program. The data processing end 20 processes high-dimensional data such as pictures and videos based on the received clustering request.
[0032] In the embodiments of the present application, based on Figure 1The data processing system shown, the data processing end maps the data to be clustered to a potential space through a self-encoding network to obtain mapping data, and reconstructs the mapping data to obtain reconstructed data; the dimension of the mapping data is lower than the dimension of the data to be clustered; according to the data to be clustered and the reconstructed data, a representation coefficient matrix of the mapping data in the potential space is obtained; a similarity matrix is constructed by using the representation coefficient matrix; based on the similarity matrix, the data to be clustered is clustered to obtain a clustering result, and the clustering result is sent to the client.
[0033] Next, combined with Figure 1 The data processing system shown in the schematic diagram, the embodiments of the data processing method and device, equipment and storage medium provided by the application are described.
[0034] The application embodiment provides a data processing method, which is applied to a data processing device. The data processing device can be implemented on an electronic device as a data processing end. The functions realized by the method can be realized by calling program code in the processor of the electronic device. Of course, the program code can be saved in the computer storage medium. Therefore, the electronic device at least includes a processor and a storage medium.
[0035] The electronic device can be any device with information processing capability. In an embodiment, the electronic device can be a smart terminal, such as a notebook computer, an AR / VR device, a mobile terminal, etc. In another embodiment, the electronic device can also be a terminal device with computing function that is not convenient to move, such as a desktop computer, a desktop computer, etc.
[0036] Of course, the application embodiments are not limited to methods and hardware, and can have various implementation manners, such as storage medium (storing instructions for executing the data processing method provided by the application embodiment).
[0037] Figure 2 The implementation flowchart of a data processing method of the application embodiment is shown in Figure 2 The method comprises the following steps:
[0038] S201, through a self-encoding network, the data to be clustered is nonlinearly mapped to a potential space to obtain mapping data, and the mapping data is reconstructed to obtain reconstructed data.
[0039] The dimension of the mapping data is lower than the dimension of the data to be clustered, and the dimension of the reconstructed data is the same as that of the data to be clustered.
[0040] The data processing end takes the data to be clustered as input of the auto-encoding network, obtains mapping data of intermediate layer output of the auto-encoding network and reconstruction data of final output.
[0041] Here, the reconstruction of the mapping data can include: self-representation of the mapping data by the representation coefficient matrix in the latent space to obtain self-representation data, and decoding processing of the self-representation data in the latent space to obtain the reconstruction data.
[0042] S202, obtaining a representation coefficient matrix of the mapping data in the latent space according to the data to be clustered and the reconstruction data.
[0043] Here, the parameters of the auto-encoding network are continuously adjusted according to the error between the data to be clustered and the reconstruction data output by the auto-encoding network until the auto-encoding network converges, at which time the error between the data to be clustered and the reconstruction data is the minimum loss of the auto-encoding network. In the embodiment of the application, the parameters of the auto-encoding network include the representation coefficient matrix, so when the parameters of the auto-encoding network are adjusted, the representation coefficient matrix is adjusted. When the parameters of the auto-encoding network converge, the representation coefficient matrix is no longer adjusted.
[0044] After the data processing end inputs the data to be clustered into the auto-encoding network, the loss of the auto-encoding network is determined according to the reconstruction data output by the auto-encoding network, and in the case where the auto-encoding network does not converge, the parameters of the auto-encoding network are adjusted according to the determined network loss, and the data to be clustered is input into the auto-encoding network with adjusted parameters until the auto-encoding network converges. When the auto-encoding network converges, the network loss of the auto-encoding network is the minimum.
[0045] In an example, the mapping data is represented as self-representation data by the representation coefficient matrix, and the self-representation data is decoded to obtain the reconstruction data. At this time, the parameters of the auto-encoding network are adjusted once, the representation coefficient matrix is adjusted once, and a new reconstruction data is obtained. When the auto-encoding network converges, the representation coefficient matrix no longer changes and the reconstruction data no longer changes.
[0046] In the embodiment of the application, the error between the data to be clustered and the reconstruction data, i.e. the loss, can be calculated by a loss function, and the variables of the loss function include: the data to be clustered and the reconstruction data.
[0047] In an example, the variables of the loss function further include one or more combinations of the mapping data and the representation coefficient matrix.
[0048] In an example, the variables of the loss function include: data to be clustered, reconstructed data, mapping data and representation coefficient matrix, and the self-representation data is represented by the representation coefficient matrix and the mapping data. Here, the representation coefficient matrix when the auto-encoding network converges, i.e., the loss is minimum, is determined as the representation coefficient matrix for constructing the similarity matrix.
[0049] S203, constructing a similarity matrix by using the representation coefficient matrix.
[0050] S204, clustering the data to be clustered based on the similarity matrix.
[0051] In the embodiments of the present application, the clustering algorithm used for clustering the data to be clustered based on the similarity matrix can include: spectral clustering, K-means clustering, mean shift clustering, agglomerative hierarchical clustering and the like.
[0052] The spectral clustering is a clustering method based on graph theory, and the algorithm process of the spectral clustering includes:
[0053] S2041, calculating the similarity matrix, the degree matrix and the Laplacian matrix.
[0054] S2042, calculating the eigenvectors corresponding to the K smallest eigenvalues of the Laplacian matrix.
[0055] S2043, forming a new matrix by using the K eigenvectors, and clustering the row vectors of the new matrix.
[0056] S2044, the clustering result of the row vectors represents the clustering result of the original samples.
[0057] Here, the spectrum: the eigenvalues of a square matrix (not a square matrix, but the eigenvalues of a square matrix obtained by multiplying the transpose of the square matrix on the left) are called the spectrum, and the maximum value is called the spectral radius.
[0058] The similarity matrix A: an n*n matrix is established for n samples, and the value of the i-th row and the j-th column of the matrix is a certain similarity between the i-th sample and the j-th sample.
[0059] The degree matrix D: an n*n diagonal matrix, the value of the i-th row and the i-th column is the sum of all values in the i-th row of the similarity matrix.
[0060] The Laplacian matrix L: the Laplacian matrix is obtained by subtracting the degree matrix from the similarity matrix.
[0061] The two eigenvectors corresponding to the smallest eigenvalue 0 of L can obviously separate two categories, and therefore, by clustering the eigenvectors corresponding to the K smallest eigenvalues of the Laplacian matrix, the categories to which the corresponding samples belong can be determined.
[0062] The K-Means clustering algorithm involves: selecting some classes / groups and randomly initializing their respective centroids. A centroid is a position with the same length as the vector of each data point; calculating the distance from each data point to a centroid, assigning the data point to the closest centroid; calculating the centroid of each class as the new centroid; and repeating these steps until the centroid of each class changes little after each iteration.
[0063] This application does not impose any limitations on the clustering algorithm used for clustering.
[0064] The data processing method provided in this application embodiment uses an autoencoder network to nonlinearly map data to be clustered to a latent space to obtain mapped data, and reconstructs the mapped data to obtain reconstructed data; the dimension of the mapped data is lower than the dimension of the data to be clustered; based on the data to be clustered and the reconstructed data, a representation coefficient matrix of the mapped data in the latent space is obtained; a similarity matrix is constructed using the representation coefficient matrix; and the data to be clustered is clustered based on the similarity matrix; thus, through the autoencoder network, data in the original space is nonlinearly mapped to the latent space, and the mapped data has a lower dimension than the data in the original space. Furthermore, clustering based on nonlinear representation can be applied to common high-dimensional clustering application scenarios such as video segmentation and image clustering, enabling accurate clustering of high-dimensional data.
[0065] In some embodiments, such as Figure 3 As shown, the autoencoder network 300 includes: at least one encoding layer 301, a self-representation layer 302, and at least one decoding layer 303. The encoding layer is a convolutional layer, the decoding layer is a deconvolutional layer, and the self-representation layer is a fully connected layer. The number of encoding layers and the number of decoding layers can be the same or different. The number of encoding layers and the number of decoding layers can be set according to actual needs.
[0066] In one example, the autoencoder network consists of three convolutional layers, one fully connected layer, and three deconvolutional layers.
[0067] based on Figure 3 The implementation of the autoencoder network shown in S201 includes:
[0068] The data to be clustered is input into the at least one encoding layer to obtain the mapping data output by the at least one encoding layer; the mapping data is input into the self-representation layer to obtain the self-representation data output by the self-representation layer; the self-representation data is input into the at least one decoding layer to obtain the reconstructed data output by the at least one decoding layer.
[0069] In the embodiments of the present application, the loss of the auto-encoding network is calculated through the to-be-clustered data, the reconstructed data, the mapping data and the self-representation data; the parameters of the auto-encoding network are adjusted according to the loss to determine whether the auto-encoding network converges, the to-be-clustered data is continuously input into the auto-encoding network, a new loss is obtained until the auto-encoding network converges. Wherein, the representation coefficient matrix is a matrix composed of parameters of the self-representation layer, when the parameters of the auto-encoding network are adjusted, the parameters of the self-representation layer are adjusted, that is, the representation coefficient matrix is adjusted.
[0070] Here, the variables of the loss function for calculating the loss of the auto-encoding network include: the to-be-clustered data, the reconstructed data, the mapping data and the identification coefficient matrix, wherein the self-representation data can be represented by the mapping data and the identification coefficient matrix. When the auto-encoding network converges, the parameters of the auto-encoding network are no longer adjusted, and the representation coefficient matrix is no longer adjusted.
[0071] In the embodiments of the present application, when the representation coefficient matrix is adjusted, the representation coefficient matrix satisfies a constraint condition. Here, the constraint condition can be that the elements other than the diagonal elements are 0, so that the representation coefficient matrix is a block diagonal matrix with elements other than the diagonal elements being 0.
[0072] The mapping data and the reconstructed data are obtained through the auto-encoding network, and the loss of the auto-encoding network can be obtained in the following ways:
[0073] Method one: the loss of the auto-encoding network is determined through the representation coefficient matrix after imposing a norm constraint; here, the norm constraint is imposed on the representation coefficient matrix, so that the representation coefficients in the representation coefficient matrix have sparsity.
[0074] Method two: the loss of the auto-encoding network is determined through the weighted representation coefficient matrix; here, the representation coefficient matrix is weighted, which can enhance the intra-class compactness and inter-class separability of the representation coefficient matrix.
[0075] When the loss is obtained by method one, the representation coefficient matrix of the mapping data in the latent space is obtained using formula (1) according to the to-be-clustered data and the reconstructed data:
[0076]
[0077] Wherein, X is the to-be-clustered data, is the reconstructed data, C is the representation coefficient matrix, that is, the coefficient matrix of the self-representation layer; H is the mapping data, and λ1 and λ2 are constants. The values of λ1 and λ2 can be set according to actual requirements. The square of the F-norm of the difference between the to-be-clustered data input into the auto-encoding network and the reconstructed data output from the auto-encoding network represents the reconstruction error of the auto-encoding network. F-norm square of the difference between H input from the representation layer and HC output from the representation layer. HC can also be represented as H*C, which is the output from the representation layer. diag(C) is equivalent to diag(C, 0), which represents the main diagonal of C. s.t.(diag(C) = 0) represents that the elements in the main diagonal of C are 0, i.e., the coefficient matrix has sparsity.
[0078] At this time, the loss function of the auto-encoding network is shown in formula (2):
[0079]
[0080] Here, In the formula, each converted data h i of the encoded layer can be linearly represented by other data points h j (j≠i), and the representation coefficient matrix C can be used to construct a similarity matrix and obtain the final clustering result using spectral clustering. The second term ||C||1 uses the l1-norm constraint to represent the coefficient matrix C, so that the representation coefficient matrix has sparsity and strengthens the block diagonal property of the representation coefficient matrix C.
[0081] In actual applications, the norm of the representation coefficient matrix C in formula (1) and formula (2) can also be a 2-norm, a kernel norm, or other norms.
[0082] When the loss is obtained by way two, the representation coefficient matrix of the mapping data in the latent space is obtained according to the to-be-clustered data and the reconstructed data using formula (3):
[0083]
[0084] Where X is the to-be-clustered data, is the reconstructed data, and C is the representation coefficient matrix; H is the mapping data, and W is the weight matrix. The values of the elements in the weight matrix W can be set according to actual requirements.
[0085] At this time, the loss function of the auto-encoding network is shown in formula (4):
[0086]
[0087] In the embodiments of the present application, the ideal weight matrix W should have the characteristics that the weight of the same category data points is small, and the weight between different category data points is large.
[0088] In some embodiments, before S202, the element W ij in the i-th row and the j-th column of the weight matrix W is calculated by formula (5):
[0089]
[0090] wherein h i and h j respectively represent the value of the i-th dimension and the j-th dimension of the mapping data H, and are the normalized results of h i and h j respectively, the parameter σ is the average value of all elements in the matrix B, the element in the i-th row and the j-th column of the matrix B is , i is greater than 0, j is greater than 0, and i is not equal to j.
[0091] In some embodiments, the implementation of S203 includes:
[0092] The element in the i-th row and the j-th column of the similarity matrix A is constructed by formula (6):
[0093]
[0094] wherein, is the transpose of , and is the singular value decomposition of C * , C * is the normalized result of the coefficient matrix C.
[0095] Here, formula (6) indicates that the element in the m-th row and the n-th column of the similarity matrix A is the square of the element in the m-th row and the n-th column of G, and G is
[0096] U * ∑ * (V * ) T is the singular value decomposition of C * , when C * is a matrix of k rows and g columns, U * is a unitary matrix of k rows and k columns, ∑ * is a diagonal matrix of k rows and g columns, and the diagonal elements of ∑ * are the singular values of C * , and V is a unitary matrix of g rows and g columns.
[0097] It should be noted that in the embodiments of the present application, the construction of the similarity matrix A can also be based on other ways other than formula (6), and the present application does not make any limitation on the formula based on which the similarity matrix A is constructed.
[0098] In an embodiment, based on the auto-encoding network shown in Figure 3 , the construction process of the auto-encoding network includes:
[0099] inputting pre-training data into an initial network to obtain output data; the initial network comprises the at least one encoding layer and the at least one decoding layer;
[0100] after obtaining the output data, calculating a current loss of the initial network according to the pre-training data and the output data;
[0101] judging whether the initial network converges according to the current loss;
[0102] in the case that the initial network does not converge, updating the initial network according to the current loss, returning to inputting pre-training data into the initial network to obtain output data and repeating the execution until it is judged that the initial network converges according to the current loss;
[0103] adding the self-representation layer to the converged initial network to obtain the auto-encoding network.
[0104] Here, the training of the initial network comprises:
[0105] S31, inputting pre-training data into an initial network to obtain output data;
[0106] S32, calculating a current loss of the initial network according to the pre-training data and the output data;
[0107] S33, judging whether the initial network converges according to the current loss;
[0108] when the initial network does not converge, performing S34, otherwise, ending the training of the initial network.
[0109] S34, updating the initial network according to the current loss;
[0110] after completing the updating of the initial network, returning to S31.
[0111] wherein the loss corresponding to the output data can be calculated by formula (7),
[0112]
[0113] using pre-training data to train a deep convolutional auto-encoding network without a self-representation layer, i.e. an initial network, to obtain a converged initial network.
[0114] Here, the converged initial network is obtained through one or more iterations.
[0115] In the first iteration, the pre-training data is input into the initial network to obtain first output data, and a first loss is obtained according to the pre-training data and the first output data; when it is judged that the initial network converges according to the first loss, the second iteration is not performed; otherwise, the parameters of the initial network are adjusted according to the first loss to update the initial network once, and the second iteration is performed based on the initial network after the first update.
[0116] In the second iteration, the pre-training data is input into the initial network after the first update to obtain second output data, and a second loss is obtained according to the pre-training data and the second output data; when it is judged that the initial network after the first update converges according to the second loss, the third iteration is not performed; otherwise, the parameters of the initial network after the first update are adjusted according to the second loss to update the initial network twice, and the third iteration is performed based on the initial network after the second update, and the above process is sequentially repeated until the initial network after the update converges.
[0117] The full connection layer is added to the converged initial network to obtain the auto-encoding network.
[0118] In the embodiments of the present application, the training of the auto-encoding network is divided into two stages of pre-training and fine-tuning.
[0119] In the pre-training stage, the initial network is trained by the pre-training data, so that the initial network converges, and the self-representation layer is added to the initial network to obtain the auto-encoding network; the initial network includes the at least one encoding layer and the at least one decoding layer.
[0120] In the fine-tuning stage, the auto-encoding network is trained to obtain the converged auto-encoding network.
[0121] In the embodiments of the present application, after obtaining the auto-encoding network, the gradient descent method can be used to minimize the loss function to fine-tune the parameters in the auto-encoding network, and in the fine-tuning process, the data to be clustered is input into the auto-encoding network to obtain the representation coefficient matrix.
[0122] Next, the data processing method provided by the embodiments of the present application will be further described through a specific application scenario.
[0123] In recent years, subspace clustering methods based on spectral clustering have achieved good clustering results. As an unsupervised learning technique, subspace clustering aims to divide data into different categories using the inherent features or attributes of the data itself. Subspace clustering involves two steps: 1) constructing a similarity matrix A to describe the relationships between data points; 2) obtaining the clustering results through spectral clustering such as Ncut. Most existing spectral clustering methods use linear representation methods to obtain the representation coefficient matrix and then use the representation coefficient matrix to construct the similarity matrix. To obtain better clustering results, some researchers have recently added structured sparse constraints or Laplace constraints to the linear representation method. This allows the final representation coefficients to reflect both the global relationships of the data and the local correlations of the data points, thus improving clustering accuracy.
[0124] Although the linear representation method achieves good clustering results, it makes the following assumption: each sample is linearly reconstructed from other data points. However, in real life, there is a possibility that data in the original space cannot be linearly reconstructed from other sample points.
[0125] Recently, complex models represented by deep learning have attracted much attention and achieved remarkable results in various applications. In the field of clustering, many scholars have begun to use deep learning methods to solve clustering problems. These methods can be roughly divided into two categories: 1) Using the autoencoder method, a common method in deep learning, the representation coefficient matrix C obtained from the original subspace clustering method is used to constrain the relationship between data after the nonlinear transformation of the encoder. This ensures that the nonlinearly mapped data retains the relationship in the original space while reducing the data dimensionality. Then, the K-means method is used to directly cluster the mapped data to obtain the clustering results; 2) Using neural networks or autoencoders to perform nonlinear mapping on the data, obtaining linear representation coefficients between the mapped data, constructing a similarity matrix using the representation coefficients, and then using spectral clustering to obtain the final clustering results.
[0126] The purpose of the two methods described above is to utilize existing data to obtain the correlation between data points by finding linear correlations between samples, and finally construct a similarity matrix A. Then, spectral clustering is used to perform subspace segmentation of the data. Ideally, the similarity matrix is a block diagonal matrix, meaning that there is no correlation between categories. The objective function for subspace clustering is linearly represented as shown in formula (8):
[0127] min||Z|| p stX=XZ Formula (8);
[0128] Among them, ||·|| p It represents any matrix norm, such as: l1 norm, nuclear norm, F-norm, or other norm constraints.
[0129] In practical problems, data often has noise, assuming that each data point with noise can be linearly represented by other contaminated data points plus noise data items. The objective function of linear representation subspace clustering can be updated to formula (9):
[0130] min||Z|| p +||E|| q s.t.X=XZ+E Formula (9)
[0131] Matrix norm ||·|| q According to the different noise, it can be set as l1-norm, l 2,1 -norm, F-norm. Elhamifar proposed sparse subspace clustering (SSC), under the assumption of linear representation, by minimizing the l1-norm to force the sparsity of the representation matrix, so that the similarity between classes is zero and the intra-class similarity is sparse.
[0132] Liu et al. proposed a low rank representation subspace clustering method (LRR), which can reveal the lowest rank representation of the global structure of the data by minimizing the kernel norm, and can well cluster the highly correlated data together, and also has good robustness when dealing with noisy and contaminated data.
[0133] The subspace clustering method of least squares regression (LSR) uses F-norm to constrain the representation coefficients, so that the coefficients have grouping effect, and the clustering performance of related data is maintained.
[0134] These clustering methods have been able to solve the low-dimensional space data clustering problem, but with the continuous change of application environment, especially in the era of "big data", the huge size and complex structure of data pose increasingly severe challenges to clustering analysis. Data high dimension is more and more common, including various image data, biological gene expression data, search engine data, the dimension of which is often as high as ten thousand. Existing clustering methods are usually designed and developed for low-dimensional data, and when analyzing and processing high-dimensional data, they usually encounter serious bottlenecks and cannot meet the sparsity of high-dimensional data and avoid the influence of "dimension disaster", so the expected results cannot be obtained.
[0135] The existing clustering method encounters the following two problems when clustering in high-dimensional data set:
[0136] First, there are a large number of irrelevant attributes in the high-dimensional data set, so that the possibility of clusters (classes) in all dimensions is almost zero; second, the data distribution in high-dimensional space is sparser than that in low-dimensional space, and the distance between data is almost equal, which is a common phenomenon, and the traditional clustering method is based on distance clustering, so it is impossible to construct clusters based on distance in high-dimensional space.
[0137] The embodiment of the application proposes a deep structured sparse subspace clustering method, trains an auto-encoding network, and maps data in the original space to the latent space through multiple encoding layers, so that the mapped data has a lower dimension than the data in the original space, which is more conducive to clustering analysis, and thus a better clustering effect is obtained.
[0138] The clustering method provided by the embodiment of the application proposes a deep structured sparse subspace clustering method based on a convolutional auto-encoder, performs nonlinear conversion on data in the original space through the encoding layer of the convolutional auto-encoder, and maps the data to a latent space that is more conducive to segmentation clustering, wherein a self-representation layer is added between the encoder and the decoder to obtain the self-representation relationship of the latent space data, and through structured sparse constraints, a similarity matrix with better block diagonalization properties is obtained, so as to realize clustering of data according to the similarity between data.
[0139] As shown in Figure 4 The data processing method provided by the embodiment of the application includes:
[0140] S401, pre-training a deep convolutional auto-encoding network;
[0141] S402, calculating a weight matrix W;
[0142] S403, fine-tuning the deep convolutional auto-encoding network to obtain a representation coefficient matrix C;
[0143] S404, constructing a similarity matrix A;
[0144] S405, obtaining the final clustering by using a spectral clustering method.
[0145] In the embodiment of the application, in order to speed up the training, a deep convolutional auto-encoding network is constructed based on a convolutional auto-encoder (CAE), and a self-representation layer is added between the encoder and the decoder, which is used to obtain the self-representation coefficient of the data in the converted space, and the network structure is as follows Figure 5As shown in the figure, it contains 3 convolutional layers: convolutional layer 501, convolutional layer 502 and convolutional layer 503, one self-representation layer 504, three convolutional decoding layers: deconvolutional layer 505, deconvolutional layer 506 and deconvolutional layer 507, wherein the circle 508 represents the mapping data H after the input data X is subjected to 3 convolutional encoding operations, the circle 509 represents the self-representation data after the self-representation layer, the input image 500, and the reconstructed image 510 is obtained.
[0146] In the convolutional layer process, a convolution kernel is used to perform convolution operation in the horizontal and vertical directions with a stride of 2, and a rectified linear unit (ReLU) is used as a nonlinear activation function, and the activation function is shown in formula (10):
[0147]
[0148] Each input picture is mapped to a vector h i In the self-representation layer, each mapped data vector is linearly represented by other data vectors to obtain a representation coefficient matrix C, and the linearly represented data is mapped to the original image space by the decoder.
[0149] Let the data set be the union of k linear subspaces The objective function for calculating the representation coefficient matrix C can be defined as shown in formula (1):
[0150]
[0151] At this time, the loss function of the auto-encoding network is shown in formula (2):
[0152]
[0153] wherein, represents the data reconstructed after the input data X is subjected to the decoding layer, H = [h1, h2, …, h n represents the output data of X subjected to the encoding layer, C is the representation coefficient matrix, and the self-representation relationship between the encoding layer output data is represented. The first term represents the reconstruction error of the encoding layer input data and the decoding layer output data. In each encoded layer converted data h i , can be linearly represented by other data points h j (j≠i), the representation coefficient matrix C can be used to construct a similarity matrix, and the final clustering result is obtained using spectral clustering. The second term ||C||1 uses the l1-norm to constrain the representation coefficient matrix C, so that the representation coefficient matrix C has sparsity and strengthens the block diagonal property of the representation coefficient matrix C.
[0154] To make the coefficient matrix C better suited for subspace segmentation and achieve better clustering results, the second term ||C||1 is modified, and the objective function is redefined as formula (3):
[0155]
[0156] At this point, the loss function of the autoencoder network is shown in equation (4):
[0157]
[0158] Among them, W i,j ∈[0,1] represents the weight. Weighting the coefficient matrix C strengthens its intra-class compactness and inter-class separation. Ideally, the weight W should have smaller weights for data points of the same class and larger weights for data points of different classes. The weight matrix W is calculated using formula (5).
[0159]
[0160] Among them, h i and h j These represent the values of the i-th and j-th dimensions of the mapped data, respectively. and They are and The normalized result, where parameter σ is the average of all elements in matrix B, and the element in the i-th row and j-th column of matrix B.
[0161] By defining the weight matrix using formula (5), the weights between data points in different subspaces can be made larger, while the weights between data points in the same subspace tend to be zero.
[0162] In this embodiment, network training is divided into two stages: pre-training and fine-tuning.
[0163] In the pre-training phase, a deep convolutional autoencoder network without a self-representation layer is trained using the pre-training data from the entire pre-training dataset. The loss function in the pre-training phase can be written as formula (7):
[0164]
[0165] In the fine-tuning phase, the encoder and decoder layers are initialized using the parameters obtained from the pre-training phase. A self-representation layer is added to the network, and the loss function is minimized using gradient descent to fine-tune the parameters in the network.
[0166] In the embodiments of this application, Figure 5 The input representation coefficient matrix is shown as follows Figure 6 As shown. Among them,Figure 6 The representation coefficient matrix is a 0 / 1 matrix, that is, the element in the matrix is 0 to 1, and the smaller the element is, the darker the color is.
[0167] After obtaining the representation coefficient matrix C, the representation coefficient matrix C is used to construct an affinity matrix A, and some classical subspace clustering methods obtain the final clustering result by using a spectral clustering method. Therefore, the construction of the affinity matrix A also has a very important effect on the clustering result, and a universal method is to construct the affinity matrix by using formula (12).
[0168]
[0169] In order to improve the block diagonal property of the affinity matrix, so as to obtain a better clustering result, the present application uses formula (6) to construct the affinity matrix.
[0170]
[0171] Wherein, U * is the optimal solution C * of the singular value decomposition of the representation coefficient matrix * ∑ * (V * ) T The left half of U * , each column of U is weighted by multiplying 2 , and better performance is obtained for the data set with noise. * Each element in the affinity matrix A can be guaranteed to be positive.
[0172] In the embodiment of the application, the number of rows of U * is the same as the number of rows of C * , and the number of columns of U * is the same as the number of columns of C * , so that the thin singular value decomposition of C
[0173] The application environment of the clustering algorithm is constantly changing, and the dimensions of various image data, video data and text data are often as high as tens of thousands of dimensions. For example, a picture taken by a smart phone can reach tens of thousands of pixels. The clustering method using linear representation cannot meet the demand of the "big data" era for clustering methods, and when analyzing and processing high-dimensional data, a serious bottleneck is often encountered.
[0174] The embodiment of the application provides a deep structured sparse subspace clustering method, constructs a network structure based on a convolutional autoencoder, trains an autoencoding network, and non-linearly maps data in an original space to a latent space through multiple encoding layers. Compared with data in the original space, the mapped data has a lower dimension and is more conducive to clustering analysis. The application breaks the idea of the original linear representation clustering method, and compared with the traditional linear representation clustering method, can be widely applied to common high-dimensional clustering application scenarios such as video segmentation and image clustering.
[0175] Figure 7 The implementation process of the data processing device is shown in the flowchart of the embodiment of the application, as shown in Figure 7 The device 700 comprises:
[0176] The dimension reduction module 701 is configured to non-linearly map to-be-clustered data to a latent space through an autoencoding network to obtain mapped data, and reconstruct the mapped data to obtain reconstructed data; the dimension of the mapped data is lower than the dimension of the to-be-clustered data.
[0177] The first calculation module 702 is configured to obtain a representation coefficient matrix of the mapped data in the latent space according to the to-be-clustered data and the reconstructed data.
[0178] The second calculation module 703 is configured to construct a similarity matrix by using the representation coefficient matrix.
[0179] The clustering module 704 is configured to cluster the to-be-clustered data based on the similarity matrix.
[0180] In some embodiments, the autoencoding network comprises at least one encoding layer, a self-representation layer, and at least one decoding layer; and the dimension reduction module 701 is configured to:
[0181] input the to-be-clustered data into the at least one encoding layer to obtain mapped data output by the at least one encoding layer;
[0182] input the mapped data into the self-representation layer to obtain self-representation data output by the self-representation layer;
[0183] input the self-representation data into the at least one decoding layer to obtain the reconstructed data output by the at least one decoding layer.
[0184] In some embodiments, the first calculation module 702 is further configured to:
[0185] obtain the representation coefficient matrix of the mapped data in the latent space by using the following formula according to the to-be-clustered data and the reconstructed data:
[0186]
[0187] wherein X is the data to be clustered, is the reconstructed data, C is the representation coefficient matrix, and H is the mapping data, and λ1 and λ2 are constants.
[0188] In some embodiments, the first calculation module 702 is further configured to:
[0189] According to the data to be clustered and the reconstructed data, the representation coefficient matrix of the mapping data in the latent space is obtained by using the following formula:
[0190]
[0191] wherein X is the data to be clustered, is the reconstructed data, C is the representation coefficient matrix, and H is the mapping data, and W is a weight matrix, and λ1 and λ2 are constants.
[0192] In some embodiments, the first calculation module 702 is further configured to, before obtaining the representation coefficient matrix of the mapping data in the latent space according to the data to be clustered and the reconstructed data, determine the element of the i-th row and the j-th column of the weight matrix W by using the following formula:
[0193]
[0194] wherein h i and h j respectively represent the value of the i-th dimension and the j-th dimension of the mapping data H, and are the normalized results of h i and h j , respectively, the parameter σ is the average value of all elements in the matrix B, the element of the i-th row and the j-th column in the matrix B is is the transpose of , i is greater than 0, j is greater than 0, and i is not equal to j.
[0195] In some embodiments, the apparatus further comprises a construction module configured to:
[0196] inputting the pre-training data into an initial network to obtain output data; the initial network comprises the at least one encoding layer and the at least one decoding layer;
[0197] after obtaining the output data, calculating the current loss of the initial network according to the pre-training data and the output data;
[0198] judging whether the initial network converges according to the current loss;
[0199] In the case that the initial network is not converged, the initial network is updated according to the current loss, and the pre-training data is input into the initial network to obtain output data, and the above steps are repeated until it is judged that the initial network is converged according to the current loss.
[0200] The self-representation layer is added into the converged initial network to obtain the auto-encoding network.
[0201] In some embodiments, the second calculation module 703 is configured to:
[0202] The element of the mth row and the nth column of the similarity matrix A is determined by the following formula:
[0203]
[0204] wherein, is the transpose of U * ∑ * (V * ) T is the singular value decomposition of C * , and C * is the normalized result of the coefficient matrix C.
[0205] It should be noted that the data processing apparatus provided in the embodiments of the present application includes various units, which can be implemented by a processor in an electronic device. Of course, it can also be implemented by a specific logic circuit. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0206] The above apparatus embodiments are similar to the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the apparatus embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0207] It should be noted that, in the embodiments of this application, if the above-described data processing method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0208] Correspondingly, this application provides an electronic device including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements the steps in the data processing method provided in the above embodiments.
[0209] Correspondingly, embodiments of this application provide a storage medium, namely a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps in the data processing method provided in the above embodiments.
[0210] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0211] It should be noted that, Figure 8 This is a schematic diagram of a hardware entity of an electronic device according to an embodiment of this application, such as... Figure 8 As shown, the electronic device 800 includes: a processor 801, at least one communication bus 802, a user interface 803, at least one external communication interface 804, and a memory 805. The communication bus 802 is configured to enable communication between these components. The user interface 803 may include a display screen, and the external communication interface 804 may include standard wired and wireless interfaces.
[0212] The memory 805 is configured to store instructions and applications executable by the processor 801, and can also cache data (e.g., image data, audio data, voice communication data, and video communication data) to be processed by the processor 801 and modules in the electronic device, and can be implemented by FLASH or Random Access Memory (RAM).
[0213] It should be understood that every feature, structure, or characteristic mentioned herein in relation to an embodiment can be combined with any other feature, structure, or characteristic mentioned herein in relation to another embodiment. It should be understood that the term "in one embodiment" or "in some embodiments" as used herein does not specify a single embodiment, and that the use of the term "in one embodiment" or "in some embodiments" in relation to a particular feature, structure, or characteristic does not mean that every embodiment according to the application includes that particular feature, structure, or characteristic. In addition, it should be understood that the features, structures, or characteristics described in relation to one embodiment can be combined with features, structures, or characteristics of another embodiment.
[0214] It should be understood that every feature, structure, or characteristic mentioned herein in relation to an embodiment can be combined with any other feature, structure, or characteristic mentioned herein in relation to another embodiment. It should be understood that the term "in one embodiment" or "in some embodiments" as used herein does not specify a single embodiment, and that the use of the term "in one embodiment" or "in some embodiments" in relation to a particular feature, structure, or characteristic does not mean that every embodiment according to the application includes that particular feature, structure, or characteristic. In addition, it should be understood that the features, structures, or characteristics described in relation to one embodiment can be combined with features, structures, or characteristics of another embodiment.
[0215] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical functional division. In actual implementation, another division manner can be used, such as: a plurality of units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed components can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0216] The units described as separate components above can or can not be physically separate, and the components displayed as units can or can not be physical units; they can be located in one place or distributed on multiple network units; and part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0217] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.
[0218] Those skilled in the art can understand that all or part of the steps of the above method embodiments can be completed by program instruction related hardware, and the foregoing program can be stored in a computer readable storage medium, and the program executes the steps including the above method embodiments when executed; and the foregoing storage medium includes mobile storage equipment, read only memory (Read Only Memory, ROM), magnetic disc or optical disc and various storage program codes.
[0219] Alternatively, the integrated unit of the present application, if implemented in the form of a software function module and sold or used as an independent product, can also be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes mobile storage equipment, ROM, magnetic disc or optical disc and various storage program codes.
[0220] The above is only an embodiment of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A data processing method, characterized by, The method comprises: Based on the received clustering request for clustering the to-be-clustered data, the to-be-clustered data is nonlinearly mapped to a latent space by a self-encoding network to obtain mapping data, and the mapping data is reconstructed to obtain reconstructed data; the dimension of the mapping data is lower than that of the to-be-clustered data; the to-be-clustered data comprises image data; According to the to-be-clustered data and the reconstructed data, a representation coefficient matrix of the mapping data in the latent space is obtained; the mapping data is represented as self-representation data by the representation coefficient matrix, and the self-representation data is decoded to obtain the reconstructed data; A similarity matrix is constructed using the representation coefficient matrix; Based on the similarity matrix, the to-be-clustered data is clustered; Wherein, the similarity matrix is constructed using the representation coefficient matrix, comprising: The element of the mth row and the nth column of the similarity matrix A is determined by the following formula: wherein is the transpose of , U * ∑ * (V * ) T is the singular value decomposition of C * , C * is a normalization of the coefficient matrix C.
2. The method of claim 1, wherein, The self-encoding network comprises: at least one encoding layer, a self-representation layer, and at least one decoding layer; the to-be-clustered data is nonlinearly mapped to a latent space by a self-encoding network to obtain mapping data, and the mapping data is reconstructed to obtain reconstructed data, comprising: The to-be-clustered data is input into the at least one encoding layer to obtain mapping data output by the at least one encoding layer; The mapping data is input into the self-representation layer to obtain self-representation data output by the self-representation layer; The self-representation data is input into the at least one decoding layer to obtain the reconstructed data output by the at least one decoding layer.
3. The method of claim 2, wherein, According to the to-be-clustered data and the reconstructed data, a representation coefficient matrix of the mapping data in the latent space is obtained, comprising: According to the to-be-clustered data and the reconstructed data, a representation coefficient matrix of the mapping data in the latent space is obtained by the following formula: Wherein, X is the data to be clustered, C is the representation coefficient matrix; H is the mapping data, and λ1 and λ2 are constants.
4. The method of claim 2, wherein, According to the to-be-clustered data and the reconstructed data, a representation coefficient matrix of the mapping data in the latent space is obtained by the following formula: Before obtaining the representation coefficient matrix of the mapping data in the latent space according to the to-be-clustered data and the reconstructed data, the method further comprises: wherein X is the data to be clustered, for the reconstructed data, C is the representation coefficient matrix; H is the mapping data, W is a weight matrix, and λ1 and λ2 are constants.
5. The method of claim 4, wherein, The element of the i th row and the j th column of the weight matrix W is determined by the following formula: The method further comprises: wherein h i and h j respectively represent the value of the i-th dimension and the j-th dimension of the mapping data H, and are the normalized results of h i and h j respectively, the parameter σ is the average value of all elements in the matrix B, the element in the i-th row and the j-th column of the matrix B is the transpose of , i is greater than 0, j is greater than 0, and i is not equal to j.
6. The method of claim 2, wherein, Pre-training data is input into an initial network to obtain output data; the initial network comprises: the at least one encoding layer and the at least one decoding layer; After obtaining the output data, the current loss of the initial network is calculated according to the pre-training data and the output data; Whether the initial network converges is determined according to the current loss; In the case where the initial network does not converge, the initial network is updated according to the current loss, and the pre-training data is input into the initial network to obtain the output data and repeated until the initial network is determined to be converged according to the current loss; The self-representation layer is added to the converged initial network to obtain the self-encoding network. The device comprises:
7. A data processing apparatus, characterized by The dimension reduction module is configured to, based on a received clustering request for clustering data to be clustered, map the data to be clustered to a latent space by a self-encoding network to obtain mapped data, and reconstruct the mapped data to obtain reconstructed data; a dimension of the mapped data is lower than a dimension of the data to be clustered; the data to be clustered comprises image data; The first calculation module is configured to, according to the data to be clustered and the reconstructed data, obtain a representation coefficient matrix of the mapped data in the latent space; the mapped data is represented as self-representation data by the representation coefficient matrix, and the self-representation data is decoded to obtain the reconstructed data; The second calculation module is configured to construct a similarity matrix by using the representation coefficient matrix; The clustering module is configured to cluster the data to be clustered based on the similarity matrix; The second calculation module is configured to construct a similarity matrix by using the representation coefficient matrix; An element of an mth row and an nth column of the similarity matrix A is determined by the following formula: wherein is the transpose of U * ∑ * (V * ) T is the singular value decomposition of C * , C * is a normalization of the coefficient matrix C.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program capable of running on the processor, and the processor implements the data processing method of any one of claims 1 to 6 when executing the program.
9. A storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the data processing method of any one of claims 1 to 6.
Citation Information
Patent Citations
Hyperspectral band selection method, device and apparatus based on depth subspace clustering
CN111652041A