# Detection of Wheat Yellow Rust Disease Severity Based on Improved GhostNetV2
## 2 Materials and Methods
### Methods  
#### 2.3.1 Model Introduction  
With the development of the times, mobile devices have become the main tool used by people. However, large-scale deep learning network models have many parameters and high computing requirements, making it difficult to transplant to mobile terminals. The emergence of lightweight network models solves this problem very well. Compared with large-scale deep network models, lightweight network models have very few parameters and calculations, and the model performance is not inferior to large-scale deep network models and can adapt to scenarios with limited hardware resources, such as mobile terminals and embedded devices. Currently, two types of lightweight networks are commonly used for model compression and compact model design. Knowledge distillation, network pruning, quantization, low-rank decomposition, etc., are commonly used model compression methods. Compact model design is also a very efficient method. For example, MobileNet [24] uses depthwise separable convolution as the basic unit while maintaining the effect, and the calculation amount and parameter number of the model are greatly reduced. ShuffleNet [25] adopts group shuffling, connects different groups, and fully learns features to ensure complete information. When the network is trained, the output feature maps (as shown in Figure 3) of ordinary convolutions (as shown in Figure 4) usually contain a lot of redundancy, some of which may be similar to each other. The main innovation of the GhostNet [26] network is the introduction of the Ghost module (as shown in Figure 5), which reduces the number of convolution kernels and calculations by using cheap linear transformations to generate redundant feature maps. The Ghost module uses initial convolution and cheap convolution instead of standard convolution. When the network is trained, the input data are \(X\in R(C\times H\times W)\) (\(C\), \(H\), \(W\) are the number of channels, height, and width), \(X\) first passes through the convolution kernel to be \(1\times 1\) initial convolution:  
\[Y^{\prime}=X*F_{1\times 1} \tag{6}\]  
\(F_{1\times 1}\) is a pointwise convolution, and \(Y^{\prime}\in R\) (\(H\times W\times C^{\prime}\)out) is an intrinsic feature. Then, use cheap convolution to generate more features, and connect the features generated by the initial convolution and the features generated by cheap convolution based on the channel, namely:  
\[Y=Concat([Y^{\prime},\ Y^{\prime}*F_{dp}]) \tag{7}\]  
where \(F_{dp}\) is a depthwise convolutional filter and \(Y\in R(H\times W\times C_{\text{out}})\) is the output feature. Figure 3: Feature Map. Although the Ghost module reduces computation, its ability to capture spatial information is also reduced. Therefore, GhostnetV2 [27] added an attention mechanism (DFC) based on a fully connected layer, which has lower requirements on hardware, can capture the dependencies between long-distance pixels, and can improve the inference speed. The detailed calculation process of DFC attention is as follows. Given a feature, \(Z\in R\) (\(H\times W\times C\)), it can be viewed as an \(HW\) label, \(z_{i}\in R^{C}\), \(Z=\{z_{11}\), \(z_{12}\),..., \(z_{HW}\}\). Aggregate features along horizontal and vertical directions, respectively. It can be expressed as:  
\[\alpha^{\prime}{}_{hw}=\sum_{h^{\prime}=1}^{H}F_{h,h^{\prime}w}^{H}\odot z_{h^ {\prime}w^{\prime}},h=1,2\cdots,H,w=1,2,\cdots,W, \tag{8}\]  
\[\alpha_{hw}=\sum_{w^{\prime}=1}^{W}F_{hw,hw^{\prime}}^{W}\odot a^{\prime}{}_{ h^{\prime}w^{\prime}}^{W},h=1,2\cdots,H,w=1,2,\cdots,W, \tag{9}\]  
where \(F^{H}\) and \(F^{W}\) are transformation weights, \(\odot\) is element-wise multiplication, and \(A=\{a_{11}\), \(a_{12}\),..., \(a_{HW}\}\) is the generated attention map. Taking the original feature \(Z\) as input, the long-range dependencies along two directions are captured, and its information flow is shown in Figure 6.  
Figure 4: Vanilla Convolution. Figure 5: The Ghost module. Figure 6: The information flow of DFC attention.