# A Lightweight Barcode Detection Algorithm Based on Deep Learning
## 3 Method
### Efficient Multi-Scale Feature Fusion Network  
In traditional convolutional neural networks, each convolutional layer performs complex convolutional operations on the input data to generate new feature maps. However, these feature maps often contain a large amount of redundant information, with many of them being similar or related. In the YOLOv8 network structure, the C2f module serves as the feature fusion module and is abundantly present in both the backbone and neck. To fur  
Figure 4: After many iterations of processing in the network, the input image may suffer from distortion and deformation. (**a**) cropped. (**b**) warped.  
ther reduce the computational cost of the model and improve its operational efficiency, this study introduces the Ghost module [22] into the C2f module, improving the convolutional operation efficiency of the C2f module from the convolutional level and thus enhancing the detection speed of the barcode detection model.  
In the Ghost module (as shown in Figure 5), one of a set of similar feature maps is designated as the Intrinsic feature map, while the others are termed Ghost feature maps. These Ghost feature maps can be obtained by applying linear transformations to the Intrinsic feature map. Given an input \(F_{in}\in R^{h\times w\times c}\), the convolutional filters \(f_{C}\in R^{k\times k\times c\times n}\) of the layer are evenly divided into \(s\) groups. One group of convolutional filters (\(f_{i}\in R^{k\times k\times c\times m},m=n/s\)) is selected to perform standard convolutional operations, resulting in \(m\) Intrinsic feature maps. Each time, \(m\) Intrinsic feature maps are grouped together and subjected to a linear transformation. To ensure uniformity in calculations and reduce resource consumption, the same linear transformation is used to compute \(m\) Ghost feature maps for that group. Finally, \(m\) Intrinsic feature maps and (\(n-m\)) Ghost feature maps are concatenated to produce the final output \(F_{out}\in R^{h1\times w1\times n}\). Assuming that all convolutional kernels have a size of \(k\times k\), the theoretical speedup ratio \(r_{S}\) and compression ratio \(r_{C}\) achieved by using the Ghost module are calculated as follows:  
\[\begin{array}{ll}r_{S}&=\frac{n\times h_{1}\times w_{1}\times c\times k^{2} }{\frac{n}{2}\times h_{1}\times w_{1}\times c\times k^{2}+(s-1)\times\frac{n}{ 2}\times h_{1}\times w_{1}\times k^{2}}\\ &\approx\frac{s\times c}{s+c-1}\approx s,\\ r_{C}&=\frac{n\times c\times k^{2}}{\frac{n}{2}\times c\times k^{2}+(s-1)\times \frac{n}{2}\times k^{2}}\approx\frac{s\times c}{s+c-1}\approx s\end{array} \tag{3}\]  
where \(s\ll c\).  
The reduction in computation, according to calculation Formula (3), hinges on the grouping of convolutional filters within convolutional layers. In this paper, the Ghost module is employed in each convolutional layer of the C2f module, achieving similar feature extraction effects as traditional convolutional layers with fewer computational resources.  
Furthermore, considering the concatenation operations of features at different scales within the model's neck structure, this paper selects the ADown [23] module as the convolutional block for the model's downsampling operations. Compared to conventional convolutional blocks, the ADown module boasts reduced parameters and computational complexity, significantly contributing to improving the model's operational efficiency and hardware compatibility.