A Barcode Detection Method and System Based on Improved YOLOv8

By improving the barcode detection method of YOLOv8, introducing a multi-scale linear attention mechanism and EfficientViT units, and combining them with C2f-Ghost units and anchorless detection heads, and using DFL and CIoU loss functions to optimize model training, the problems of insufficient accuracy and efficiency in barcode detection are solved, and efficient and accurate barcode detection is achieved.

CN119540709BActive Publication Date: 2025-10-28ZHEJIANG SCI-TECH UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411412703.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-10-28
Estimated Expiration
2044-10-11

AI Technical Summary

Technical Problem

Existing barcode detection methods suffer from insufficient accuracy due to the difficulty in fully capturing barcode features, and consume excessive computational resources in complex backgrounds, reducing detection efficiency.

Method used

The improved YOLOv8 barcode detection method introduces a multi-scale linear attention mechanism and EfficientViT units, combined with C2f-Ghost units and an anchorless detection head. The model training is optimized using DFL and CIoU loss functions, thereby improving feature extraction and detection speed.

Benefits of technology

It improves the accuracy and efficiency of barcode detection, reduces the consumption of computing resources, enhances the model's generalization ability and robustness, and adapts to complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540709B_ABST
    Figure CN119540709B_ABST
Patent Text Reader

Abstract

This invention provides a barcode detection method and system based on an improved YOLOv8, belonging to the field of target detection technology. The method includes: establishing a sample set with multiple barcode images, each barcode image having a barcode location label and a barcode category label; constructing a barcode detection model, wherein the barcode detection model includes a backbone network module, a neck network module, and a detection head module connected in sequence; establishing a joint loss function including a DFL loss function and a CIoU loss function; inputting an expanded dataset into the barcode detection model to train the barcode detection model until the joint loss function value is less than a preset joint loss function value; acquiring the barcode image to be detected; inputting the barcode image to be detected into the trained barcode detection model, and outputting the predicted barcode location and predicted barcode category. This reduces detection resource consumption and improves detection accuracy and speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of target detection technology, and in particular to a barcode detection method and system based on an improved YOLOv8. Background Technology

[0002] A barcode is a machine-readable encoding method, typically composed of black and white stripes of varying widths, used to uniquely identify goods, assets, or other items. By scanning a barcode, relevant information such as product price and inventory can be quickly obtained. YOLOv8 is a deep learning-based object detection algorithm, short for "You Only LookOnce." This algorithm is known for its high speed and accuracy, capable of detecting and recognizing multiple targets in images or videos in real time. YOLOv8 is the latest version in this algorithm family, boasting even higher detection accuracy and faster inference speed.

[0003] Barcode detection is crucial in many applications, such as inventory management, logistics tracking, and automated checkout. Accurate detection and reading of barcodes can improve efficiency, reduce human error, and ensure data accuracy. This not only optimizes operational processes but also provides businesses with real-time data tracking and analysis capabilities.

[0004] However, in existing barcode detection processes, because barcodes are usually represented by thin lines and high-contrast stripes, these features are difficult to fully capture during extraction, resulting in limited feature extraction capabilities and insufficient detection accuracy. Moreover, in real-world scenarios, barcodes may appear in complex backgrounds, or even be similar in color to the background. In complex backgrounds, more computational resources are required to distinguish barcodes from other similar features, which increases processing time and reduces detection efficiency. Summary of the Invention

[0005] To address the limitations of existing barcode detection technologies, which often employ thin lines and high-contrast stripes, making feature extraction difficult and resulting in insufficient detection accuracy, and further complicating the computational demands of distinguishing barcodes from similar features in complex backgrounds, thereby increasing processing time and reducing detection efficiency, this invention provides a barcode detection method and system based on an improved YOLOv8.

[0006] The technical solutions provided by the embodiments of the present invention are as follows:

[0007] First aspect

[0008] This invention provides a barcode detection method based on an improved YOLOv8, comprising:

[0009] S1: Establish a sample set with multiple barcode images, where each barcode image has a barcode location label and a barcode category label;

[0010] S2: Construct a barcode detection model, wherein the barcode detection model includes a backbone network module, a neck network module, and a detection head module connected in sequence. The backbone network module includes an EfficientViT unit with a multi-scale linear attention mechanism unit and a linear attention mechanism enhancement unit with a nonlinear function. The linear attention mechanism enhancement unit includes interconnected FFN layers and deep convolutional units. The neck network module includes a C2f-Ghost unit for feature fusion. The detection head module includes a detection unit with multiple anchorless detection heads. The C2f-Ghost unit is a C2f unit including Ghost sub-units.

[0011] S3: Establish a joint loss function that includes the DFL loss function and the CIoU loss function;

[0012] S4: Input the expanded dataset into the barcode detection model to train the barcode detection model until the joint loss function value is less than the preset joint loss function value;

[0013] S5: Obtain the image of the barcode to be detected;

[0014] S6: Input the image of the barcode to be detected into the trained barcode detection model, and output the predicted barcode position and predicted barcode category.

[0015] Second aspect

[0016] This invention provides a barcode detection system based on an improved YOLOv8, comprising:

[0017] processor;

[0018] A memory storing computer-readable instructions, which, when executed by the processor, implement the barcode detection method based on the improved YOLOv8 as described in the first aspect.

[0019] Third aspect

[0020] The present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the barcode detection method based on the improved YOLOv8 as described in the first aspect.

[0021] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:

[0022] In this invention, the traditional YOLOv8 backbone network module, neck network module, and detection head module are improved. Specifically, the backbone network module introduces a multi-scale linear attention mechanism unit with a nonlinear function and an EfficientViT unit that enhances the linear attention mechanism. The enhanced linear attention mechanism unit includes interconnected FFN layers and deep convolutional units. By introducing an attention mechanism, higher accuracy in barcode detection is achieved with fewer parameters and less computation. Convolutional enhancement of linear attention improves the model's attention to spatial local information, and group convolution is used within the module to reduce the total number of operations for information aggregation, further improving the model's efficiency in barcode feature extraction. The neck network module introduces a C2f-Ghost unit for feature fusion, and the C2f module is improved at the convolutional level by introducing a Ghost module, thus enhancing the efficiency of the C2f module. The efficiency of convolution operations in the C2f module is improved, thereby increasing the detection speed of the barcode detection model. A detection unit with multiple anchor-free detection heads is introduced into the detection head module. This multi-head design allows the target's position and category information to be learned and fused through different branches. This method effectively reduces the number of parameters, accelerates model training, reduces the risk of overfitting, and enhances the model's generalization ability and robustness. It comprehensively improves efficiency in feature extraction, feature fusion, and target recognition, enhancing the accuracy of feature capture and thus increasing the accuracy and efficiency of barcode target detection. Furthermore, considering that the actual distribution of target barcodes is usually not too far from their labeled positions, the model should focus on values ​​near the labeled positions during training. Therefore, the DFL loss function is combined with the CIoU loss function to improve the model's training effect and further enhance the accuracy of target detection. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 A flowchart illustrating a barcode detection method based on an improved YOLOv8 provided in an embodiment of the present invention;

[0025] Figure 2 This is a schematic diagram of the structure of a barcode detection model provided in an embodiment of the present invention;

[0026] Figure 3This is a schematic diagram of the structure of an EfficientViT unit provided in an embodiment of the present invention;

[0027] Figure 4 This is a schematic diagram of the structure of a C2f-Ghost unit provided in an embodiment of the present invention;

[0028] Figure 5 This is a schematic diagram of a feature extraction process for a Ghost subunit provided in an embodiment of the present invention;

[0029] Figure 6 This is a schematic diagram of the feature structure of a detection head module provided in an embodiment of the present invention;

[0030] Figure 7 This is a schematic diagram of a barcode detection system based on an improved YOLOv8, provided as an embodiment of the present invention. Detailed Implementation

[0031] The technical solution of the present invention will now be described with reference to the accompanying drawings.

[0032] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.

[0033] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning.

[0034] In this embodiment of the invention, sometimes a subscript such as W1 may be mistakenly written as a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.

[0035] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.

[0036] Reference manual attached Figure 1 The diagram shows a flowchart of a barcode detection method based on an improved YOLOv8 provided by an embodiment of the present invention.

[0037] This invention provides a barcode detection method based on an improved YOLOv8, which can be implemented by a barcode detection device based on the improved YOLOv8, which can be a terminal or a server. The processing flow of the barcode detection method based on the improved YOLOv8 may include the following steps:

[0038] S1: Establish a sample set with multiple barcode images.

[0039] Each barcode image includes a barcode location label and a barcode category label.

[0040] In this context, barcode location labels indicate the specific location of the barcode within an image. They are typically represented by a rectangle, with the coordinates of its four vertices defining the barcode's boundaries in the image. The primary function of location labels is to help the model accurately identify the barcode's position, enabling precise barcode localization during detection. Barcode category labels indicate the category or type to which the barcode belongs. Category labels identify these different types of barcodes, allowing the model to not only detect the barcode's location but also determine its specific category. By constructing a precisely labeled set of barcode image samples, the model receives supervised information regarding location and category, thereby improving detection accuracy and classification performance. Its advantage lies in ensuring the model accurately identifies and classifies barcodes in various situations, enhancing the model's generalization ability.

[0041] In one possible implementation, S1 specifically includes:

[0042] S101: Obtain the original dataset containing multiple barcode images;

[0043] S102: Re-label the original dataset to obtain a labeled dataset;

[0044] S103: Perform data augmentation operations on the labeled dataset using the Mosaic algorithm to obtain an expanded dataset. The data augmentation operations include image scaling, image cropping, and image stitching to obtain a sample set.

[0045] It should be noted that by acquiring the original dataset, re-labeling it, and using the Mosaic algorithm for data augmentation, the diversity and quantity of the sample set were effectively expanded. The advantage of these operations is that they significantly improve the model's generalization ability, enabling it to better cope with various complex detection scenarios, reduce the risk of overfitting, and improve the model's accuracy and robustness in practical applications.

[0046] Refer to the instruction manual appendix Figure 2 The diagram shows a structural schematic of a barcode detection model provided in an embodiment of the present invention.

[0047] Refer to the instruction manual appendix Figure 3 The diagram shows a structural schematic of an EfficientViT unit provided in an embodiment of the present invention.

[0048] Refer to the instruction manual appendix Figure 4 The diagram shows a structural schematic of a C2f-Ghost unit provided in an embodiment of the present invention.

[0049] S2: Construct a barcode detection model.

[0050] The barcode detection model comprises a backbone network module, a neck network module, and a detection head module connected in sequence. The backbone network module includes EfficientViT units with multi-scale linear attention mechanism units and linear attention mechanism enhancement units that have non-linear functions. The linear attention mechanism enhancement units include interconnected FFN layers and deep convolutional units. The neck network module includes C2f-Ghost units for feature fusion. The detection head module includes detection units with multiple anchorless detection heads, where the C2f-Ghost unit is a C2f unit including Ghost subunits.

[0051] The backbone network module is the foundation of the model, responsible for extracting features from the input image. These features are further processed in subsequent network layers. The backbone network is typically a deep convolutional neural network (CNN) used to capture important information in the image, such as edges, textures, and shapes. The neck network module, located between the backbone network and the detection head, is responsible for further fusing and processing the features extracted by the backbone network, preparing them for input into the detection head module. This module is usually responsible for feature fusion, better combining features from different levels to enhance the model's detection capabilities. The detection head module is the final part of the model; it receives feature maps processed by the neck network and performs object detection and classification. In barcode detection, this module outputs the barcode's location and category. The multi-scale linear attention mechanism unit is an advanced attention mechanism used to process image features at different scales. Multi-scale means it can handle both large and small features in the image simultaneously, while the attention mechanism allows the model to focus on the most important parts of the image. Linear attention refers to reducing the computational complexity of traditional attention mechanisms through simpler computational methods. The EfficientViT unit is an efficient visual Transformer module that combines the advantages of convolutional neural networks and Transformers. ViT (VisionTransformer) is a Transformer architecture for image processing with powerful feature extraction capabilities. EfficientViT improves processing speed and efficiency by optimizing computation and attention mechanisms. The Linear Attention Enhancement Unit further strengthens the attention mechanism, enabling the model to focus more effectively on key regions of the image. This unit contains interconnected FFN layers and deep convolutional units to enhance feature extraction and processing. The C2f-Ghost unit is a feature fusion module that combines the features of C2f and Ghost units. C2f refers to a convolutional structure applied to feature maps, while the Ghost unit is a lightweight convolutional operation that reduces computational cost and improves efficiency by generating "virtual" feature maps. Ghost sub-units generate multiple "virtual" feature maps with less computation, helping to reduce actual computational overhead while preserving feature information. Anchor-free detection head: Traditional object detection models typically require predefined anchor boxes; the anchor-free detection head eliminates this step, making the model more flexible and efficient in object detection.

[0052] It's worth noting that the barcode detection model effectively improves the accuracy and efficiency of feature extraction by combining a multi-scale linear attention mechanism and the EfficientViT unit. Meanwhile, the C2f-Ghost unit in the neck network achieves efficient feature fusion through lightweight convolutional operations, further enhancing the model's computational efficiency. The anchor-free detection head makes the model more flexible and accurate in barcode detection, reducing the limitation of relying on predefined anchors. This design not only improves detection speed but also enhances the accuracy of barcode recognition in various scenarios.

[0053] In one possible implementation, a multi-scale linear attention mechanism unit is used to extract features, and the extraction process specifically involves:

[0054] in, These represent the query vector, key vector, and value vector, respectively. , Attention matrix representing features The OK, Represents a similarity matrix. Represents the similarity function Activation function Represents the input tensor set. Represents the set of real numbers. Indicates the dimension of the input tensor. Indicates the number of input tensors. Represents the first in the attention matrix The query vector of the row. Indicates the first A key vector, Indicates the first A vector of values.

[0055] It should be noted that by extracting features through a multi-scale linear attention mechanism, the model can effectively capture key information in images at different scales. The ReLU activation function is used to enhance the non-linearity of feature selection, reducing computational complexity while improving the accuracy and efficiency of feature extraction, making the model more suitable for handling complex and diverse visual tasks.

[0056] Refer to the instruction manual appendix Figure 5 The diagram illustrates a feature extraction process for a Ghost subunit provided in an embodiment of the present invention.

[0057] Figure 5 middle Indicates the first Convolutional layers.

[0058] In one possible implementation, the Ghost subunit is used to extract features, and the extraction process is as follows:

[0059] Receive the input feature map, where the number of channels in the feature map is... C Width is W The height is H ;

[0060] Divide the convolutional filters of the Ghost subunit into equal parts. S Take one group and convolve it on the feature map to generate intrinsic feature maps. The number of intrinsic feature maps is M, and their width and height are respectively... W 1 and H 1;

[0061] A linear transformation is performed on the Intrinsic feature map to obtain the Ghost feature map, where the number of Ghost feature maps is... ;

[0062] The obtained Intrinsic feature map and Ghost feature map are concatenated along the channel dimension to obtain the extracted feature map.

[0063] Intrinsic feature maps are basic feature maps extracted directly from the input feature map through convolution operations, representing the core information of the original feature map. They are the initial feature representations in the extraction process and are used to generate more feature maps. By first generating a smaller number of intrinsic feature maps and then generating Ghost feature maps through linear transformation, this method significantly reduces computation, improves the efficiency of feature extraction and the inference speed of the model, while retaining sufficient feature information to support high-precision detection tasks.

[0064] In one possible implementation, the EfficientViT unit includes an input unit, a multi-scale linear attention mechanism unit, an FFN-DWconv unit, and an output unit connected in sequence.

[0065] Among them, the input unit, the multi-scale linear attention mechanism unit, the FFN-DWconv unit, and the output unit correspond to respectively Figure 3 Input, Multi-Scale Linear Att / FFN+DWConv, and Output.

[0066] It should be noted that each FFN layer in the EfficientViT module uses depthwise convolution to enhance ReLU linear attention and improve the model's focus on spatial local information. Furthermore, the use of group convolution within the module reduces the total number of operations for information aggregation, further improving the model's efficiency in extracting barcode features.

[0067] The multi-scale linear attention mechanism unit includes a linear layer, a depthwise separable layer, a ReLU linear attention layer, and a splicing layer. The depthwise separable layer includes interconnected depthwise separable convolutions and 1x1 sets of convolutions. The linear layer is connected to the splicing layer through the ReLU linear attention layer. The linear layer is connected to the splicing layer through the depthwise separable layer and the ReLU linear attention layer in sequence.

[0068] exist Figure 3 In this model, the linear layer, depthwise separable layer, ReLU linear attention layer, and concatenation layer correspond to Linear, DWConv and 1x1GConv, ReLU Linear Attention and concat, respectively. The depthwise separable layer includes interconnected depthwise separable convolutions, namely DWConv and 1x1 group convolutions, namely 1x1GConv.

[0069] The C2f-Ghost unit comprises a Conv + BN + SiLU layer, a Split layer, multiple Bottleneck layers, a concat layer, a Ghost-Conv layer, a BatchNorm layer, and a SiLU layer connected in sequence. The Conv + BN + SiLU layer, the Split layer, and each Bottleneck layer are connected to the concat layer via skip connections.

[0070] In the Conv + BN + SiLU layer, Conv refers to the convolutional layer used to extract input features. BN (BatchNorm) is a batch normalization layer used to accelerate the training process and stabilize the network. SiLU (Sigmoid Linear Unit) is an activation function, also known as Swish, which enhances the model's non-linear expressive power. The Split layer divides the feature map after convolution and activation function processing, typically splitting the feature map into multiple parts for parallel processing or different path feature processing in subsequent layers. The Bottleneck layer is a common structure used to reduce computation and the number of parameters. Its purpose is to reduce the number of parameters and computational overhead while maintaining model capabilities. The diagram shows multiple Bottleneck layers, meaning that features are extracted and processed multiple times, with deeper feature extraction occurring through different paths. The Ghost-Conv layer, or Ghost convolution, is a lightweight convolutional operation that reduces computation by generating some "virtual" feature maps. Specifically, it computes some basic feature maps and then generates additional feature maps through simple linear transformations, thereby reducing the number of actual computational feature maps and improving model efficiency. The BatchNorm layer is used for further batch normalization to stabilize the feature maps and accelerate convergence. The SiLU layer gives the output features stronger non-linear expressive power. Skip connections mean that the feature maps after the initial convolutional operation are not discarded but retained and concatenated with the feature maps processed by multiple Bottleneck layers in subsequent operations. This skip connection is often used in deep neural networks to alleviate the vanishing gradient problem, ensuring that information can be passed more directly from earlier layers to later layers, thus helping to preserve the original feature information.

[0071] Refer to the instruction manual appendix Figure 6 The diagram shows a schematic representation of the characteristic structure of a detection head module provided in an embodiment of the present invention.

[0072] The detection unit includes a first branch and a second branch. The first branch includes a convolutional layer unit, a convolutional layer unit, a two-dimensional convolutional layer unit, and a DFL loss function connected in sequence. The second branch includes a convolutional layer unit, a convolutional layer unit, a two-dimensional convolutional layer unit, and a CIoU loss function connected in sequence.

[0073] It's worth noting that by employing multi-scale linear attention mechanisms, depthwise separable convolutions, and Ghost convolutions, the computational cost and number of parameters of the model are significantly reduced while maintaining efficient feature extraction capabilities. The introduction of skip connections and multi-path processing further enhances the transfer and fusion of feature information, reducing the gradient vanishing problem and thus improving the model's training speed and stability. Ultimately, this design achieves high-accuracy and high-efficiency object detection results under limited computational resources.

[0074] In one possible implementation, the backbone network module includes a first convolutional layer unit, a depth-separable convolutional layer unit, a first MBConv unit, a second MBConv unit, a third MBConv unit, a first EfficientViT unit, a fourth MBConv unit, a second EfficientViT unit, and a spatial pyramid pooling unit connected in sequence.

[0075] exist Figure 2 In this context, "Backbone" refers to the backbone network model. Figure 2 From bottom to top, conv, DSConv, MBConv, MBConv, MBConv, EfficientViT Module, MBConv, EfficientViT Module and SPPF correspond to the first convolutional layer unit, depthwise separable convolutional layer unit, first MBConv unit, second MBConv unit, third MBConv unit, first EfficientViT unit, fourth MBConv unit, second EfficientViT unit and spatial pyramid pooling unit of the backbone network module, respectively.

[0076] It should be noted that due to the complexity and diversity of real-world scanning environments, the input image may contain varying amounts of clutter, and the lighting and size of the barcode area can differ. Traditional single-scale windows cannot effectively handle multi-scale input data, potentially leading to data loss. To further improve the efficiency of the model in extracting barcode feature information in complex operating environments, we retained the SPPF module at the end of the backbone. Because SPPF contains multi-scale spatial containers, compared to single-scale sliding window pooling, the model can handle spatial feature information of different sizes, avoiding the imbalance of spatial feature information in the image caused by cropping and distortion, thus improving the quality of model training and the accuracy of package recognition.

[0077] The neck network module includes a first upper acquisition unit, a second upper acquisition unit, a first stitching unit, a second stitching unit, a third stitching unit, a fourth stitching unit, a first C2f-Ghost unit, a second C2f-Ghost unit, a third C2f-Ghost unit, a fourth C2f-Ghost unit, a first convolution unit, and a second convolution unit. The first upper acquisition unit is sequentially connected to the first stitching unit, the first C2f-Ghost unit, the second upper acquisition unit, the second stitching unit, and the fourth C2f-Ghost unit to form a first line. The output of the first line is the input of the second convolution unit. The second convolution unit is sequentially connected to the third stitching unit and the third C2f-Ghost unit. The third C2f-Ghost unit is sequentially connected to the second C2f-Ghost unit through the first convolution unit and the fourth stitching unit. The fourth stitching unit is connected to the second C2f-Ghost unit. The first C2f-Ghost unit is connected to the third stitching unit.

[0078] Figure 2 In this context, "Neck" represents the neck network module. Figure 2 The neck network module is divided into three columns from left to right: the first column, the second column, and the third column. In the first column, from top to bottom, Upsample, Concat, Csf-Ghost, Upsample, and Concat correspond to the first upper acquisition unit, the first stitching unit, the first C2f-Ghost unit, the second upper acquisition unit, and the second stitching unit, respectively. In the second column, from top to bottom, Concat, Conv, Concat, and Conv correspond to the fourth stitching unit, the first convolutional unit, the third stitching unit, and the second convolutional unit, respectively. In the third column, from top to bottom, the three C2f-Ghosts correspond to the second, third, and fourth C2f-Ghost units, respectively. The Head corresponds to the detection head module, with each Detect-Head corresponding to one detection unit. X*Y*Z in the diagram represents the size.

[0079] The spatial pyramid pooling unit is connected to the first upper acquisition unit and the fourth stitching unit respectively. The first EfficientViT unit is connected to the first stitching unit. The second MBConv unit is connected to the second stitching unit. The second C2f-Ghost unit, the third C2f-Ghost unit and the fourth C2f-Ghost unit are all connected to the detection unit in the detection head module.

[0080] It should be noted that by combining multi-layered convolutional units and EfficientViT units, efficient feature extraction and processing are achieved. Depthwise separable convolutions and MBConv units reduce computational cost while maintaining feature expressiveness. Spatial pyramid pooling units (SPP) enhance the model's ability to capture multi-scale information, particularly improving robustness in complex scenes. The multiple concatenation and upsampling operations in the neck network ensure that features from different levels are fully fused, contributing to more accurate object detection. Through these designs, the entire model achieves significant improvements in computational efficiency, detection accuracy, and scene adaptability. An EfficientViT module based on a linear self-attention mechanism is introduced into the backbone network of the original model to enhance the model's attention to barcode features. Linear mapping and grouped convolutions are used to improve the efficiency of feature fusion in the C2f module. Experimental results show that the improved model improves recall by 1.5 percentage points, mAP50:95 by 0.4 percentage points, and FPS by 40 frames per second in barcode localization and classification. The number of model parameters is reduced by 53.2 percentage points, and FLOPs are reduced by 52.1 percentage points.

[0081] S3: Construct a joint loss function that includes the DFL loss function and the CIoU loss function.

[0082] Among them, the Distribution Focal Loss (DFL) loss function is a loss function used for regression tasks, especially suitable for bounding box prediction in object detection. DFL uses a distributed modeling approach, enabling the model to more accurately predict the location of the target bounding box, focusing on errors in key parts of the regression task, thereby improving localization accuracy. The Complete Intersection over Union (CIoU) loss function measures the difference between the predicted and ground truth bounding boxes. CIoU considers not only the IoU (Intersection over Union) but also factors such as the distance to the bounding box center point and aspect ratio, providing more comprehensive geometric constraints and enhancing the accuracy of bounding box prediction. Combining DFL and CIoU loss functions can simultaneously optimize bounding box location regression and shape matching. The DFL loss function improves the model's accuracy in bounding box location prediction, while the CIoU loss function ensures geometric matching of the bounding boxes and maximizes the overlapping area. This joint optimization enables the model to more accurately predict the boundaries and categories of targets in barcode detection, thereby improving overall detection performance.

[0083] In one possible implementation, the joint loss function is specifically:

[0084] in, Represents the CIoU loss function, IoU, α , v Both represent intermediate variables. Represents Euclidean distance. b Indicates the coordinates of the center point of the prediction box. This represents the coordinates of the center point of the true bounding box. c This represents the diagonal distance of the smallest bounding rectangle. A This indicates the area occupied by the prediction box. B This represents the area occupied by the actual bounding box. w Indicates the width of the prediction box. Indicates the actual frame width. h Indicates the height of the predicted bounding box. Indicates the actual bounding box height. y Indicates the true label, These represent the labels closest to the actual values. y First and second tags, This indicates the probability that the predicted result is the first label. This indicates the probability that the predicted result is the second label. DEL Let represent the DFL loss function, and log represent the logarithmic function, where .

[0085] It's worth noting that the joint loss function combines the CIoU and DFL loss functions. This not only optimizes the overlap and geometric matching between the predicted and ground truth boxes, reducing box offset errors through CIoU, but also precisely adjusts the distribution of classification probabilities through DFL. This enhances the model's performance in both bounding box localization and classification accuracy. This design makes the model more robust and accurate when handling complex object detection tasks, improving overall detection performance.

[0086] S4: Input the expanded dataset into the barcode detection model to train the barcode detection model until the joint loss function value is less than the preset joint loss function value.

[0087] It should be noted that by inputting the expanded dataset into the barcode detection model for training until the joint loss function value reaches a preset standard, it can be ensured that the model fully learns the features and variability of various barcode samples. The advantage of this approach is that the model can exhibit higher accuracy and robustness in complex and diverse real-world scenarios, effectively reducing false positives and false negatives, while improving the model's adaptability and generalization ability in different application environments.

[0088] It should be noted that those skilled in the art can set the value of the preset joint loss function according to actual needs, and this invention does not limit this.

[0089] In one possible implementation, S4 specifically includes:

[0090] S401: Through the backbone network module, features are extracted from the sample set, and first feature maps at multiple scales are output. These first feature maps include barcode image edge features, barcode image texture features, and barcode image shape features.

[0091] S402: Input each first feature map into the neck network module, and fuse the first feature maps to obtain a fused feature map.

[0092] S403: Input the fused feature map into the detection head module to obtain barcode information, which includes barcode position and barcode category.

[0093] S404: Calculate the joint loss function value of barcode information.

[0094] S405: Adjust the hyperparameters of the barcode detection model, increment the iteration count by 1, and return to step S401 until the joint loss function value is less than the preset joint loss function value.

[0095] It should be noted that by progressively extracting and fusing multi-scale feature maps, the model can fully capture the detailed features of the barcode, such as edges, textures, and shapes. Finally, the detection head module accurately predicts the position and category of the barcode. By calculating the joint loss function value and adjusting the hyperparameters, the model can be continuously optimized, gradually improving the detection accuracy and stability. This iterative optimization method ensures the high performance of the model in complex scenarios, effectively reducing errors and improving the overall detection effect.

[0096] S5: Obtain the image of the barcode to be detected.

[0097] S6: Input the image of the barcode to be detected into the trained barcode detection model, and output the predicted barcode position and predicted barcode category.

[0098] Specifically, after acquiring the image of the barcode to be detected, it is input into a pre-trained barcode detection model. The model automatically outputs the precise location and category of the barcode. The advantage of this process is that by utilizing the features and patterns learned during training, the model can quickly and accurately identify and locate barcodes. It is suitable for scenarios such as automated scanning and inventory management, significantly improving work efficiency and accuracy while reducing human intervention and errors.

[0099] In practical applications, during the initial training phase, the YOLOv8 model uses the Mosaic algorithm to scale, crop, and stitch images, augmenting the dataset. During training, the backbone network extracts features from the input image, including low-level features such as edges, texture, and shape. The neck network filters features from the backbone network by fusing feature maps at different levels and scales. The detection head, as the end of the network structure, integrates feature maps from both the backbone and neck networks, performs non-maximum suppression on the target prediction results, and is responsible for specific visual tasks such as classification, detection, and segmentation. This barcode detection process, from data preparation, model building, and training to practical application, forms a closed-loop system. Through precise annotation and data augmentation, the model learns diverse barcode features. Combined with multi-scale attention mechanisms and efficient feature fusion techniques, the model achieves higher detection accuracy and efficiency during training. Ultimately, the optimized model can quickly and accurately identify and locate barcodes in practical applications, significantly improving the automation and reliability of barcode detection, making it suitable for various complex scenarios.

[0100] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:

[0101] In this invention, the traditional YOLOv8 backbone network module, neck network module, and detection head module are improved. Specifically, the backbone network module introduces a multi-scale linear attention mechanism unit with a nonlinear function and an EfficientViT unit that enhances the linear attention mechanism. The enhanced linear attention mechanism unit includes interconnected FFN layers and deep convolutional units. By introducing an attention mechanism, higher accuracy in barcode detection is achieved with fewer parameters and less computation. Convolutional enhancement of linear attention improves the model's attention to spatial local information, and group convolution is used within the module to reduce the total number of operations for information aggregation, further improving the model's efficiency in barcode feature extraction. The neck network module introduces a C2f-Ghost unit for feature fusion, and the C2f module is improved at the convolutional level by introducing a Ghost module, thus enhancing the efficiency of the C2f module. The efficiency of convolution operations in the C2f module is improved, thereby increasing the detection speed of the barcode detection model. A detection unit with multiple anchor-free detection heads is introduced into the detection head module. This multi-head design allows the target's position and category information to be learned and fused through different branches. This method effectively reduces the number of parameters, accelerates model training, reduces the risk of overfitting, and enhances the model's generalization ability and robustness. It comprehensively improves efficiency in feature extraction, feature fusion, and target recognition, enhancing the accuracy of feature capture and thus increasing the accuracy and efficiency of barcode target detection. Furthermore, considering that the actual distribution of target barcodes is usually not too far from their labeled positions, the model should focus on values ​​near the labeled positions during training. Therefore, the DFL loss function is combined with the CIoU loss function to improve the model's training effect and further enhance the accuracy of target detection.

[0102] Reference manual attached Figure 7 The diagram shows a schematic of the structure of a barcode detection system based on an improved YOLOv8 provided by the present invention.

[0103] The present invention also provides a barcode detection system 20 based on an improved YOLOv8, applied to the above-mentioned barcode detection method based on an improved YOLOv8, comprising:

[0104] Processor 201.

[0105] The memory 202 stores computer-readable instructions, which, when executed by the processor 201, implement the barcode detection method based on the improved YOLOv8 as described in the method embodiment.

[0106] The barcode detection system 20 based on improved YOLOv8 provided by this invention can perform the above-mentioned barcode detection method based on improved YOLOv8 and achieve the same or similar technical effects. To avoid duplication, this invention will not elaborate further.

[0107] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:

[0108] In this invention, the traditional YOLOv8 backbone network module, neck network module, and detection head module are improved. Specifically, the backbone network module introduces a multi-scale linear attention mechanism unit with a nonlinear function and an EfficientViT unit that enhances the linear attention mechanism. The enhanced linear attention mechanism unit includes interconnected FFN layers and deep convolutional units. By introducing an attention mechanism, higher accuracy in barcode detection is achieved with fewer parameters and less computation. Convolutional enhancement of linear attention improves the model's attention to spatial local information, and group convolution is used within the module to reduce the total number of operations for information aggregation, further improving the model's efficiency in barcode feature extraction. The neck network module introduces a C2f-Ghost unit for feature fusion, and the C2f module is improved at the convolutional level by introducing a Ghost module, thus enhancing the efficiency of the C2f module. The efficiency of convolution operations in the C2f module is improved, thereby increasing the detection speed of the barcode detection model. A detection unit with multiple anchor-free detection heads is introduced into the detection head module. This multi-head design allows the target's position and category information to be learned and fused through different branches. This method effectively reduces the number of parameters, accelerates model training, reduces the risk of overfitting, and enhances the model's generalization ability and robustness. It comprehensively improves efficiency in feature extraction, feature fusion, and target recognition, enhancing the accuracy of feature capture and thus increasing the accuracy and efficiency of barcode target detection. Furthermore, considering that the actual distribution of target barcodes is usually not too far from their labeled positions, the model should focus on values ​​near the labeled positions during training. Therefore, the DFL loss function is combined with the CIoU loss function to improve the model's training effect and further enhance the accuracy of target detection.

[0109] It should be understood that the processor in the embodiments of the present invention can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0110] It should also be understood that the memory in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0111] The above embodiments can be implemented, in whole or in part, by software, hardware (such as circuits), firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.

[0112] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. A and B can be singular or plural. Additionally, the character " / " in this article generally indicates an "or" relationship between the preceding and following related objects, but it can also represent an "and / or" relationship. Please refer to the context for a more accurate understanding.

[0113] In this invention, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be a single item or multiple items.

[0114] It should be understood that, in various embodiments of the present invention, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0115] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0116] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0117] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0118] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0119] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0120] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0121] This invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the barcode detection method based on the improved YOLOv8 as described in the method embodiment.

[0122] The present invention provides a computer-readable storage medium that can implement the steps and effects of the barcode detection method based on the improved YOLOv8 in the above-described method embodiments. To avoid repetition, the present invention will not repeat the details.

[0123] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:

[0124] In this invention, the traditional YOLOv8 backbone network module, neck network module, and detection head module are improved. Specifically, the backbone network module introduces a multi-scale linear attention mechanism unit with a nonlinear function and an EfficientViT unit that enhances the linear attention mechanism. The enhanced linear attention mechanism unit includes interconnected FFN layers and deep convolutional units. By introducing an attention mechanism, higher accuracy in barcode detection is achieved with fewer parameters and less computation. Convolutional enhancement of linear attention improves the model's attention to spatial local information, and group convolution is used within the module to reduce the total number of operations for information aggregation, further improving the model's efficiency in barcode feature extraction. The neck network module introduces a C2f-Ghost unit for feature fusion, and the C2f module is improved at the convolutional level by introducing a Ghost module. To improve the efficiency of convolutional operations in the C2f module and thus increase the detection speed of the barcode detection model, a detection unit with multiple anchor-free detection heads is introduced into the detection head module. This multi-head design allows the target's position and category information to be learned and fused through different branches. This method effectively reduces the number of parameters, accelerates model training, reduces the risk of overfitting, and enhances the model's generalization ability and robustness. It comprehensively improves efficiency in feature extraction, feature fusion, and target recognition, enhancing the accuracy of feature capture and thus increasing the accuracy and efficiency of barcode target detection. Furthermore, considering that the actual distribution of target barcodes is usually not too far from their labeled positions, the model should focus on values ​​near the labeled positions during training. Therefore, the DFL loss function is combined with the CIoU loss function to improve the model's training effect and further enhance the accuracy of target detection.

[0125] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

[0126] The following points need to be explained:

[0127] (1) The accompanying drawings of the embodiments of the present invention only involve the structures involved in the embodiments of the present invention. Other structures can refer to the general design.

[0128] (2) For clarity, the thickness of layers or regions is enlarged or reduced in the drawings used to describe embodiments of the invention, i.e., these drawings are not drawn to scale. It is understood that when an element such as a layer, film, region or substrate is referred to as being “above” or “below” another element, the element may be “directly” located “above” or “below” the other element or there may be intermediate elements.

[0129] (3) Where there is no conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other to obtain new embodiments.

[0130] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. The scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A barcode detection method based on an improved YOLOv8, characterized in that, include: S1: Establish a sample set with multiple barcode images, where each barcode image has a barcode location label and a barcode category label; S2: Construct a barcode detection model, wherein the barcode detection model includes a backbone network module, a neck network module, and a detection head module connected in sequence. The backbone network module includes an EfficientViT unit with a multi-scale linear attention mechanism unit and a linear attention mechanism enhancement unit having a nonlinear function. The linear attention mechanism enhancement unit includes interconnected FFN layers and deep convolutional units. The neck network module includes a C2f-Ghost unit for feature fusion. The detection head module includes a detection unit with multiple anchorless detection heads. The C2f-Ghost unit is a C2f unit including Ghost subunits. S3: Establish a joint loss function that includes the DFL loss function and the CIoU loss function; S4: Input the expanded dataset into the barcode detection model to train the barcode detection model until the joint loss function value is less than the preset joint loss function value; S5: Obtain the image of the barcode to be detected; S6: Input the barcode image to be detected into the trained barcode detection model, and output the predicted barcode position and predicted barcode category; The backbone network module includes a first convolutional layer unit, a depth-separable convolutional layer unit, a first MBConv unit, a second MBConv unit, a third MBConv unit, a first EfficientViT unit, a fourth MBConv unit, a second EfficientViT unit, and a spatial pyramid pooling unit connected in sequence. The neck network module includes a first upper acquisition unit, a second upper acquisition unit, a first stitching unit, a second stitching unit, a third stitching unit, a fourth stitching unit, a first C2f-Ghost unit, a second C2f-Ghost unit, a third C2f-Ghost unit, a fourth C2f-Ghost unit, a first convolutional unit, and a second convolutional unit. The first upper acquisition unit is sequentially connected to the fourth C2f-Ghost unit via the first stitching unit, the first C2f-Ghost unit, the second upper acquisition unit, and the second stitching unit to form a first line. The output of the first line is the input of the second convolutional unit. The second convolutional unit is sequentially connected to the third stitching unit and the third C2f-Ghost unit. The third C2f-Ghost unit is sequentially connected to the second C2f-Ghost unit via the first convolutional unit and the fourth stitching unit. The fourth stitching unit is connected to the second C2f-Ghost unit. The first C2f-Ghost unit is connected to the third stitching unit. The spatial pyramid pooling unit is connected to the first upper acquisition unit and the fourth stitching unit respectively; the first EfficientViT unit is connected to the first stitching unit; the second MBConv unit is connected to the second stitching unit; and the second C2f-Ghost unit, the third C2f-Ghost unit, and the fourth C2f-Ghost unit are all connected to the detection unit in the detection head module. Specifically, S1 includes: S101: Obtain the original dataset containing multiple barcode images; S102: Re-label the original dataset to obtain a labeled dataset; S103: Perform data augmentation operations on the labeled dataset using the Mosaic algorithm to obtain the expanded dataset, wherein the data augmentation operations include image scaling, image cropping, and image stitching to obtain the sample set.

2. The barcode detection method based on improved YOLOv8 according to claim 1, characterized in that, The multi-scale linear attention mechanism unit is used to extract features, and the extraction process is as follows: in, These represent the query vector, key vector, and value vector, respectively. , Attention matrix representing features The OK, Represents a similarity matrix. Represents the similarity function Activation function Represents the input tensor set. Represents the set of real numbers. Indicates the dimension of the input tensor. Indicates the number of input tensors. Represents the first in the attention matrix The query vector of the row. Indicates the first A key vector, Indicates the first A vector of values.

3. The barcode detection method based on improved YOLOv8 according to claim 1, characterized in that, The Ghost subunit is used to extract features, and the extraction process is as follows: Receive an input feature map, wherein the number of channels of the feature map is . C Width is W The height is H ; The convolutional filters of the Ghost subunit are divided into equal parts. S A group is selected, and a convolution is performed on the feature map to generate an intrinsic feature map, wherein the number of intrinsic feature maps is M, and the width and height are respectively... W 1 and H 1; A linear transformation is performed on the intrinsic feature map to obtain the Ghost feature map, wherein the number of Ghost feature maps is . ; The obtained Intrinsic feature map and Ghost feature map are concatenated along the channel dimension to obtain the extracted feature map.

4. The barcode detection method based on improved YOLOv8 according to claim 1, characterized in that, The EfficientViT unit includes an input unit, a multi-scale linear attention mechanism unit, an FFN-DWconv unit, and an output unit connected in sequence. The multi-scale linear attention mechanism unit includes a linear layer, a depthwise separable layer, a ReLU linear attention layer, and a splicing layer. The depthwise separable layer includes interconnected depthwise separable convolutions and 1x1 sets of convolutions. The linear layer is connected to the splicing layer through the ReLU linear attention layer. The linear layer is connected to the splicing layer in sequence through the depthwise separable layer and the ReLU linear attention layer. The C2f-Ghost unit includes a Conv + BN + SiLU layer, a Split layer, multiple Bottleneck layers, a concat layer, a Ghost-Conv layer, a BatchNorm layer, and a SiLU layer connected in sequence. The Conv + BN + SiLU layer, the Split layer, and each Bottleneck layer are connected to the concat layer via skip connections. The detection unit includes a first branch and a second branch. The first branch includes a convolutional layer unit, a convolutional layer unit, a two-dimensional convolutional layer unit, and a DFL loss function connected in sequence. The second branch includes a convolutional layer unit, a convolutional layer unit, a two-dimensional convolutional layer unit, and a CIoU loss function connected in sequence.

5. The barcode detection method based on improved YOLOv8 according to claim 1, characterized in that, The joint loss function is specifically as follows: in, Represents the CIoU loss function, IoU, α , v Both represent intermediate variables. Represents Euclidean distance. b Indicates the coordinates of the center point of the prediction box. This represents the coordinates of the center point of the true bounding box. c This represents the diagonal distance of the smallest bounding rectangle. A This indicates the area occupied by the prediction box. B This represents the area occupied by the actual bounding box. w Indicates the width of the prediction box. Indicates the actual frame width. h Indicates the height of the predicted bounding box. Indicates the actual bounding box height. y Indicates the true label, and These represent the closest to the actual label. y The first tag Second label, This indicates the probability that the predicted result is the first label. This indicates the probability that the predicted result is the second label. DEL Let represent the DFL loss function, and log represent the logarithmic function, where .

6. The barcode detection method based on improved YOLOv8 according to claim 1, characterized in that, S4 specifically includes: S401: The backbone network module extracts features from the sample set and outputs a first feature map at multiple scales, wherein the first feature map includes barcode image edge features, barcode image texture features, and barcode image shape features; S402: Input each first feature map into the neck network module, and fuse the first feature maps to obtain a fused feature map; S403: Input the fused feature map into the detection head module to obtain barcode information, wherein the barcode information includes barcode position and barcode category; S404: Calculate the joint loss function value of the barcode information; S405: Adjust the hyperparameters of the barcode detection model, increment the iteration count by 1, and return to step S401 until the joint loss function value is less than the preset joint loss function value.

7. A barcode detection system based on an improved YOLOv8, characterized in that, include: processor; A memory storing computer-readable instructions, which, when executed by the processor, implement the barcode detection method based on the improved YOLOv8 as described in any one of claims 1 to 6.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the barcode detection method based on the improved YOLOv8 as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Parcel three-dimensional size identification method and system based on deep learning

    CN118608856A