# Wild Mushroom Classification Based on Improved MobileViT Deep Learning
## 3 Results
### Ablation Experiments  
This paper proposes a Transformer network M-ViT based on multidimensional fine-grained attention information fusion with MobileViT as the base network. To address the problem that the attention module of the MobileViT network is not comprehensive for fine-grained feature extraction of wild mushrooms, firstly, we propose a local and Global Attention module MDA, which is input to the network side by side with the attention module of the backbone network for complete feature extraction of local and global features; secondly, an attention SE module is introduced into the residual module in MobileViT for enhancing the representation of the channel, and then a multi-scale information extraction module ASPP is introduced to feature maps at different scales are fused. Finally, different training strategies are used for training comparison to optimize the model's performance. In order to verify the effectiveness of each module in the model proposed in this paper, this section conducts ablation experiments on two datasets, MO106 and mushroom, and compares them with the backbone network. First, the function of the MDA module is verified, and then the different arrangements of the MDA module are added to Layer2, Layer3, and Layer4 based on the MobileViT network. As shown in Table 3, \"\(\sqrt{\cdot}\)\" indicates that the MDA module is added to the corresponding layer in the MobileViT network, and \"\(\times\)\" indicates that it is not added, but the original attention block is used. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**Method**} & \multirow{2}{*}{**Epoch**} & \multirow{2}{*}{**Batch Size**} & \multicolumn{2}{c}{**Accuracy (\%)**} & \multicolumn{2}{c}{**Loss**} \\ \cline{4-7}  & & & **MO106** & **Mushroom** & **MO106** & **Mushroom** \\ \hline Resnet34 & 300 & 32 & 87.44 & 75.0 & 0.43 & 0.178 \\ Mobilenet-V2 & 300 & 32 & 76.49 & 65.2 & 1.37 & 0.944 \\ Efficient & 300 & 32 & 89.91 & 84.9 & 0.07 & 0.126 \\ ConvNeXt & 300 & 32 & 88.23 & 80.24 & 1.056 & 1.079 \\ Transformer & 300 & 32 & 90.90 & 78.25 & 0.301 & 1.027 \\ Swin-transformer & 300 & 32 & 88.47 & 76.31 & 0.622 & 1.512 \\ ShuffleNet & 300 & 32 & 89.54 & 83.5 & 0.12 & 0.164 \\ Backbone & 300 & 32 & 92.58 & 86.11 & 0.603 & 0.90 \\ Our method & 300 & 32 & 96.21 & 91.83 & 1.053 & 0.871 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Comparison with other methods on two datasets. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Class** & **Precision (\%)** & **Recall (\%)** & **Specificity (\%)** & **F1-Score (\%)** \\ \hline Conditionally\_edible & 93.2 & 82.1 & 99.7 & 87.3 \\ Deadly & 90.4 & 74.8 & 98.7 & 81.9 \\ Edible & 97.6 & 92.3 & 99.1 & 94.9 \\ Poisonous & 89.3 & 96.8 & 86.8 & 92.9 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Classification evaluation results of M-ViT on the mushroom dataset. Table 3 shows the seven cases of the original MobileViT model with MDA modules added to different layers. On the MO106 dataset, the accuracy of adding the MDA module to Layer2, Layer3, and Layer4 is 94.74%, 94.69%, and 95.04%, respectively, which is 2.16%, 2.11%, and 2.46% higher compared with the backbone. On the mushroom dataset, the accuracy of adding the MDA module to Layer2, Layer3, and Layer4 was 90.13%, 90.20%, and 90.34%, respectively, which improved by 4.02%, 4.09% and 4.23%, respectively, compared with the backbone. However, after adding two or three MDA modules at different locations in Layer2, Layer3, and Layer4 simultaneously, the model's accuracy decreased, which was affected by overfitting after the model became complex. Therefore, considering the accuracy and the number of network parameters, this study chose to add MDA at Layer 4 for the next improvement. We then investigated the effect of different MLPs in the MDA module on the network, and the results are shown in Table 4.  
Table 4 shows the effect of adding different MLP modules to the model. From the experimental results, the gMLP module improved both datasets' accuracy, so we chose to include the gMLP module.