## 3 Methodology
### The Proposed Method
#### 3.2.1 Design of C2f_SAConv  
In actual disease detection scenarios for eggplants, captured images often contain different types of diseases. The same type of disease may exhibit significant variations in morphology, location, and size, coupled with complex backgrounds that include multiple eggplants in the field, healthy eggplant leaves, weeds, etc. This can result in indistinct target features captured by the network. The YOLOv8n's Backbone network employs standard convolutions to construct feature extraction modules, but the standard convolutions exhibit a receptive field size that is limited by the dimensions of the convolution kernel. The receptive field of each convolutional layer is usually fixed, making it difficult to flexibly capture a wide range of feature information, especially for disease areas with varying scales and irregular shapes against complex backgrounds, which might easily cause a shortage of contextual information between the disease areas and surrounding background information in the image. Hence, the feature extraction capability of YOLOv8 needs to be optimized.  
This study improved the C2f module in YOLOv8n's Backbone network by integrating the SAConv module. The structure of SAConv is given in Figure 5[20]. It expands the size of the receptive field by adding atrous into the convolution kernel, enabling the convolutional layer to capture features over a larger range without enlarging the convolution kernel in size. Specifically, dilated convolutions were used to introduce \(r-1\) zeros between two consecutive filters, with a dilation rate of \(r\), effectively increasing the convolution kernel size from \(k\times k\) to \(k+(k-1)(r-1)\), thereby expanding the receptive field of the convolution kernel. This allows convolutions with the same kernel size but different dilation rates to fully learn disease features of varying scales and morphologies.  
The SAC structure also incorporates two global context modules, positioned before and after the SAC component, respectively. The two modules augment the features with image-level information, enabling the network to better comprehend and process the overall content of the image, thereby enhancing the quality and accuracy of feature extraction.  
Figure 5: Structure of SAConv.  
Global context modules consist of a global average pooling layer and a \(1\times 1\) convolutional layer, and their output is obtained by adding the input features to the output of these layers. The SAConv is portrayed by the equation given below:  
\[Conv(x,w,1)\overset{Convert\ to}{\underset{SAC}{\rightarrow}}S(x)\cdot Conv(x,w,1 )+(1-S(x))\cdot Conv(x,w+\Delta w,r) \tag{1}\]  
where \(w\) is the input of SAConv, \(Conv(x,w,r)\) represents a convolution operation with weight value \(w\), \(r\) is a hyperparameter of SAConv, \(\Delta w\) is a trainable weight, and \(S(x)\) represents a switching function that can adaptively adjust the switch to handle disease targets with various sizes.  
By combining the C2f and SAConv modules, this study designed the C2f_SAConv module, with its structure shown in Figure 6. The second \(3\times 3\) Conv module in the Bottleneck is replaced by an SAConv layer with a variable receptive field. Subsequently, all BottleNecks in C2f are replaced with the improved BottleNeck_SAConv. Furthermore, some C2f modules were replaced with the improved C2f_SAConv in the Neck network, enabling the detection network to adaptively select convolution results with different receptive fields in complex field environments to extract a more extensive array of feature details from images, thereby enhancing the Backbone's learning of target features with various scales and complex shapes.