SAR image classification network interpretability analysis method based on attribution reasoning

By constructing an attention attribution measurement model and attribution score matrix, the decision behavior of the Transformer model is explained based on the attribution reasoning method, which solves the problem that the model's decision behavior is difficult to explain and improves the interpretability of the model.

CN119514702AActive Publication Date: 2025-02-25NORTHWESTERN POLYTECHNICAL UNIV

Patent Information

Application Number
CN202411540761.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-02-25
Estimated Expiration
2044-10-31

AI Technical Summary

Technical Problem

The decision-making behavior of existing SAR image classification models based on Transformer is difficult to explain, especially when dealing with large-scale, high-dimensional data sets, the internal calculations of the model become very abstract and difficult to understand.

Method used

The attributional inference method is adopted to construct an attention attribution measurement model, calculate the attribution inference matrix at each level of the Transformer classification network, measure the contribution value of attention heads, and build an attribution score matrix to quantify the contribution of each layer of input token to network decisions.

Benefits of technology

Through this method, the contribution of the network structure can be effectively measured, the area of ​​focus on model decision making can be positioned, the interpretability of the model can be improved, and the interpretability analysis of the Transformer network decision path can be realized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119514702A_ABST
    Figure CN119514702A_ABST
Patent Text Reader

Abstract

The invention discloses an SAR image classification network interpretability analysis method based on attribution reasoning. The SAR image classification network interpretability analysis method comprises the following steps of 1, obtaining an SAR image data set and a trained Transform classification network; 2, constructing an attention attribution measurement model, and calculating an attribution reasoning matrix of each level of the Transform classification network; 3, measuring the contribution value of the attention head, searching for a connection relation with a high contribution value in an attention mechanism, and carrying out interpretability analysis on a network structure; 4, constructing an attribution score matrix, quantifying the contribution degree of each layer of input Token to a network decision, and carrying out interpretability analysis on a key path of the network; and step 5, performing non-key Token pruning, and realizing input Token lightweight of the Transform classification network. According to the attribution reasoning interpretability analysis method provided by the invention, the action mechanism of the model can be explained from two perspectives of network structure analysis and network feature transfer analysis, and the interpretability of SAR image classification based on Transform is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of intelligent interpretation of remote sensing images, and specifically relates to an interpretability analysis method of SAR image classification network based on attribution reasoning. Background Art

[0002] With the development of deep learning methods, Transformer-based deep networks have shown excellent performance in SAR image classification tasks. However, there are many difficult-to-explain problems with their decision-making behavior. The complex Transformer model is composed of many layers, each of which contains a large number of parameters and complex nonlinear operations. This complexity makes it difficult to understand the model's prediction mechanism. Especially when dealing with large-scale, high-dimensional data sets, the calculations performed within the model become very abstract and even more difficult to understand.

[0003] In order to improve the transparency and reliability of deep learning models, scholars have conducted research. According to the timing of providing explanations to the model, the current methods of deep learning interpretability are generally divided into two categories: ex ante interpretability methods and ex post interpretability methods. The ex ante interpretability model is generally simple enough to be easy to explain, and its model parameters, model nodes, and feature dimensions can be intuitively explained. However, it is difficult to fit a large data set directly using a model with a simple structure and good interpretability, and the accuracy of the model is difficult to guarantee. The ex post interpretability method is to explain the trained model and make the working mechanism, decision process, and decision basis of the deep learning model transparent by constructing an explanatory model. The ex post interpretability method is more versatile than the ex ante interpretability method and can be adapted to different deep networks and task scenarios. According to the difference in the object of explanation, the ex post interpretability method can be divided into global interpretation methods and local interpretability methods. However, so far, the research on deep learning interpretability has not been fully developed. It is of great significance to study more universal and comprehensive deep learning network interpretability methods for task scenarios of different complexity.

[0004] Therefore, this application is based on attribution reasoning to explain the model's mechanism of action from two perspectives: network structure analysis and network feature transmission, in order to improve the interpretability of Transformer-type network models. Summary of the invention

[0005] In response to the above technical problems, the present invention provides a SAR image classification network interpretability analysis method based on attribution reasoning. This method can effectively measure the contribution of each level of network structure and locate the area of ​​concern for model decision-making, thereby improving the interpretability of the Transformer-based SAR image classification model.

[0006] The technical method adopted by the present invention is: a SAR image classification network interpretability analysis method based on attribution reasoning, characterized in that it includes the following steps:

[0007] Step 1: Obtain the SAR image dataset and the trained Transformer classification network;

[0008] Step 2: Build an attention attribution measurement model and calculate the attribution inference matrix of each level of the Transformer classification network;

[0009] Step 201: Introduce a scaling factor θ to control the strength of the attention weight inside the Transformer model, according to the formula Calculate the attribution inference matrix of the hth head in a certain layer of Transformer, where A=[A1,A2,...,A h ,..,A H ] represents the attention matrix of the multi-head attention mechanism of this layer, and the symbol ⊙ represents the multiplication of the corresponding elements of the matrix. h ∈R n×n Represents the h-th head attention weight matrix A h The corresponding attribution inference matrix, Represents the Transformer network F x (·) Along A h The gradient of

[0010] Step 202: Use the Riemann sum formula to approximate the integral equation in step 201, that is, Where N is the number of sampling points;

[0011] Step 3: Measure the contribution value of the attention head, search for connections with high contribution values ​​in the attention mechanism, and perform interpretability analysis on the network structure;

[0012] Step 301: For the i-th test set sample X i , the attribution metric model is used to calculate the attribution inference matrix Ainf of each layer of Transformer i l =[At i l,1 ,At i l,2 ,...,At i l,H ], where l represents the lth layer, and H represents the total number of attention heads in the network at this layer;

[0013] Step 302: For the i-th test sample, use the formula Calculate the contribution score of the hth head in the lth layer;

[0014] Step 303: Traverse all samples in the test set in turn, and then use the formula Accumulate the contribution scores to get the contribution of the attention head at the lth layer;

[0015] Step 304: Normalize the contribution of the attention heads of each layer, that is, Get the contribution distribution of each attention head of the Transformer network on the SAR image dataset I l =[I1,I2,...,I H ];

[0016] Step 4: Construct an attribution score matrix to quantify the contribution of each layer of input tokens to network decisions and perform interpretability analysis on the key paths of the network.

[0017] Step 401: Get a given sample X according to step 202 i The corresponding attribution matrix of the lth layer in represents the attribution matrix of the h-th head in the l-th layer;

[0018] Step 402: For the hth head in the lth layer, filter out the values ​​on the diagonal of the attribution matrix and the values ​​below the threshold τ to avoid the impact of the contribution value evaluation of strong autocorrelation pairs and too weak correlation pairs, that is, in Represents the attribution matrix after filtering, ones n×n Represents a matrix with all values ​​1, I n×n represents the identity matrix, M n×n Indicates that the conditions are met A binary matrix of

[0019] Step 403: For the lth layer of the Transformer network, it is necessary to consider the contribution of all attention heads to the model decision, so the attribution matrix of each attention head is Accumulate to obtain the single-layer attribution score matrix of the lth layer

[0020] Step 404: Accumulate the single-layer attribution score matrices of all layers after layer l to obtain the overall attribution score matrix of the lth layer of the Transformer network, that is,

[0021] Step 405: Calculate the contribution value of the tth Token in the lth layer. where as t,k Represents the attribution score matrix of the lth layer the (t,k)th element of ;

[0022] Step 5: Perform non-critical Token pruning to achieve lightweight input Tokens of the Transformer classification network;

[0023] Step 501: Propose the pruning principle of non-critical tokens: the feature tokens pruned at the current level cannot appear in all subsequent levels, that is, the pruned feature tokens should not participate in the subsequent propagation of the network; the total number of tokens pruned at the current level should be greater than or equal to the total number of tokens pruned at the previous level; for each sample, the key information flow in the network should be different;

[0024] Step 502: Calculate sample X i The key token index number reserved at level l Right now

[0025]

[0026]

[0027] where k l ′ represents the number of tokens that need to be retained at layer l, The contribution value of all tokens in layer l is calculated according to step 505. Indicates the index mask, according to the principle of step 501, to block the influence of the pruned Token on the subsequent information flow;

[0028] Step 503: According to the index number reserved by each layer To determine the sample X i The key Token information flow in the Transformer network realizes the lightweight of the network input Token.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] 1. The present invention constructs an attention attribution measurement model, obtains the attribution matrix of each level in the classification network, and realizes the modeling of the correlation between the attention weight matrix and the model decision results, providing a basis for quantitative analysis of interpretability from different angles.

[0031] 2. Based on the attribution matrix, the present invention constructs the contribution value of the attention head in the classification network, realizes the search for connection relationships with high contribution values ​​in the attention mechanism, and improves the interpretability from the perspective of network structure analysis.

[0032] 3. Based on the attribution matrix, the present invention constructs the attribution score matrix of each level of token in the classification network, realizes the quantification of the contribution of input tokens in each layer to network decision-making, improves the interpretability from the perspective of network feature transmission, and completes the model decision path reasoning.

[0033] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 The figure is a flow chart of the method of the present invention.

[0035] Figure 2 Schematic diagram of attention attribution measurement in the present invention.

[0036] Figure 3 This is a schematic diagram of the key Token reasoning in the present invention. DETAILED DESCRIPTION

[0037] The method of the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments of the present invention.

[0038] It should be noted that, in the absence of conflict, the embodiments and properties in the embodiments of the present application can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0039] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0041] For ease of description, spatially relative terms such as "above", "above", "on the upper surface of", "above", etc. may be used here to describe the spatial positional relationship between a device or feature and other devices or features as shown in the figure. It should be understood that spatially relative terms are intended to include different orientations of the device in use or operation in addition to the orientation described in the figure. For example, if the device in the accompanying drawings is inverted, the device described as "above other devices or structures" or "above other devices or structures" will be positioned as "below other devices or structures" or "below other devices or structures". Thus, the exemplary term "above" can include both "above" and "below". The device can also be positioned in other different ways (rotated 90 degrees or in other orientations), and the spatially relative descriptions used here are interpreted accordingly.

[0042] like Figure 1 As shown, the present invention comprises the following steps:

[0043] Step 1: Obtain the SAR image dataset and the trained Transformer classification network;

[0044] Step 2: Build an attention attribution measurement model and calculate the attribution inference matrix of each level of the Transformer classification network;

[0045] Step 201: Introduce a scaling factor θ to control the strength of the attention weight inside the Transformer model, according to the formula Calculate the attribution inference matrix of the hth head in a certain layer of Transformer, where A=[A1,A2,...,A h ,..,A H ] represents the attention matrix of the multi-head attention mechanism of this layer, and the symbol ⊙ represents the multiplication of the corresponding elements of the matrix. h ∈R n×n Represents the h-th head attention weight matrix A h The corresponding attribution inference matrix, Represents the Transformer network F x (·) Along A h The gradient of

[0046] Step 202: Use the Riemann sum formula to approximate the integral equation in step 201, that is, Where N is the number of sampling points;

[0047] Step 3: Measure the contribution value of the attention head, search for connections with high contribution values ​​in the attention mechanism, and perform interpretability analysis on the network structure;

[0048] Step 301: For the i-th test set sample X i , the attribution metric model is used to calculate the attribution inference matrix of each layer of Transformer Where l represents the lth layer, and H represents the total number of attention heads in the network of this layer;

[0049] Step 302: For the i-th test sample, use the formula Calculate the contribution score of the hth head in the lth layer;

[0050] Step 303: Traverse all samples in the test set in turn, and then use the formula Accumulate the contribution scores to get the contribution of the attention head at the lth layer;

[0051] Step 304: Normalize the contribution of the attention heads of each layer, that is, Get the contribution distribution of each attention head of the Transformer network on the SAR image dataset I l =[I1,I2,...,I H ];

[0052] Step 4: Construct an attribution score matrix to quantify the contribution of each layer of input tokens to network decisions and perform interpretability analysis on the key paths of the network.

[0053] Step 401: Get a given sample X according to step 202 i The corresponding attribution matrix of the lth layer in represents the attribution matrix of the h-th head in the l-th layer;

[0054] Step 402: For the hth head in the lth layer, filter out the values ​​on the diagonal of the attribution matrix and the values ​​below the threshold τ to avoid the impact of the contribution value evaluation of strong autocorrelation pairs and too weak correlation pairs, that is, in Represents the attribution matrix after filtering, ones n×n Represents a matrix with all values ​​1, I n×n represents the identity matrix, M n×n Indicates that the conditions are met A binary matrix of

[0055] Step 403: For the lth layer of the Transformer network, it is necessary to consider the contribution of all attention heads to the model decision, so the attribution matrix of each attention head is Accumulate to obtain the single-layer attribution score matrix of the lth layer

[0056] Step 404: Accumulate the single-layer attribution score matrices of all layers after layer l to obtain the overall attribution score matrix of the lth layer of the Transformer network, that is,

[0057] Step 405: Calculate the contribution value of the tth Token in the lth layer. where as t,k Represents the attribution score matrix of the lth layer the (t,k)th element of ;

[0058] Step 5: Perform non-critical Token pruning to achieve lightweight input Tokens of the Transformer classification network;

[0059] Step 501: Propose the pruning principle of non-critical tokens: the feature tokens pruned at the current level cannot appear in all subsequent levels, that is, the pruned feature tokens should not participate in the subsequent propagation of the network; the total number of tokens pruned at the current level should be greater than or equal to the total number of tokens pruned at the previous level; for each sample, the key information flow in the network should be different;

[0060] Step 502: Calculate sample X i The key token index number R reserved at level l l i ,Right now

[0061]

[0062]

[0063] where k l ′ represents the number of tokens that need to be retained at layer l, The contribution value of all tokens in layer l is calculated according to step 505. Indicates the index mask, according to the principle of step 501, to block the influence of the pruned Token on the subsequent information flow;

[0064] Step 503: According to the index number reserved by each layer To determine the sample X i The key Token information flow in the Transformer network realizes the lightweight of the network input Token.

Claims

1. A SAR image classification network interpretability analysis method based on attribution reasoning, characterized in that: The following steps are involved: Step 1: Obtain the SAR image dataset and the trained Transformer classification network; Step 2: Build an attention attribution measurement model and calculate the attribution inference matrix of each level of the Transformer classification network; Step 201: Introduce a scaling factor θ to control the strength of the attention weight inside the Transformer model, according to the formula Calculate the attribution inference matrix of the hth head in a certain layer of Transformer, where A=[A1,A2,...,A h ,..,A H ] represents the attention matrix of the multi-head attention mechanism of this layer, and the symbol ⊙ represents the multiplication of the corresponding elements of the matrix. h ∈R n×n Represents the h-th head attention weight matrix A h The corresponding attribution inference matrix, Represents the Transformer network F x (·) Along A h The gradient of Step 202: Use the Riemann sum formula to approximate the integral equation in step 201, that is, Where N is the number of sampling points; Step 3: Measure the contribution value of the attention head, search for connections with high contribution values ​​in the attention mechanism, and perform interpretability analysis on the network structure; Step 301: For the i-th test set sample X i , the attribution measurement model is used to calculate the attribution inference matrix Ainf of each layer of Transformer i l =[At i l,1 ,At i l,2 ,...,At i l,H ], where l represents the lth layer, and H represents the total number of attention heads in the network at this layer; Step 302: For the i-th test sample, use the formula Calculate the contribution score of the hth head in the lth layer; Step 303: Traverse all samples in the test set in turn, and then use the formula Accumulate the contribution scores to get the contribution of the attention head at the lth layer; Step 304: Normalize the contribution of the attention heads of each layer, that is, Get the contribution distribution of each attention head of the Transformer network on the SAR image dataset I l =[I1,I2,...,I H ]; Step 4: Construct an attribution score matrix to quantify the contribution of each layer of input tokens to network decisions and perform interpretability analysis on the key paths of the network. Step 401: Get a given sample X according to step 202 i The corresponding attribution matrix of the lth layer in represents the attribution matrix of the h-th head in the l-th layer; Step 402: For the hth head in the lth layer, filter out the values ​​on the diagonal of the attribution matrix and the values ​​below the threshold τ to avoid the impact of the contribution value evaluation of strong autocorrelation pairs and too weak correlation pairs, that is, in Represents the attribution matrix after filtering, ones n×n Represents a matrix with all values ​​1, I n×n represents the identity matrix, M n×n Indicates that the conditions are met A binary matrix of ; Step 403: For the lth layer of the Transformer network, it is necessary to consider the contribution of all attention heads to the model decision, so the attribution matrix of each attention head is Accumulate to obtain the single-layer attribution score matrix of the lth layer Step 404: Accumulate the single-layer attribution score matrices of all layers after layer l to obtain the overall attribution score matrix of the lth layer of the Transformer network, that is, Step 405: Calculate the contribution value of the tth Token in the lth layer. where as t,k Represents the attribution score matrix of the lth layer the (t,k)th element of ; Step 5: Perform non-critical Token pruning to achieve lightweight input Tokens of the Transformer classification network; Step 501: Propose the pruning principle of non-critical tokens: the feature tokens pruned at the current level cannot appear in all subsequent levels, that is, the pruned feature tokens should not participate in the subsequent propagation of the network; the total number of tokens pruned at the current level should be greater than or equal to the total number of tokens pruned at the previous level; for each sample, the key information flow in the network should be different; Step 502: Calculate sample X i The key token index number reserved at level l Right now where k l ′ represents the number of tokens that need to be retained at layer l, The contribution value of all tokens in layer l is calculated according to step 505. Indicates the index mask, according to the principle of step 501, to block the influence of the pruned Token on the subsequent information flow; Step 503: According to the index number reserved by each layer To determine the sample X i The key Token information flow in the Transformer network realizes the lightweight of the network input Token.

Citation Information

Patent Citations

  • Deep learning-based interpretable SAR image target detection method and system

    CN113902978A

  • Full-chain interpretable power distribution network single-phase earth fault type identification method and system

    CN117929913A

  • Model interpretation method, image processing method, electronic device, and storage medium

    US20240104906A1

Cited By

  • Reasoning model explanation method, reasoning model training method, and reasoning task processing method

    WO2026179505A1