# Wild Mushroom Classification Based on Improved MobileViT Deep Learning
## 1 Introduction
### Vision Transformers  
Transformer [20] debuted in 2017 as the first transformation model that relies entirely on self-attention to compute representations of inputs and outputs without using sequence-aligned recurrent neural networks or ConvNets for learning long sequences in NLP tasks. Inspired by the powerful representation capabilities of the transformer, the visual transformer (ViT) [21] was proposed in 2020 for computer vision tasks. This work divides images into multiple image patches (e.g., 16 \(\times\) 16 pixels in size) and compares these image patches to tokens in NLP, which achieves, compared to ConvNets, image classification with impressive speed and accuracy. However, performing well requires a large-scale training dataset (i.e., JFT-300M). Subsequently, DeiT [22] introduced several training strategies to enable ViT to be effective using the smaller ImageNet-1K dataset. To consider the images' local and 2D nature, the Swin Transformer aggregates attention in a shifted window in a hierarchical structure with greater flexibility and generality. However, only partial local feature extraction is considered. Recently, Transformer has made some improvements on modules, including sparse attention [23; 24; 25], improved locality [6; 26], pyramid design [27; 28; 29], and improved training strategies [22; 30; 31; 32], which have improved model data efficiency to different degrees. Nevertheless, an extensive literature review reveals that Transformer-based models for wild mushroom classification are still being determined. The authors of [33] were the first to use the visual transformer large network (ViT-L/32) for wild mushroom classification. However, the dataset has only 11 classes, which could not be more generalizable. The number of parameters of the original ViT network is too large, and the network migration is complicated and not conducive to deployment and use. Improvements have been made to ordinary ViT [22; 31; 32], but none of these ViT variants can outperform SOTA-only convolutional models for ImageNet classification with the same amount of data and computation [34; 35]. This suggests that the standard transformer layer may lack the inductive biases that ConvNets have. Because of the slight inter-class variation and significant intra-class variation in wild mushrooms, they belong with the matter of fine-grained visual recognition (FGVR), and native visual transformers cannot directly exploit their advantages on FGVR. For example, the perceptual field of ViT does not scale effectively because the length of patch tokens does not change with the increase in its encoder block. In addition, the model may not effectively capture the regional concerns carried in the patch tokens and is unsuitable for the fine-grainedclassification of wild mushrooms. Combining the local extraction advantage of convolution with the global extraction advantage of attention, the hybrid design of transformer and convolutional layers will likely be a breakthrough for wild mushroom visual classification.  
Moreover, this paper presents an improvement on the MobileViT [36] model, which combines the advantages of ConvNets and ViTs with the global modeling capability of Transformer and the inductive biasing capability of CNN. In this paper, the MobileViT block and the multi-axis attention module [37] in the original model are input side by side, and then their extracted information is fused, while making up for the lack of local information extraction in MobileViT to enable the model to obtain a more comprehensive and effective interaction of local features and global feature information. Also, in this paper, different training strategies are used to evaluate the model's performance.