Cigarette brand identification method and device, storage medium and equipment

By improving the YOLOv8 model, the problem of low recognition accuracy in cigarette brand recognition is solved, the recognition accuracy and robustness are improved, the information processing efficiency needs of the tobacco industry are met, and labor costs are reduced.

CN119131340APending Publication Date: 2024-12-13CHINA TOBACCO ZHEJIANG IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411106748.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing technology has low recognition accuracy in cigarette brand identification, especially in complex scenarios. Due to factors such as small targets, light changes, occlusion and background interference, the identification accuracy and robustness are insufficient, which affects the operation efficiency of the tobacco industry. and cost.

Method used

Improve the YOLOv8 model, improve the C2f module and Bottleneck module by adding a small object detection layer in the detection head, add the DWR module, SIR module and DWRSeg network in the Backbone network, add the CBAM module, channel attention module and space in the Neck module Attention module, and MPDIoU loss function and data augmentation preprocessing technology are used to improve the feature extraction and fusion capabilities of the model.

Benefits of technology

It improves the accuracy and robustness of cigarette brand identification, enhances the ability to detect small targets and handle targets at different scales, reduces labor costs, meets the information processing efficiency needs of the tobacco industry, and improves operation and production efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119131340A_ABST
    Figure CN119131340A_ABST
Patent Text Reader

Abstract

The invention discloses a cigarette brand identification method and device, a storage medium and equipment, and belongs to the technical field of target detection. Inputting the cigarette image into the trained improved YOLOv8 model to obtain a cigarette brand identification result; wherein the improved YOLOv8 model is obtained by improving on the basis of a YOLOv8 model, and the improvement comprises the following steps: adding a small target detection layer in a detection head, improving a C2f module and a Bottleneck module, adding a DWR module, an SIR module and a DWRSEg network in a Backbone network, and adding a CBAM module, a channel attention module and a space attention module in a Neck module; by improving the model, the accuracy of cigarette brand identification is comprehensively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a cigarette brand recognition method, device, storage medium and equipment, belonging to the technical field of target detection. Background Art

[0002] Among many tasks in the tobacco industry, it is necessary to identify and analyze cigarette brands. The traditional method of identifying cigarette brands in the tobacco industry is manual identification. However, there are large differences in the shell patterns and text logos of various cigarette brands, as well as various complex environmental scenarios, which pose a series of challenges to cigarette brand work and lead to a series of problems, including recognition accuracy, recognition efficiency, and labor costs. These factors reduce the efficiency of tobacco information processing and affect the operating efficiency and cost of the tobacco industry. Therefore, it is necessary to study and design an efficient cigarette brand recognition model to optimize the accuracy and efficiency of information processing in the tobacco industry and provide convenience for various tasks in the tobacco industry.

[0003] Object detection is an important technology in the field of computer vision, which aims to identify specific objects in images or videos and determine their locations. Although existing technologies such as YOLOv8 have made significant progress in object detection performance, they still have certain limitations in some specific application scenarios. For example, in the complex scenario of cigarette brand recognition, due to factors such as small targets, lighting changes, occlusion and background interference, the recognition accuracy and robustness of existing models are still insufficient, resulting in low accuracy in cigarette brand recognition. Summary of the invention

[0004] The object of the present invention is to provide a cigarette brand recognition method, device, storage medium and equipment to solve the problem of low cigarette brand recognition accuracy in the prior art.

[0005] To achieve the above objectives, the present invention is implemented by adopting the following technical solutions: In a first aspect, the present invention provides a cigarette brand identification method, comprising: Acquire a cigarette image; Inputting the cigarette image into the trained improved YOLOv8 model to obtain a cigarette brand recognition result; Among them, the improved YOLOv8 model is improved on the basis of the YOLOv8 model, and the improvements include: adding a small target detection layer in the detection head, improving the C2f module and the Bottleneck module, adding the DWR module, the SIR module and the DWRSeg network in the Backbone network, and adding the CBAM module, the channel attention module and the spatial attention module in the Neck module.

[0006] Furthermore, adding a small target detection layer in the detection head includes: adding the small target detection layer between an output layer and a detection layer of a feature pyramid in the detection head.

[0007] Furthermore, the improved C2f module and Bottleneck module include: Increase the size and number of convolution kernels in the C2f module; Increase the number of skip connection layers and depthwise convolutional layers in the Bottleneck module.

[0008] Furthermore, the adding of the DWR module, the SIR module and the DWRSeg network in the Backbone network includes: The DWR module is added to the middle layer of the Backbone network and is set between two standard convolutional layers in the middle layer of the Bottleneck module; Add the SIR module between the last layer of the Backbone network and the first layer of the Neck module; The DWRSeg network is added between the output layer of the Backbone network and the input layer of the Neck module.

[0009] Furthermore, the adding of the CBAM module, the channel attention module and the spatial attention module in the Neck module includes: Adding the CBAM module to the Neck module so that the CBAM module and the Neck module work in series; Add the channel attention module between the CBAM module and the spatial attention module; The spatial attention module is added between the channel attention module and the output layer of the Neck module.

[0010] Furthermore, the loss function used in the training process of the improved YOLOv8 model is MPDIoU.

[0011] Furthermore, the training data used in the training process of the improved YOLOv8 model are cigarette images that have undergone data enhancement and preprocessing; The data enhancement includes: flipping, rotating, cropping and scaling the cigarette image; The preprocessing includes: normalizing the pixel values ​​of the cigarette image.

[0012] In a second aspect, the present invention provides a cigarette brand identification device, comprising: The cigarette image acquisition module is configured to: acquire a cigarette image; The cigarette brand recognition module is configured to: input the cigarette image into the trained improved YOLOv8 model to obtain a cigarette brand recognition result; Among them, the improved YOLOv8 model is improved on the basis of the YOLOv8 model, and the improvements include: adding a small target detection layer in the detection head, improving the C2f module and the Bottleneck module, adding the DWR module, the SIR module and the DWRSeg network in the Backbone network, and adding the CBAM module, the channel attention module and the spatial attention module in the Neck module.

[0013] In a third aspect, the present invention provides a computer-readable storage medium having a computer program / instruction stored thereon, which, when executed by a processor, implements the steps of the cigarette brand identification method described in any one of the first aspects.

[0014] In a fourth aspect, the present invention provides a computer device, comprising: Memory, for storing computer programs / instructions; A processor is used to execute the computer program / instructions to implement the steps of the cigarette brand identification method described in any one of the first aspects.

[0015] Compared with the prior art, the beneficial effects achieved by the present invention are: The present invention provides a cigarette brand recognition method, device, storage medium and equipment, which improve the accuracy of cigarette brand recognition by improving the YOLOv8 model, that is, by adding a small target detection layer to better detect small targets such as cigarettes, by improving the C2f module and the Bottleneck module, respectively improving the feature extraction capability and the feature fusion effect, by introducing a DWR module for more flexibly processing deformed targets, by introducing a SIR module for processing targets of different scales, by introducing a DWRSeg network for more finely segmenting feature maps, by introducing a CBAM module to enhance the expression capability of feature maps and improve the weight distribution accuracy of feature maps, by introducing a channel attention module to enhance the feature expression of each channel, by introducing a spatial attention module for extracting key information from a spatial perspective, through the above improvements to the model, the accuracy of cigarette brand recognition is comprehensively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a flow chart of a cigarette brand identification method corresponding to Embodiment 1 of the present invention; Figure 2 is a flow chart of a cigarette brand identification method corresponding to Embodiment 2 of the present invention; Figure 3 is a structural schematic diagram of a DWR module provided by an embodiment of the present invention; Figure 4 is a schematic diagram of the structure of a SIR module provided in an embodiment of the present invention; Figure 5 It is a schematic diagram of the structure of the DWRSeg network provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0017] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the protection scope of the present invention.

[0018] Example 1.

[0019] like Figure 1 As shown, the present invention provides a cigarette brand identification method, comprising: Acquire a cigarette image; The cigarette image is input into the trained improved YOLOv8 model to obtain a cigarette brand recognition image, which includes the cigarette brand name existing in the cigarette image (i.e., the cigarette brand recognition result), and the position of each cigarette in the cigarette brand recognition image is marked.

[0020] Among them, the improved YOLOv8 model is improved on the basis of the YOLOv8 model. The improvements include: adding a small target detection layer in the detection head, improving the C2f module and the Bottleneck module, adding the DWR module, the SIR module and the DWRSeg network in the Backbone network, and adding the CBAM module, the channel attention module and the spatial attention module in the Neck module.

[0021] The present invention improves the accuracy of cigarette brand recognition by improving the YOLOv8 model, that is, by adding a small target detection layer to better detect small targets such as cigarettes, by improving the C2f module and the Bottleneck module, respectively improving the feature extraction capability and the feature fusion effect, by introducing the DWR module for more flexibly processing deformed targets, by introducing the SIR module for processing targets of different scales, by introducing the DWRSeg network for more finely segmenting feature maps, by introducing the CBAM module to enhance the expression capability of feature maps, and improve the weight distribution accuracy of feature maps, by introducing the channel attention module to enhance the feature expression of each channel, by introducing the spatial attention module for extracting key information from a spatial perspective, through the above improvements to the model, the accuracy of cigarette brand recognition is comprehensively improved.

[0022] Moreover, by implementing the invention of the cigarette brand recognition method based on the improved YOLOv8 model, the labor costs of tobacco companies can be effectively reduced, while also meeting the information processing efficiency requirements of tobacco companies on time, thereby improving the operation and production efficiency of the tobacco industry.

[0023] Example 2.

[0024] like Figure 2 As shown, the present invention provides a cigarette brand identification method, comprising: S1. Obtain cigarette images and annotate them with data. The annotated content is the specific brand of cigarettes. Data enhancement is performed on the annotated cigarette images.

[0025] Step S1 specifically includes: firstly, obtaining cigarette images obtained by photographing cigarettes of different brands at different angles such as the front, back, and side, and annotating the obtained cigarette images with data, and the annotated content is the cigarette brand. After the annotating is completed, data enhancement is performed on the annotated cigarette images, specifically, flipping, rotating, cropping, and scaling the image data in the data set.

[0026] Flipping can increase the diversity of images and simulate different perspectives; rotation can help the model cope with image recognition at different angles; cropping helps the model focus on the target area and reduce background interference; scaling can enhance the model's robustness to targets of different sizes.

[0027] S2. Preprocessing a cigarette image dataset composed of cigarette images obtained by data enhancement to obtain a preprocessed cigarette image dataset.

[0028] Preprocessing specifically refers to normalizing the pixel values ​​of the image data in the data set, and dividing the obtained cigarette image data set into a training set, a validation set, and a test set in a ratio of 6:2:2.

[0029] S3. Improve the YOLOv8 model to obtain an improved YOLOv8 model, load the improved YOLOv8 model, input the data set for model training, and thereby obtain the required detection model (i.e., the trained improved YOLOv8 model).

[0030] The improvements to the YOLOv8 model include the following aspects: Add a small target detection layer: Add a small target detection layer to the detection head of the original YOLOv8 model. This layer is connected between the output layer and the detection layer of the original feature pyramid to better detect small targets such as cigarettes.

[0031] Improve the C2f and Bottleneck modules in YOLOv8: The C2f module improves the feature extraction capability by increasing the size and number of convolution kernels; the Bottleneck module enhances the feature fusion effect by introducing more skip connection layers and deeper convolution layers.

[0032] Introducing DWR module, SIR module and DWRSeg network: DWR module is added to the middle layer of Backbone network to handle deformed targets more flexibly. Standard convolutional layers are connected before and after. The structure of DWR module is as follows: Figure 3 As shown in Figure 2, the SIR module is added between the last layer of the Backbone network and the first layer of the Neck module to process targets of different scales. The structure of the SIR module is as follows: Figure 4 As shown in the figure, the DWRSeg network is added between the output layer of the Backbone network and the input layer of the Neck module to segment the feature map more finely. The output layer of the Backbone network and the input layer of the Neck module are connected in front and back. The structure of the DWRSeg network is as follows: Figure 5 As shown, it is an encoder-decoder structure, the backbone block is used for initial processing, the SIR module is used to extract features from the low-level stage, and the DWR module is used to extract features from the high-level stage.

[0033] Introducing the attention mechanism CBAM module in the Neck module: The CBAM module is embedded in the Neck to enhance the expressiveness of the feature map, especially focusing on important feature areas. The CBAM module works in series with the original Neck module to improve the weight distribution accuracy of the feature map.

[0034] Add channel attention module: The channel attention module is added before the feature fusion layer of the Neck module, and is connected to the CBAM module and the spatial attention module before and after, respectively, to enhance the feature expression of each channel.

[0035] Adding a spatial attention module: The spatial attention module is added after the feature fusion layer of the Neck module, and is connected to the channel attention module and the output layer before and after, respectively, to extract key information from a spatial perspective.

[0036] The loss function of the YOLOv8 model is improved, and MPDIoU is used to solve the problem that the existing loss function cannot be effectively optimized when the predicted bounding box and the true bounding box have the same aspect ratio but completely different width and height values.

[0037] Finally, the improved YOLOv8 model is trained by inputting the training set obtained in step S2 into the improved YOLOv8 model for training to obtain a trained weight file, thereby obtaining a trained improved YOLOv8 model.

[0038] After the training is completed, the validation set obtained in step S2 is used to verify the effect of the model. It can be put into use only when the effect meets the preset requirements.

[0039] S4. Input the cigarette image into the trained improved YOLOv8 model to complete cigarette brand recognition and obtain the final target detection result.

[0040] The output of the improved YOLOv8 model is a cigarette brand recognition image, which includes the cigarette brand name existing in the cigarette image (i.e., the cigarette brand recognition result), and the position of each cigarette in the cigarette brand recognition image is marked.

[0041] Example 3.

[0042] The present invention provides a cigarette brand identification device, comprising: The cigarette image acquisition module is configured to: acquire a cigarette image; The cigarette brand recognition module is configured to: input the cigarette image into the trained improved YOLOv8 model to obtain a cigarette brand recognition result; Among them, the improved YOLOv8 model is improved on the basis of the YOLOv8 model, and the improvements include: adding a small target detection layer in the detection head, improving the C2f module and the Bottleneck module, adding the DWR module, the SIR module and the DWRSeg network in the Backbone network, and adding the CBAM module, the channel attention module and the spatial attention module in the Neck module.

[0043] Example 4.

[0044] The present invention provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the cigarette brand identification method provided in Example 1 are implemented: Acquire a cigarette image; Inputting the cigarette image into the trained improved YOLOv8 model to obtain a cigarette brand recognition result; Among them, the improved YOLOv8 model is improved on the basis of the YOLOv8 model, and the improvements include: adding a small target detection layer in the detection head, improving the C2f module and the Bottleneck module, adding the DWR module, the SIR module and the DWRSeg network in the Backbone network, and adding the CBAM module, the channel attention module and the spatial attention module in the Neck module.

[0045] Example 5.

[0046] The present invention provides a computer device, comprising: Memory, for storing computer programs / instructions; A processor, configured to execute the computer program / instructions to implement the steps of the cigarette brand identification method provided in Example 1: Acquire a cigarette image; Inputting the cigarette image into the trained improved YOLOv8 model to obtain a cigarette brand recognition result; Among them, the improved YOLOv8 model is improved on the basis of the YOLOv8 model, and the improvements include: adding a small target detection layer in the detection head, improving the C2f module and the Bottleneck module, adding the DWR module, the SIR module and the DWRSeg network in the Backbone network, and adding the CBAM module, the channel attention module and the spatial attention module in the Neck module.

[0047] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0048] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0049] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0050] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0051] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A cigarette brand identification method, characterized in that: include: Acquire a cigarette image; Inputting the cigarette image into the trained improved YOLOv8 model to obtain a cigarette brand recognition result; Among them, the improved YOLOv8 model is improved on the basis of the YOLOv8 model, and the improvements include: adding a small target detection layer in the detection head, improving the C2f module and the Bottleneck module, adding the DWR module, the SIR module and the DWRSeg network in the Backbone network, and adding the CBAM module, the channel attention module and the spatial attention module in the Neck module.

2. The cigarette brand identification method according to claim 1, characterized in that: Adding the small target detection layer in the detection head includes: adding the small target detection layer between the output layer and the detection layer of the feature pyramid in the detection head.

3. The cigarette brand identification method according to claim 1, characterized in that: The improved C2f module and Bottleneck module include: Increase the size and number of convolution kernels in the C2f module; Increase the number of skip connection layers and depthwise convolutional layers in the Bottleneck module.

4. The cigarette brand identification method according to claim 1, characterized in that: The adding of the DWR module, the SIR module and the DWRSeg network in the Backbone network includes: The DWR module is added to the middle layer of the Backbone network and is set between two standard convolutional layers in the middle layer of the Bottleneck module; Add the SIR module between the last layer of the Backbone network and the first layer of the Neck module; The DWRSeg network is added between the output layer of the Backbone network and the input layer of the Neck module.

5. The cigarette brand identification method according to claim 1, characterized in that: The adding of the CBAM module, the channel attention module and the spatial attention module in the Neck module includes: Adding the CBAM module to the Neck module so that the CBAM module and the Neck module work in series; Add the channel attention module between the CBAM module and the spatial attention module; The spatial attention module is added between the channel attention module and the output layer of the Neck module.

6. The cigarette brand identification method according to claim 1, characterized in that: The loss function used in the training process of the improved YOLOv8 model is MPDIoU.

7. The cigarette brand identification method according to claim 1, characterized in that: The training data used in the training process of the improved YOLOv8 model are cigarette images that have undergone data enhancement and preprocessing; The data enhancement includes: flipping, rotating, cropping and scaling the cigarette image; The preprocessing includes: normalizing the pixel values ​​of the cigarette image.

8. A cigarette brand identification device, characterized in that: include: The cigarette image acquisition module is configured to: acquire a cigarette image; The cigarette brand recognition module is configured to: input the cigarette image into the trained improved YOLOv8 model to obtain a cigarette brand recognition result; Among them, the improved YOLOv8 model is improved on the basis of the YOLOv8 model, and the improvements include: adding a small target detection layer in the detection head, improving the C2f module and the Bottleneck module, adding the DWR module, the SIR module and the DWRSeg network in the Backbone network, and adding the CBAM module, the channel attention module and the spatial attention module in the Neck module.

9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instruction is executed by a processor, the steps of the cigarette brand identification method according to any one of claims 1 to 7 are implemented.

10. A computer device, characterized in that: include: Memory, for storing computer programs / instructions; A processor, configured to execute the computer program / instructions to implement the steps of the cigarette brand identification method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Public place smoking detection method based on improved YOLOv8

    CN116912770A

  • Sewage biological phase target automatic identification detection and instance segmentation method

    CN118351535A