# A Lightweight YOLOv8 Model for Apple Leaf Disease Detection
## 2 Materials and Methods
### YOLOv8 Network Structures  
YOLOv8 is one of the latest versions of the YOLO (You Only Look Once) series of object recognition techniques [22; 23]. Ultralytics has launched five versions of YOLOv8: YOLOv8n, YOLOv8n, YOLOv8n, YOLOv8n, YOLOv8l, and YOLOv8x [24]. The architecture of YOLOv8 is divided into three main components: the backbone, the neck, and the head. The backbone accepts input images and extracts feature inputs into the neck through a series of convolution and pooling operations [25]. The neck is used for feature fusion and scale transformation to process the features extracted by the backbone further and perform feature fusion, scale transformation, and other operations. The head is responsible for converting the feature mapping processed by the backbone and neck networks into the final detection result. YOLOv8 is composed of several essential modules, each contributing to the overall detection process. The backbone network incorporates spatial pyramid pooling (SPPF), cross-stage partial network (C2f), convolutional layers (Conv), batch normalization (BN), and Sigmoid linear unit (SiLU). The neck section includes an up-sampling layer (Upsample), concatenation layer (Concat), and the C2f module. The head section is equipped with the detection layer (Detect), which outputs the detection results. Additionally, YOLOv8 features several specialized modules: the spatial pyramid pooling module (SPPF Module) integrates convolutional and maximum pooling layers; the convolution module (Conv Module) combines two-dimensional convolutional layers, batch normalization, and SiLU; the bottleneck module (Bottleneck Module) utilizes convolutional layers; the C2f module merges split layers, bottleneck layers, and concatenation layers; and the detection module (Detect Module) includes convolutional layers, two-dimensional convolutional layers, bounding box loss, and classification loss. These modules work in harmony to ensure that YOLOv8 strikes a balance between computational efficiency and detection accuracy. The architecture of YOLOv8 is illustrated in Figure 3. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Apple Leaf Disease Dataset** & **Precision (\%)** & **Recall (\%)** & **[EMAIL_ADDRESS] (\%)** \\ \hline Original dataset & 79.6 & 73.5 & 81.3 \\ Enhanced dataset & 83.1 & 77.9 & 83.5 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparison of generalization performance before and after data enhancement using YOLOv8n. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Apple** & **Original** & **Enhanced** & \multicolumn{4}{c}{**Enhanced Image (Sheets)**} \\ \cline{3-6}
**Disease Category** & **Images (Sheets)** & **Images (Sheets)** & **Training Set** & **Test Set** & **Validation Set** \\ \hline Alternaria leaf spot & 391 & 1746 & 1222 & 349 & 175 \\ Rust & 390 & 1740 & 1218 & 348 & 174 \\ Grey spot & 391 & 1746 & 1222 & 349 & 175 \\ Frogeye leaf spot & 392 & 1752 & 1226 & 350 & 176 \\ All diseases & 1564 & 6984 & 4888 & 1396 & 700 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Number of apple leaf disease categories before and after data augmentation. Figure 4 illustrates the backbone network architecture comparison between YOLOv8 and YOLOv5.The general structure of the YOLOv8 backbone network shares a general structure with YOLOv5 [26] but diverges by not utilizing the Conv3 modules (C3) of YOLOv5. Instead, it adopts YOLOv7's Efficient Layer Aggregation Network (ELAN) concept [27], integrating C3 with ELAN to form the CSPDarknet53, which leads to the second-stage feature pyramid network (C2f) module as its primary framework [28]. It allows for extracting feature maps with progressively increasing receptive fields through an expanded number of convolutional layers. The Feature Pyramid Network (FPN) [29] utilizes multiple scales to detect targets of varying sizes, while the YOLOv5 forms a bottom-up feature pyramid.