# GCS-YOLO: A Lightweight Detection Algorithm for Grape Leaf Diseases Based on Improved YOLOv8
## 3 The Improved GCS-YOLO Object Detection Model
### Lightweight Feature Extraction Module
#### 3.1.1 Ghost Bottleneck  
The incorporation of the Ghost Module reduces parameters and computational costs while maintaining accuracy. As illustrated in Figure 4, this module employs linear transformations to generate redundant intermediate feature maps. The fusion of differentially transformed feature maps significantly enhances the network's feature representation capability. Figure 5 demonstrates that two Ghost Modules can be combined to form a Ghost Bottleneck. In the C2f-GR module, partial Bottleneck structures from the original C2f are replaced with these Ghost Bottlenecks [26].  
Figure 4: Ghost Module structure diagram.  
Figure 3: GCS-YOLO structure diagram.  
For the Bottleneck, assuming the input feature map has height \(h\) and width \(w\), input channels \(C_{\text{in}}\), output channels \(c_{\text{out}}\), intermediate output channels \(c_{out}/2\) between the two standard convolutions, and kernel size \(k\), while omitting minor parameters and computations such as batch normalization (BN) and skip connections, the number of parameters and computational cost for Bottleneck are as follows:  
\[P_{\text{B}}=\frac{c_{\text{out}}}{2}\times k\times k\times C_{\text{in}}+c_{ \text{out}}\times\frac{c_{\text{out}}}{2}\times k\times k \tag{1}\]  
\[F_{\text{B}}=h\times w\times C_{\text{in}}\times\frac{c_{\text{out}}}{2}\times k \times k+\frac{c_{\text{out}}}{2}\times h\times w\times c_{\text{out}}\times k \times k \tag{2}\]  
For the Ghost Bottleneck, maintaining identical input/output dimensions, let \(c_{out}/2\) represent intermediate channels between Ghost Modules. Assuming each Ghost Module employs linear operations with a kernel size of \(d\) and \(s-1\) transformations per channel, the intermediate channels can be denoted as \(c_{\text{out}}/(2\times s)\) and \(c_{\text{out}}/s\), respectively. The number of parameters and computational cost for Ghost Bottleneck are as follows:  
\[P_{\text{G}}=\frac{c_{\text{out}}}{2\times s}\times k\times k\times C_{\text{ in}}+\frac{c_{\text{out}}}{2\times s}\times d\times d\times 1+\frac{c_{\text{out}}}{s} \times k\times k\times\frac{c_{\text{out}}}{2}+\frac{c_{\text{out}}}{s} \times d\times d\times 1 \tag{3}\]  
\[\begin{array}{l}F_{\text{G}}=h\times w\times\frac{c_{\text{out}}}{2\times s }\times C_{\text{in}}\times k\times k+h\times w\times(s-1)\times\frac{c_{\text {out}}}{2\times s}\times d\times d+h\times w\times\frac{c_{\text{out}}}{s} \times k\\ \times k\times\frac{c_{\text{out}}}{2}+h\times w\times(s-1)\times\frac{c_{\text {out}}}{s}\times d\times d\end{array} \tag{4}\]  
By comparing \(F_{\text{B}}\) and \(F_{\text{G}}\), the compression ratio can be calculated as follows:  
\[\frac{F_{\text{B}}}{F_{\text{G}}}=\frac{s\times(C_{\text{in}}+c_{\text{out}}) \times k\times k}{3\times(s-1)\times d\times d+(c_{\text{out}}+C_{\text{in}}) \times k\times k}\approx\frac{s\times(C_{\text{in}}+c_{\text{out}})}{C_{\text {in}}+c_{\text{out}}}=s \tag{5}\]  
where \(d\times d\) has a similar magnitude as that of \(k\times k\), and \(3\times(s-1)\ll C_{\text{in}}+c_{\text{out}}\).