# A Lightweight YOLOv8 Model for Apple Leaf Disease Detection
## 2 Materials and Methods
### Design for the YOLOv8-GGi Model
#### 2.3.1 Backbone Network Optimization  
Traditional convolutional neural networks typically comprise multiple convolutional modules that produce many redundant feature maps during image processing. This redundancy results in increased computational demands and a higher parameter count. Although existing lightweight neural networks, such as SqueezeNet and MobileNet [34], use smaller convolutional kernels to build CNNs, the convolutional layers still take up an extensive array of parameters. In response, [PERSON] et al. [35] proposed a lightweight network model, GhostNet [36; 37], which uses the Ghost module to generate feature maps equivalent to the number of conventional convolutional layers. It then replaces them with the original convolutional layers, compressing the input feature maps through a nonlinear convolution operation. It compresses the input feature layer by nonlinear convolution operation, performs linear convolution operation, processes the feature maps layer by layer, generates another set of feature maps, and finally merges these two sets of feature maps to obtain a new feature map. This methodological approach effectively reduces the computational intricacy and the model's parameter count while maintaining good performance. The convolution process of GhostNet is shown in Figure 6.  
Figure 4: Comparison of YOLOv5 and YOLOv8 neck structures: (**a**) YOLOv5 and (**b**) YOLOv8. In a conventional convolutional neural network, given an input feature layer \(\text{X}\in\text{R}^{\text{c}}\times\text{h}\times\text{w}\), where c is the input channel, h is the height, and w is the input data's width, a typical convolutional layer that generates n feature maps is shown in Equation (1). \[Y=X*f+b, \tag{1}\]  
In convolutional operations, \(*\) is the convolutional operation, b is the bias, \(\text{X}\in\text{R}^{\text{c}^{\prime}\times\text{h}^{\prime}\times\text{w}^{ \prime}}\) is the resulting feature map containing n channels, \(\text{f}\in\text{R}^{\text{c}\times\text{k}\times\text{k}\times\text{n}}\) is the convolutional kernel in this layer, he and w\({}^{\prime}\) are the height and width of the resulting data, respectively, and k \(\times\) k is the kernel size of the convolutional kernel f. Based on the above, the FLOPs of an ordinary convolutional neural network can be calculated with Equation (2), from which  
Figure 5: The architecture of the proposed YOLOv8n-GGi model. Figure 6: Convolution process of GhostNet. it can be concluded that if the number of channels c and the number of convolutional kernels n are large, many FLOPs will exhaust the memory and processing capabilities of the mobile device. \[FLOPs=n\times h^{{}^{\prime}}\times w^{{}^{\prime}}\times c\times k\times k, \tag{2}\]  
The size of the input and output activation maps influences the number of optimized parameters, including the parameters in f (convolutional kernel) and b (bias). However, these output feature maps often exhibit significant redundancy, with many being similar to each other. The Ghost module effectively addresses this issue, as shown in Equations (3) and (4). \[Y^{{}^{\prime}}=X*f^{{}^{\prime}}, \tag{3}\]  
\[Y\text{ghost}=\Phi_{ij}\Big{(}y^{{}^{\prime}}_{i}\Big{)},j\in[1,s-1], \tag{4}\]  
where \(y^{{}^{\prime}}_{i}\) represents the ith original feature map within \(\Phi_{\text{I},\,j}\), and \(\Phi_{\text{I},\,j}\) denotes the jth linear operation responsible for producing the jth ghost feature map. \(Y^{\prime}\in\text{R}^{h^{{}^{\prime}}\times w^{{}^{\prime}}\times\text{m}}\) is the output feature mapping obtained by convolving the input feature layer \(X\in\text{R}^{c\times h\times w}\) using \(\text{f}^{P}\in\text{R}^{c\times k\times k\times m}\). The final output feature mapping Y is received by the concatenation operation, and the parameter count of GhostNet is defined in Equation (6), which, combined with Equation (2), results in a compression ratio of the model of about s, which significantly decreases the number of parameters.