This article is reprinted with the authorization of the Autonomous Driving Heart public account. Please contact the source when reprinting
Write in front&&The author’s personal understanding
Currently, algorithm models based on the Transformer structure have had a great impact in the field of computer vision (CV). They surpass previous convolutional neural network (CNN) algorithm models on many basic computer vision tasks. The following is the latest LeaderBoard ranking of different basic computer vision tasks that I found. Through LeaderBoard, we can see the dominance of the Transformer algorithm model in various computer vision tasks
- Image Classification Task
The first is LeaderBoard on ImageNet. It can be seen from the list that among the top five, each model uses the Transformer structure, while the CNN structure is only partially used, or combined with Transformer. Way.
LeaderBoard for image classification task
The next step is on COCO test-dev LeaderBoard, as can be seen from the list, more than half of the top five are based on algorithm structures such as DETR.
LeaderBoard for the target detection task
- Semantic segmentation task
The last is the LeaderBoard on the ADE20K val, which can also be viewed through the list It turns out that among the top few on the list, the Transformer structure still occupies the current main force.
LeaderBoard for semantic segmentation tasks
Although Transformer has shown great development potential in China, the current computer vision community has not fully grasped the inner working principles of Vision Transformer. It also does not grasp the basis for its decision-making (output prediction results), so the need for its interpretability gradually becomes prominent. Only by understanding how such models make decisions can we improve their performance and build trust in artificial intelligence systems
The main purpose of this article is to study the different interpretability methods of Vision Transformer and compare them according to different The research motivation, structure type and application scenarios of the algorithm are classified to form a review article
Analysis of Vision Transformer
Because just mentioned, the structure of Vision Transformer It has achieved very good results in various basic computer vision tasks. So many methods have emerged in the computer vision community to enhance its interpretability. In this article, we mainly focus on classification tasks, starting from Common Attribution Methods, Attention-based Methods, Pruning-based Methods, Inherently Explainable Methods、Other Tasks Among these five aspects, the latest and classic tasks are selected for introduction. Here is the mind map that appears in the paper. You can read it in more detail based on what you are interested in~
Mind map of this article
Common Attribution Methods
The explanation of attribute-based methods usually starts with the process of how the input features of the model gradually obtain the final output results. This type of method is mainly used to measure the correlation between the model's prediction results and the input features
Among these methods, such as Grad-CAM and Integrated Gradients algorithms It is directly applied to the algorithm based on visual Transformer. Some other methods like SHAP and Layer-Wise Relevance Propagation (LRP) have been used to explore ViT-based architectures. However, due to the very high computational cost of methods such as SHAP, the recent ViT Shapely algorithm was designed to adapt to ViT-related application research.
Attention-based Methods
Vision Transformer obtains powerful feature extraction capabilities through its attention mechanism. Among attention-based interpretability methods, visualizing the attention weight results is a very effective method. This article will introduce several visualization techniques
-
Raw Attention: As the name suggests, this method is to visualize the attention weight map obtained by the middle layer of the network model, so as to analyze the effect of the model.
-
Attention Rollout: This technology tracks the transmission of information from the input token to the intermediate embedding by expanding attention weights in different layers of the network.
-
Attention Flow: This method treats the attention graph as a flow network and uses the maximum flow algorithm to calculate the maximum flow value from the intermediate embedding to the input token.
-
partialLRP: This method is proposed for visualizing the multi-head attention mechanism in Vision Transformer, and also considers the importance of each attention head.
-
Grad-SAM: This method is used to alleviate the limitations of relying solely on the original attention matrix to explain model predictions, prompting researchers to use gradients in the original attention weights.
-
Beyond Intuition: This method is also a method for explaining attention, including two stages of attention perception and reasoning feedback.
Finally, here is an attention visualization diagram of different interpretability methods. You can feel the difference between different visualization methods for yourself.
Comparison of attention maps of different visualization methods
Pruning-based Methods
Pruning is a very effective method that is widely used Used to optimize the efficiency and complexity of transformer structures. The pruning method reduces the number of parameters and computational complexity of the model by deleting redundant or useless information. Although pruning algorithms focus on improving the computational efficiency of the model, this type of algorithm can still achieve interpretability of the model.
The pruning methods based on Vision-Transformer in this article can be roughly divided into three categories: explicitly explainable (explicitly explainable), implicitly explainable (implicitly explainable) formula can be explained), possibly explainable (may be explainable).
-
Explicitly Explainable
Among pruning-based methods, there are several types of methods that can provide simpler and more explainable models.
-
IA-RED^2: The goal of this method is to achieve an optimal balance between the computational efficiency and interpretability of the algorithm model. And in this process, the flexibility of the original ViT algorithm model is maintained.
-
X-Pruner: This method is a method for pruning salience units by creating an interpretable perceptual mask that measures the Predict the contribution in a specific class.
-
Vision DiffMask: This pruning method includes adding a gating mechanism to each ViT layer. Through the gating mechanism, the output of the model can be maintained while shielding the input. Beyond this, the algorithmic model can clearly trigger a subset of the remaining images, allowing for better understanding of the model's predictions.
-
Implicitly Explainable
Among the pruning-based methods, there are also some classic methods that can be divided into the implicit explainability model category.
-
Dynamic ViT: This method uses a lightweight prediction module to estimate the importance of each token based on the current characteristics. This lightweight module is then added to different layers of ViT to prune redundant tokens in a hierarchical manner. Most importantly, this method enhances interpretability by gradually locating key image parts that contribute most to classification.
-
Efficient Vision Transformer (EViT): The core idea of this method is to accelerate EViT by reorganizing tokens. By calculating attention scores, EViT retains the most relevant tokens while fusing less relevant tokens into additional tokens. At the same time, in order to evaluate the interpretability of EViT, the author of the paper visualized the token recognition process on multiple input images.
-
Possibly Explainable
Although this type of method was not originally intended to improve the explainability of ViT, this type of method provides a lot of opportunities for further research on the explainability of the model. Great potential.
-
Patch Slimming: Accelerate ViT by focusing on redundant patches in images through a top-down approach. The algorithm selectively retains the ability of key patches to highlight important visual features, thereby enhancing interpretability.
-
Hierarchical Visual Transformer (HVT): This method is introduced to enhance the scalability and performance of ViT. As the model depth increases, the sequence length gradually decreases. Furthermore, by dividing ViT blocks into multiple stages and applying pooling operations at each stage, the computational efficiency is significantly improved. Given the progressive concentration on the most important components of the model, there is an opportunity to explore its potential impact on enhancing interpretability and explainability.
Inherently Explainable Methods
Among the different interpretable methods, there is a class of methods that mainly develops models that can explain algorithms intrinsically. However, these models are usually difficult to achieve with more complex ones. The same level of accuracy as the black box model. Therefore, a careful balance must be considered between interpretability and performance. Next, some classic works are briefly introduced.
-
ViT-CX: This method is a mask-based interpretation method customized for the ViT model. This approach relies on patch embedding and its impact on model output, rather than focusing on them. This method consists of two stages: mask generation and mask aggregation, thereby providing a more meaningful saliency map.
-
ViT-NeT: This method is a new neural tree decoder that describes the decision-making process through tree structures and prototypes. At the same time, the algorithm also allows for visual interpretation of the results.
-
R-Cut: This method enhances the interpretability of ViT through Relationship Weighted Out and Cut. This method includes two modules, namely Relationship Weighted Out and Cut modules. The former focuses on extracting specific classes of information from the middle layer, emphasizing relevant features. The latter performs fine-grained feature decomposition. By integrating both modules, dense class-specific interpretability maps can be generated.
Other Tasks
ViT-based architecture still needs to be explained for other computer vision tasks in the exploration. Some interpretability methods specifically targeted at other tasks have been proposed, and the latest work in related fields will be introduced below
-
eX-ViT: This algorithm is a new interpretable visual transformer based on weakly supervised semantic segmentation. In addition, in order to improve interpretability, an attribute-oriented loss module is introduced, which contains three losses: global-level attribute-oriented loss, local-level attribute discriminability loss, and attribute diversity loss. The former uses attention maps to create interpretable features, while the latter two enhance attribute learning.
-
DINO: This method is a simple self-supervised method and a self-distillation method without labels. The final learned attention map can effectively preserve the semantic areas of the image, thereby achieving interpretable purposes.
-
Generic Attention-model: This method is an algorithm model for prediction based on the Transformer architecture. The method is applied to the three most commonly used architectures, namely pure self-attention, self-attention combined with joint attention, and encoder-decoder attention. To test the interpretability of the model, the authors used a visual question answering task, however, it is also applicable to other CV tasks such as object detection and image segmentation.
-
ATMAN: This is a modality-agnostic perturbation method that uses an attention mechanism to generate a correlation map of the input relative to the output prediction. This approach attempts to understand deformation prediction through memory efficient attention operations.
-
Concept-Transformer: This algorithm generates explanations of model output by highlighting attention scores for user-defined high-level concepts, ensuring trustworthiness and reliability.
Future Outlook
Currently, algorithm models based on the Transformer architecture have achieved outstanding results in various computer vision tasks. However, there is currently a lack of obvious research on how to use interpretability methods to promote model debugging and improvement, and improve model fairness and reliability, especially in ViT applications.
This article aims to use image classification The task is to classify and organize the interpretability algorithm models based on Vision Transformer to help readers better understand the architecture of such models. I hope it will be helpful to everyone
What needs to be rewritten is: Original link: https://mp.weixin.qq.com/s/URkobeRNB8dEYzrECaC7tQ
The above is the detailed content of A deeper understanding of visual Transformer, analysis of visual Transformer. For more information, please follow other related articles on the PHP Chinese website!