A method for interpreting hidden features of deep learning
By establishing knowledge graphs and filters, the hidden layer features in the deep learning model are explained, the problem of uninterpretability of the deep learning model is solved, and the model's credibility and feature understandability are improved.
Patent Information
- Application Number
- CN202111110993.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-18
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-09-18
AI Technical Summary
Deep learning models lack interpretability, especially in the field of remote sensing. It is difficult to understand the geoscientific knowledge behind hidden layer features, resulting in untrustworthy prediction results of the model.
By building a knowledge graph, extracting feature vectors in images, and using filters to map and screen them with known features, we can obtain an interpretable set of feature vectors, reduce data bias, and improve the interpretability of the model.
It achieves the interpretability of the feature vectors of the deep learning model, makes the network black box transparent, reduces data bias, and improves the credibility of the prediction results.
Smart Images

Figure CN113886595B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the research field of deep learning technology and discloses an interpretable method for deep learning hidden layer features. Technical Background
[0002] With the development of big data and artificial intelligence, deep learning has been widely used in various research fields, especially in many computer vision tasks. However, deep learning models represented by neural network models still lack interpretability. Users do not know the hidden feature expression inside the neural network, nor the accurate semantic meaning behind the hidden features, so they are considered "black box" models.
[0003] Manual feature extraction mainly relies on people's understanding of geometry and mathematics to model a special area in the image to obtain a description function, which can extract distinguishing features from the image. Each dimension extracted often has a specific physical meaning. Manually extracted features containing ground object knowledge are generally divided into the following categories:
[0004] (1) Shape features. Commonly used shape features include Perimeter, Sphericity, and Elongation;
[0005] (2) Spectral characteristics. Commonly used spectral characteristics include NDVI, NDWI, and EVI2;
[0006] (3) Texture features. Commonly used spectral features include Zone Percentage, Dependence Variance, and Coarse.
[0007] In the traditional pattern recognition process, manually designed features are dominant. These features mainly rely on the designer's prior knowledge; in addition, manually designing effective features is a rather long process. Due to the limitations of human knowledge, the fit of the results obtained by manually extracting features and adding traditional classifiers often has an upper limit. Deep learning can obtain results with very high fit, but in fact, we don't know how the model contains a lot of professional knowledge and how this knowledge guides the model to learn from the data and make the final decision. This is called unexplainability. The main purposes of studying the interpretability of deep learning networks are: first, we want to know what knowledge the model has learned from the data, which can help us discover some potential associations; second, the black box nature of the network will seriously affect the credibility of the prediction results, so we need to use interpretability to open the network black box. Therefore, the interpretability of deep neural networks is of great significance.
[0008] The existing technologies for explaining deep neural networks can be roughly divided into three directions: visualization analysis, model compression, and attention mechanism. Among them, visualization analysis introduces deconvolutional neural networks, that is, deconvolution is performed by transposing the convolution kernel in the convolution layer, and the features learned by each network layer are visualized; model compression imitates the decision function of the original deep model by constructing a simple model to achieve the effect of explaining the model and the results similar to the original model; the attention mechanism introduces the Attention vector, assigns different weights to the features and hidden features in the network, and learns the weights during the training process, so as to obtain the importance of each feature for model learning.
[0009] Currently in the field of remote sensing, the lack of geological knowledge cannot help deep learning to understand features. Summary of the invention
[0010] Aiming at the black box nature of deep neural networks, the present invention provides a simple and effective method for interpreting hidden layer features based on the correlation between interpretable features and uninterpretable features.
[0011] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0012] A method for interpreting hidden layer features of deep learning, the method comprising the following steps:
[0013] S1 builds a knowledge graph;
[0014] S2 selects images and deep learning models;
[0015] S3 inputs the image into the deep learning model, extracts the image patch P, and obtains the hidden layer feature vector set Y{y 1 ,y 2 ,…,y m};
[0016] S4 recommends the image spot P based on the knowledge graph to obtain an optimal feature space, and extracts a feature vector set Z{z 1 ,z 2 ,…,z n};
[0017] S5 establishes a mapping function for the feature vector set Y, constructs a filter based on the distance between the mapping result and Z, and filters the feature vector set Y through the filter to obtain the feature vector set Y';
[0018] Among them, the feature vector set Y' is composed of y j ′, the eigenvector y j′ is the feature vector y in the feature vector set Y that is related to the feature vector set Z i Obtained through linear combination.
[0019] Specifically, the steps of S1 are:
[0020] Establishing a feature library, wherein the feature library is composed of original feature semantics;
[0021] Establish a sample library, including multiple samples, each sample has a label and related information, and the related information includes the task, region, size, time, and distribution information related to the sample;
[0022] Build machine learning models;
[0023] According to the label, the sample is input into the machine learning model for feature learning to obtain original feature semantics and semantic importance;
[0024] The original feature semantics and its importance are mapped to relevant information of the sample.
[0025] Specifically, in step S2, the required images are selected according to the task objectives, and the deep learning model selects a fully convolutional neural network;
[0026] Specifically, in step S3, each feature map of each layer from shallow to deep automatically extracted by the machine from the deep learning model is vectorized to obtain the feature vector y i , the feature vector y i Put the feature vector set Y{y 1 ,y 2 ,…,y m}, where 1≤i≤m;
[0027] Specifically, the steps of S4 are:
[0028] Extract relevant information of the image spot P;
[0029] Based on the relevant information of the image spot P, the original feature semantics are retrieved in the feature library of the knowledge graph, and the recommended original feature semantics constitute the preferred feature space of the image spot P;
[0030] According to the recommended original feature semantics, the feature vector z can be extracted j , the extracted feature vectors are put into the feature vector set Z{z 1 ,z 2 ,…,z n}, where 1≤j≤n, the eigenvector z j Extracted from known feature semantics, it is interpretable;
[0031] Specifically, the steps of S5 are:
[0032] (1) Construct the mapping relationship f ij (y i );
[0033] (2) Set the threshold value a;
[0034] (3) Calculate the square of the distance between the mapping of y i and z j , that is, L ij = ||f ij (y i ) - z j || 2 ;
[0035] (4) Screen y i : When j is a fixed value, calculate the minimum value minL ij of L ij , and determine the correlation between y ij and z i according to the relationship between minL j and the threshold value a:
[0036] ⅰ When minL ij ≤ a, it is considered that y i is correlated with z j ;
[0037] ⅱ When minL ij > a, it is considered that y i is not correlated with z j ;
[0038] (5) Obtain y i ' through weighting and linear combination of the screened y j :
[0039] ⅰ. When y i is not correlated with z j , the weight ω j of y i in y ij ' is 0;
[0040] ⅱ. When only one y i is correlated with z j , the weight ω j of y i in y ij ' is 1 i ;
[0041] ⅲ. When multiple y i are correlated with the same z j , determine the weight ω ji of y i according to the value of Lij ;
[0042] ⅳ. And by empowering y i The linear combination of y j ′,
[0043] (6) y j ′ forms a feature vector set Y', where y j ′ and z j One to one correspondence.
[0044] Although the present invention is aimed at image classification tasks, the idea of using known features to explain unknown features through a screening mechanism is applicable to multiple task scenarios, such as machine translation, question answering, sentiment analysis, part-of-speech tagging, dialogue systems, etc. All methods using this idea are within the protection scope of the present invention.
[0045] The present invention has the following beneficial effects compared with the prior art:
[0046] The present invention provides a new idea to introduce traditional features containing geological information into deep learning models through knowledge graphs and filters, which can reduce data bias to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. 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 paying creative work.
[0048] Figure 1 A flowchart of an interpretable method for deep learning hidden layer features provided by the present invention;
[0049] Figure 2 Schematic diagram of the interpretable model of the present invention. Specific implementation methods
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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. The specific embodiments described this time are only used to explain the present invention, not to limit the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0051] like Figure 1 As shown, a method for automatically determining a sampling area based on AI according to an embodiment of the present invention includes the following steps:
[0052] S1 builds a knowledge graph;
[0053] (1) Establish a feature library, which consists of several types of features, including color, texture, shape and spectrum. The feature library consists of n original features, which consist of d k To represent, where 1≤k≤n, the feature library is represented by {d 1 ,d 2 ,…,d n};
[0054] (2) Establishing a sample library, in which samples are labeled and relevant information of the samples is recorded. In this patent, relevant information specifically refers to information such as task, region, size, time, and distribution;
[0055] (3) Build a machine learning model;
[0056] (4) inputting the sample into the machine learning model to perform feature learning on the feature library to obtain the original feature semantics and its importance;
[0057] (5) Graph the original feature semantics and its importance obtained in (4) and the relevant information of the sample;
[0058] S2 selects images and deep learning models. The selected images are remote sensing images obtained from natural resource imaging satellites; the selected deep learning model is a convolutional neural network model;
[0059] S3 inputs the image into the deep learning model, and extracts the hidden layer feature vector set Y{y 1 ,y 2 ,…,y 1376} and patch P, the extraction process is divided into the following two steps:
[0060] (1) The image is input into the deep learning model, and a feature map and a segmentation result spot P are extracted from the deep learning model. The structure of the deep learning model is as follows:
[0061] First layer: Input is the original image of 227×227×3, after convolution, activation, pooling, output featuremapn 1 The size is 27×27, the number is 96, and featuremapn is retained 1 ;
[0062] The second layer: after convolution, activation, pooling, output featuremapn 2 The size is 13×13, the number is 256, and featuremapn is retained 2 ;
[0063] The third layer: after convolution, activation, output featuremapn 3 The size is 13×13, the number is 384, and featuremapn is retained 3 ;
[0064] The fourth layer: after convolution, activation, output featuremapn 4 The size is 13×13, the number is 384, and featuremapn is retained 4 ;
[0065] The fifth layer: after convolution, activation, pooling, output featuremapn 5 The size is 6×6, the number is 256, and featuremapn is retained 5 ;
[0066] The sixth layer: after convolution, activation, output heatmapn 6 The size is 6×6 and the number is 4096;
[0067] The seventh layer: after convolution, activation, output heatmapn 7 The size is 6×6 and the number is 4096;
[0068] The eighth layer: after convolution, activation, output heatmapn 8 The size is 6×6 and the quantity is 1000;
[0069] Ninth layer: heatmapn 8 After upsampling, and featuremapn 4 Fusion; heatmapn 8 and featuremapn 4 The fusion result is upsampled and compared with featuremapn 1 The second fusion is then upsampled and cropped to output the segmentation result patch P with a size of 227×227.
[0070] (2) Obtain the hidden layer feature vector y by vectorizing featuremap i , since 1376 featuremaps are generated from the first to the fifth layers, the feature vector set Y{y 1 ,y 2 ,…,y 1376}.
[0071] S4 makes the best recommendation for the image patch P based on the knowledge graph, and selects the feature space {d 1 ,d2 ,…,d 109} and extract an interpretable feature vector set \(Z = \{z 1 , z 2 , …, z 109 \}\) from the patch \(P\) according to the feature space. It should be noted that, generally, the number of feature vectors in the feature vector set \(Y\) is greater than the number of feature vectors in the feature vector set \(Z\).
[0072] S5 establishes a mapping function for the feature vector set \(Y\), constructs a filter based on the distance between the mapping result and \(Z\), and filters the feature vector set \(Y\) through the filter to obtain the feature vector set \(Y'\). The specific filtering steps are as follows:
[0073] (1) Construct a mapping relationship \(f ij (y i )
[0074] (2) Set a threshold value \(a\).
[0075] (3) Calculate the square \(L i \) of the distance between the mapping of \(y j \) and \(z ij \), \(L ij =\|f ij (y i ) - z j \| 2
[0076] (4) Filter \(y i \): When \(j\) is a fixed value, calculate the minimum value \(minL ij \) of \(L ij \), and determine the correlation between \(y ij \) and \(z i \) according to the relationship between \(minL j \) and the threshold value \(a\):
[0077] ⅰ. When \(minL ij \leq a\), it is considered that \(y i \) is correlated with this \(z j \).
[0078] ⅱ. When \(minL ij > a\), it is considered that \(y i \) is not correlated with this \(z j \).
[0079] (5) Obtain \(y i '\) by weighting and linearly combining the filtered \(y j \):
[0080] ⅰ. When \(y i \) is not correlated with \(z j \), in \(y j '\) for \(yi The weight ω ij is 0;
[0081] ii. When there is only one y i related to z j In y j ′, the weight ω of y i is 1; ij
[0082] iii. When multiple y i are related to the same z j According to the value of L ji determine the weight ω of y i and there is ij
[0083] iv. And obtain y i ′ through the linear combination of weighted y j ;
[0084] (6) Combine y j ′ to form the feature vector set Y', where y j ′ corresponds one-to-one with z j .
[0085] Since the number of y i and z j is large in this embodiment, the screening calculation process is relatively complex. To more clearly illustrate the principle of the above screening process, take Y{y 1 , y 2 , y 3 , y 4} and Z{z 1 , z 2 , z 3} as an example to illustrate the screening process:
[0086] (1) In the filter, calculate the square value L 1j of the distance between the mapping result f 1 (y j ) and z 1j ;
[0087] L 11 = ‖f 11 (y 1 ) - z 1 ‖ 2
[0088] L 12 = ‖f 12 (y 1 ) - z 2 ‖ 2
[0089] L 13 = ‖f 13 (y 1 ) - z 3 ‖ 2
[0090] (2) Set the threshold value a,
[0091] (3) Obtain the minimum value minL of L 1j ; 1j ,
[0092] (4) When minL 1j < a, find the z 1 related to y at this time j as z 3 ;
[0093] (5) In the filter, find the square value L of the distance between the mapping result f 2j (y 2 ) and z j ; 2j ;
[0094] L 21 = ‖f 21 (y 2 ) - z 1 ‖ 2
[0095] L 22 = ‖f 22 (y 2 ) - z 2 ‖ 2
[0096] L 23 = ‖f 23 (y 2 ) - z 3 ‖ 2
[0097] (6) Obtain the minimum value min L of L 2j ; 2j ,
[0098] (7) When minL 2j < a, find the z 2 related to y at this time j as z 1 , z 2 and z 3 , and record the corresponding L 21 , L 22 and L 23 ;
[0099] (8) In the filter, find the mapping result f3j (y 3 ) and z j The square value of the distance L 3j ;
[0100] L 31 =‖f 31 (y 3 )-z 1 ‖ 2
[0101] L 32 =‖f 32 (y 3 )-z 2 ‖ 2
[0102] L 33 =‖f 33 (y 3 )-z 3 ‖ 2
[0103] (9) Find L 3j The minimum value minL 3j ,
[0104] (10) Obtain minL 3j >a, we can assume that y 3 Nothing to do with Z.
[0105] (11) In the filter, find the mapping result f 4j (y 4 ) and z j The square value of the distance L 4j ;
[0106] L 41 =‖f 41 (y 4 )-z 1 ‖ 2
[0107] L 42 =‖f 42 (y 4 )-z 2 ‖ 2
[0108] L 43 =‖f 43 (y 4 )-z 3 ‖ 2
[0109] (12) Find L 4j The minimum value minL 4j ,
[0110] (13) When min L 4j < a, find z related to y at this time 4 as z j and record the corresponding L 1 and L 3 values; 41 and L 43 ;
[0111] (14) Complete the above calculations and find the correlation between y 1 , y 2 , y 3 , y 4 and z j is as follows:
[0112]
[0113] (15) From the relationship in (14), it can be seen that:
[0114] ⅰ. Related to z 1 is y 2 , y 4 . Assume the corresponding L 21 , L 41 has the relationship L 41 > L 21 , then there must exist ω 41 + ω 21 = 1, and ω 41 < ω 21 , so that y 1 ' = ω 41 y 4 + ω 21 y 2 ;
[0115] ⅱ. Related to z 2 is only y 2 , then y 2 ' = y 2 ;
[0116] ⅲ. Related to z 3 is y 1 , y 2 , y 4 . Assume the corresponding L 13 , L 23 , L 43 has the relationship L 13 > L 23 > L 43 , then there must exist ω 13 + ω 23 + ω 43 = 1, and ω 13 < ω23 <ω 43 , so that y 3 '=ω 13 y 1 +ω 23 y 2 +ω 43 y 4 ;
[0117] (16)y 1 ',y 2 ' and y 3 'compose the feature vector set Y';
[0118] In summary, with the help of the above technical solution of the present invention, the hidden layer features are connected with the interpretable features, which makes the network black box transparent to a certain extent.
Claims
1. A method for interpreting hidden layer features of deep learning, characterized in that: The method comprises: S1 builds a knowledge graph; S2 selects images and deep learning models; S3 inputs the image into the deep learning model, extracts the image patch P, and obtains the hidden layer feature vector set Y{y1,y2,...,y m }; S4 recommends the image spot P based on the knowledge graph to obtain an optimal feature space, and extracts a feature vector set Z{z1,z2,...,z n }; S5 establishes a mapping function for the feature vector set Y, constructs a filter based on the distance between the mapping result and Z, and filters the feature vector set Y through the filter to obtain the feature vector set Y′; Among them, the feature vector set Y′ is composed of y j ′, the eigenvector y j ′ is the feature vector y in the feature vector set Y that is related to the feature vector set Z i Obtained through linear combination; S6 performs feature analysis based on the feature vector set Y′; The step of S1 is: establishing a feature library, wherein the feature library is composed of a plurality of original features; Establish a sample library, including multiple samples, the samples are labeled and related information, the related information includes at least one of the tasks, regions, sizes, time and distribution related to the samples; establish a machine learning model; according to the labels, input the samples in the sample library into the machine learning model for feature learning to obtain the original feature semantics and the importance of the semantics; map the original feature semantics and its importance in the feature library and the related information of the samples to obtain a knowledge map; Step S5 includes: (1) constructing a mapping relationship f ij (y i ); (2) Setting a critical value a; (3) Calculate y i The mapping of z j The square of the distance L ij , L ij =||f ij (y i )-z j || 2 ; (4) According to L ij Determine y i With z j Related relationships: (5) Through y i With z j The correlation between y i Perform weighting and linear combination to obtain y j ′: (6) y j ′ forms a feature vector set Y′, where y j ′ and z j One to one correspondence; According to L ij Determine y i With z j The relationship between L and j includes: when j is a constant, calculate L ij The minimum value minL ij ; According to minL ij The relationship with the critical value a determines y i With z j the relevant relationship; The correlation between y i and z j is used to weight and linearly combine y i to obtain y j ′, including: when y i is not correlated with z j , the weight ω j of y i in y ij ′ is 0; when only one y i is correlated with z j , the weight ω j of y i in y ij ′ is 1 i ; when multiple y i are correlated with the same z j , the weight ω ji of y i is determined according to the value of L ij ; y i is linearly combined by weighting to obtain y j ′.
2. The interpretable method for deep learning hidden layer features according to claim 1, characterized in that: The steps of S4 are: Extract relevant information of the image spot P; Based on the relevant information of the image spot P, the original feature semantics are retrieved in the feature library of the knowledge graph, and the recommended original feature semantics constitute the preferred feature space of the image spot P; Extract feature vector z according to the optimal feature space j , the extracted feature vectors are put into the feature vector set Z{z1,z2,...,z n }middle.
3. The interpretable method for deep learning hidden layer features according to claim 1, characterized in that: According to minL ij The relationship with the critical value a determines y i With z j The relevant relationships include: When minL ij When ≤a, it is considered that y i With z j Related; When minL ij > a, we think y i With z j Not relevant.
4. A method for interpreting hidden layer features of deep learning according to any one of claims 1 to 3, characterized in that: The number of eigenvectors in the eigenvector set Y is greater than the number of eigenvectors in the eigenvector set Z.
