Method and device for identifying cigarette case specifications based on deep learning, and electronic equipment
By improving the YOLO11 model and boundary processing technology, the accuracy and efficiency issues of cigarette box specification recognition in complex environments were resolved, achieving high-precision cigarette box detection and classification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUBEI TOBACCO XIANTAO
- Filing Date
- 2025-12-01
- Publication Date
- 2026-08-04
AI Technical Summary
Existing technologies have low accuracy and efficiency in identifying cigarette box specifications in complex environments, mainly due to the degradation of model performance caused by occlusion, lighting interference, and the diversity of deformation postures.
An improved YOLO11 model is adopted, which enhances the accuracy of cigarette box boundary detection by adding mask modules to the neck and head, and combining polygon boundary correction, smoothing, cropping and perspective transformation techniques. A focus loss function is added to the loss function to improve the ability to recognize small targets.
It significantly improves the accuracy and efficiency of cigarette box recognition, ensures high-precision detection and classification in complex environments, and provides reliable input data support.
Smart Images

Figure CN121747083B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, and electronic device for identifying cigarette box specifications based on deep learning. Background Technology
[0002] In recent years, thanks to breakthroughs in deep learning, especially convolutional neural networks (CNNs), image recognition technology has achieved unprecedented leaps. Computers' visual perception capabilities have been elevated to a whole new level, enabling them to largely replace traditional manual labor in various fields such as security monitoring, medical imaging, autonomous driving, and industrial quality inspection, undertaking heavy and repetitive recognition tasks.
[0003] "Cigarette box recognition," as a niche application with clear commercial and social value (such as smart retail, tobacco regulation, and advertising monitoring), has attracted widespread attention from the industry. Researchers have designed specialized algorithm models for this task. Through training on massive amounts of labeled data, these models have been able to accurately learn the appearance features of various cigarette boxes, including their specific logos, colors, textures, and packaging shapes. In laboratory environments or controlled, simple scenarios—such as clean backgrounds, uniform lighting, and cigarette boxes placed upright without interference—existing recognition technologies have indeed demonstrated satisfactory performance, validating the feasibility of the technology's application.
[0004] Although cigarette box recognition technology is theoretically mature, its performance often suffers significantly when these models, trained under ideal conditions, are deployed in the real, open, and dynamic world. The specific challenges stem primarily from the extreme complexity of the environment: 1) Complex occlusion: In actual shelf, tabletop, or handheld scenarios, cigarette boxes rarely appear in a complete, independent form. They are often partially obscured by other products, or multiple boxes are tightly stacked and overlapping. Severe occlusion can prevent the model from acquiring sufficient target features (such as complete brand logos), leading to missed detections or false positives. 2) Illumination and reflection interference: Real-world lighting conditions change rapidly. Strong natural light and uneven indoor lighting can create complex highlights and reflective areas on the smooth surface of cigarette box packaging. These reflections can "wash away" or distort crucial text and graphic information, causing significant interference to models that rely on color and texture features. 3) Deformation and pose diversity: Cigarette boxes are not always perfectly square; they may be deformed by compression, damaged, or tilted or overturned at any angle. This non-standard posture places extremely high demands on the geometric invariance of the model.
[0005] In summary, existing technologies lack a method to improve the accuracy and efficiency of cigarette box specification identification. Summary of the Invention
[0006] In view of this, it is necessary to provide a method, device and electronic device for identifying cigarette pack specifications based on deep learning, so as to solve the problems of low accuracy and efficiency in the existing technology of cigarette pack specification identification.
[0007] To address the aforementioned problems, in a first aspect, the present invention provides a method for identifying cigarette pack specifications based on deep learning, comprising: Obtain an image of the cigarette box containing the target cigarette; The cigarette box image of the target cigarette is input into a well-trained deep learning model to obtain the category of the target cigarette. The training process for a fully trained deep learning model includes: Obtain a dataset of cigarette pack images; The cigarette box image dataset is input into the improved YOLO11 model to obtain a polygon set of cigarette boxes. The improved YOLO11 model adds mask modules to the neck and head of the YOLO11 model. The mask module on the neck includes two convolutional layers and upsampling, and the mask module on the head includes two convolutional layers, two activation functions and transposed convolutional layers. The polygon set of the cigarette box is subjected to boundary correction and smoothing to obtain the polygon set of the processed cigarette box. The polygon set of the processed cigarette box is then cropped and perspective transformed to obtain the polygon set of the target cigarette box. The polygon set of the target cigarette box is input into the preset target classification model to obtain the classification result corresponding to the cigarette box image dataset.
[0008] In one possible implementation, acquiring the cigarette pack image dataset includes: The labelme software was used to annotate the cigarette boxes in the cigarette box images to obtain a cigarette box image dataset. In one possible implementation, the preset target classification model includes: One or more of the following: YOLO11 model, RF-DETR, YOLO-NAS, and RTMDet.
[0009] In one possible implementation, the boundary correction and smoothing process performed on the polygon set of the cigarette box to obtain the processed polygon set of the cigarette box includes: The target image in the polygon set of the cigarette box is subjected to boundary correction and smoothing processing based on the polygon bilateral filtering algorithm to obtain the boundary of the first polygon image. Based on the guided filtering algorithm, the target image in the polygon set of the cigarette box is subjected to boundary correction and smoothing processing to obtain the boundary of the second polygon image. The boundary of the target image is determined based on the boundary of the first polygonal image and the boundary of the second polygonal image; The polygon set of the cigarette box corresponding to the polygon set of the processed cigarette box is determined based on the boundary of the target image.
[0010] In one possible implementation, determining the boundary of the target image based on the first polygonal image boundary and the second polygonal image boundary includes: The boundary of the target image is determined based on the boundary of the first polygonal image and the average value of the boundary of the first polygonal image.
[0011] In one possible implementation, the polygon set of the processed cigarette box is cropped and perspective transformed to obtain the polygon set of the target cigarette box, including: Each image in the polygon set of the processed cigarette box is mapped to the original image and cropped to obtain the cropped cigarette box image; The cropped cigarette box image is subjected to perspective transformation to obtain a polygon set of the cigarette box label.
[0012] One possible implementation also includes: A focus loss function is added to the loss function of the improved YOLO11 model. The expression of the focus loss function is as follows:
[0013] In the formula, Indicates the weights of positive and negative samples. Indicates the focus parameter, This represents the probability predicted by the model.
[0014] Secondly, the present invention also provides a deep learning-based device for identifying cigarette pack specifications, comprising: The cigarette box image acquisition module for the target cigarette is used to acquire images of the cigarette box of the target cigarette. The target cigarette category identification module is used to input the cigarette box image of the target cigarette into a well-trained deep learning model to obtain the category of the target cigarette. The training process for a fully trained deep learning model includes: Obtain a dataset of cigarette pack images; The cigarette box image dataset is input into the improved YOLO11 model to obtain a polygon set of cigarette boxes. The improved YOLO11 model adds mask modules to the neck and head of the YOLO11 model. The mask module on the neck includes two convolutional layers and upsampling, and the mask module on the head includes two convolutional layers, two activation functions and transposed convolutional layers. The polygon set of the cigarette box is subjected to boundary correction and smoothing to obtain the polygon set of the processed cigarette box. The polygon set of the processed cigarette box is then cropped and perspective transformed to obtain the polygon set of the target cigarette box. The polygon set of the target cigarette box is input into the preset target classification model to obtain the classification result corresponding to the cigarette box image dataset.
[0015] Thirdly, the present invention also provides an electronic device, including a memory and a processor, wherein, The memory is used to store programs; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the deep learning-based cigarette box specification identification method described in any of the above implementations.
[0016] Fourthly, the present invention also provides a computer-readable storage medium for storing a computer-readable program or instruction, which, when executed by a processor, can implement the steps in the deep learning-based cigarette box specification identification method described in any of the above implementations.
[0017] The beneficial effects of this invention are as follows: The deep learning-based method for identifying cigarette pack categories provided by this invention acquires cigarette pack images of the target cigarette, inputs these images into a fully trained deep learning model, and obtains the category of the target cigarette. The training process of the fully trained deep learning model includes: acquiring a cigarette pack image dataset, inputting the cigarette pack image dataset into an improved YOLO11 model to obtain a polygon set of the cigarette packs. The improved YOLO11 model adds mask modules to the neck and head of the YOLO11 model. The mask module on the neck includes two convolutional layers and upsampling, and the mask module on the head includes two convolutional layers, two activation functions, and a transposed convolutional layer. By adding a mask module to the neck, the improved YOLO11 model can output the image boundary. Boundary correction and smoothing are applied to the polygon set of the cigarette box, resulting in a processed polygon set, ensuring accurate extraction of the cigarette box region. The processed polygon set is then cropped and perspective transformed to obtain the target cigarette box polygon set. This target cigarette box polygon set is input into a preset target classification model to obtain the classification result corresponding to the cigarette box image dataset. This invention achieves high-precision detection of cigarette box images by improving the YOLO11 model. Combined with boundary correction and perspective transformation techniques, it ensures overall detection efficiency at a relatively low cost, providing reliable input for subsequent classification. The classification model outputs the cigarette category based on this processed data, significantly improving recognition accuracy. Attached Figure Description
[0018] Figure 1 A flowchart illustrating an embodiment of a deep learning-based method for identifying cigarette box specifications provided by the present invention; Figure 2 A schematic diagram of the structure of an improved YOLO11 model in one embodiment of a deep learning-based method for identifying cigarette box specifications provided by the present invention; Figure 3 This is a schematic diagram illustrating the improved boundary correction in one embodiment of a deep learning-based method for identifying cigarette box specifications provided by the present invention. Figure 4 A schematic flowchart of an embodiment of a deep learning-based cigarette box specification identification device provided by the present invention; Figure 5 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0020] In the description of the embodiments of the present invention, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0021] The terms "first," "second," etc., used in the embodiments of this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.
[0022] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0023] This invention provides a method, apparatus, and electronic device for identifying cigarette box specifications based on deep learning, which will be described below.
[0024] Figure 1 This is a schematic flowchart of an embodiment of the deep learning-based cigarette box specification identification method provided by the present invention, as shown below. Figure 1 As shown, the deep learning-based method for identifying cigarette pack specifications includes: S101. Obtain the image of the cigarette box of the target cigarette; Images of the cigarette packs of the target cigarettes are captured using image acquisition equipment such as industrial cameras, surveillance cameras, and mobile devices.
[0025] S102. Input the cigarette box image of the target cigarette into the fully trained deep learning model to obtain the category of the target cigarette. The GPU server inputs the image of the cigarette box of the target cigarette into the fully trained deep learning model.
[0026] The training process for a fully trained deep learning model includes: Obtain a dataset of cigarette pack images; The cigarette box image dataset is input into the improved YOLO11 model to obtain a polygon set of cigarette boxes. The improved YOLO11 model adds mask modules to the neck and head of the YOLO11 model. The mask module on the neck includes two convolutional layers and upsampling, and the mask module on the head includes two convolutional layers, two activation functions and transposed convolutional layers. The polygon set of the cigarette box is subjected to boundary correction and smoothing to obtain the polygon set of the processed cigarette box. The polygon set of the processed cigarette box is then cropped and perspective transformed to obtain the polygon set of the target cigarette box. The polygon set of the target cigarette box is input into the preset target classification model to obtain the classification result corresponding to the cigarette box image dataset.
[0027] Compared with existing technologies, the deep learning-based cigarette box classification method provided in this embodiment acquires cigarette box images of the target cigarette, inputs these images into a fully trained deep learning model, and obtains the category of the target cigarette. The training process of the fully trained deep learning model includes: acquiring a cigarette box image dataset, inputting the cigarette box image dataset into an improved YOLO11 model to obtain a polygon set of the cigarette box, and the improved YOLO11 model adds mask modules to the neck and head of the YOLO11 model. The mask module on the neck includes two convolutional layers and upsampling, and the mask module on the head includes two convolutional layers, two activation functions, and a transposed convolutional layer. By adding a mask module to the YOLO11 model, the improved model can output the image boundary. Boundary correction and smoothing are applied to the polygon set of the cigarette box, resulting in a processed polygon set, ensuring accurate extraction of the cigarette box region. The processed polygon set is then cropped and perspective transformed to obtain the target cigarette box polygon set. This target polygon set is input into a preset target classification model to obtain the classification result corresponding to the cigarette box image dataset. This invention achieves high-precision detection of cigarette box images by improving the YOLO11 model. Combined with boundary correction and perspective transformation techniques, it ensures overall detection efficiency at a relatively low cost, providing reliable input for subsequent classification. The classification model outputs the cigarette category based on this processed data, significantly improving recognition accuracy.
[0028] It should be noted that this embodiment is applied to the intelligent management scenario of the tobacco industry, which automatically identifies cigarette brands and specifications through computer vision technology. It is understood that the method of this embodiment can also be applied to other scenarios that require category identification.
[0029] In some embodiments of the present invention, obtaining the cigarette box image dataset includes: The labelme software was used to annotate the cigarette boxes in the cigarette box images to obtain a cigarette box image dataset. In a specific embodiment of the present invention, obtaining a cigarette pack image dataset specifically includes: The collection of cigarette pack data began with summarizing common cigarette pack types on the market and obtaining preliminary data through communication with tobacco companies. After manual review, data was supplemented using internet searches for samples with limited numbers.
[0030] For cigarette pack image processing, the labelme software was used to label the cigarette packs in the images, with the label indicating the brand type, such as "Double Happiness (Forget-Me-Not)" and "Yellow Crane Tower (1916 Medium)". During labeling, images with overexposure and severe interference such as smoke were manually removed to improve the dataset quality.
[0031] In a specific embodiment of the present invention, a cigarette box image dataset is input into an improved YOLO11 model. The improved YOLO11 model is used to detect the boundaries of the cigarette boxes in the images and outputs the polygon coordinates of the cigarette boxes. Network infrastructure: The improved YOLO11 model first resizes the images to be detected to 640x640 squares. Then, the image is input into the backbone network to extract features. Next, the feature map is input into the Neck layer to select important feature regions and map them to a higher-dimensional space. Finally, this feature map is input into the head network. This network outputs three layers of feature maps of different sizes, which are then processed through rep and conv layers to output the prediction results.
[0032] Network optimization design: For the cigarette box recognition task, the YOLO11 model was improved. To address the issues of perspective shift and occlusion during real-world photography, a lightweight mask module and a boundary processing module were added. This module enhances the model's ability to accurately detect cigarette box boundaries under complex conditions such as occlusion, reflection, and blur by performing semantic segmentation of the image.
[0033] More specifically, the attention mechanism in the CPSA module is used to filter the features extracted from the backbone network:
[0034] in yes Enhanced image features selected by the network based on its attention mechanism.
[0035] The cigarette pack image dataset was processed using an improved YOLO11 model to detect polygons of objects. The processing steps were as follows:
[0036] in , which is the head network of the model, used for basic object bounding box detection. Confidence level and classification .
[0037] use The module processes objects in an image and obtains a collection of object masks:
[0038] in, Image features are processed by the head network to output bounding boxes for object detection, using a lightweight... Module For the detected rectangle Semantic segmentation is performed on the pixels of the objects in the image to obtain the pixels containing the objects and output the object boundaries. The remaining pixels are used as the default category for the background. Finally, the object boundary points of the entire image are output. .
[0039] In some embodiments of the present invention, the preset target classification model includes: One or more of the following: YOLO11 model, RF-DETR, YOLO-NAS, and RTMDet.
[0040] In some embodiments of the present invention, the step of performing boundary correction and smoothing processing on the polygon set of the cigarette box to obtain the processed polygon set of the cigarette box includes: The target image in the polygon set of the cigarette box is subjected to boundary correction and smoothing processing based on the polygon bilateral filtering algorithm to obtain the boundary of the first polygon image. Based on the guided filtering algorithm, the target image in the polygon set of the cigarette box is subjected to boundary correction and smoothing processing to obtain the boundary of the second polygon image. The boundary of the target image is determined based on the boundary of the first polygonal image and the boundary of the second polygonal image; The polygon set of the cigarette box corresponding to the polygon set of the processed cigarette box is determined based on the boundary of the target image.
[0041] In some embodiments of the present invention, determining the boundary of the target image based on the first polygonal image boundary and the second polygonal image boundary includes: The boundary of the target image is determined based on the boundary of the first polygonal image and the average value of the boundary of the first polygonal image.
[0042] In some embodiments of the present invention, the polygon set of the processed cigarette box is cropped and perspective transformed to obtain the polygon set of the target cigarette box, including: Each image in the polygon set of the processed cigarette box is mapped to the original image and cropped to obtain the cropped cigarette box image; The cropped cigarette box image is subjected to perspective transformation to obtain a polygon set of the cigarette box label.
[0043] In a specific embodiment of the present invention, based on the set of polygonal boundaries of the cigarette box, the polygonal boundaries of the cigarette box are processed using a boundary processing module and mapped onto the original image to obtain a set of cigarette box images of uniform size after perspective cropping from the original image. Based on the obtained set of cigarette box images, a target classification model is used. The images are input into a bacbone network to extract features, and then the features are input into a head network. The head network outputs the category result of the entire cigarette box image through softmax.
[0044] More specifically, the boundary correction module right Perform edge trimming and smoothing, and output a cropped image of the cigarette box corresponding to the original image, with a preset rectangle size of 224. 224, such as Figure 2 As shown, the processing procedure is as follows:
[0045] in After processing the image using a polygonal bilateral filtering algorithm and a guided filtering algorithm, the average of the two images is calculated to obtain a new smoothed image boundary.
[0046] Crop the trimmed borders from the original image:
[0047] Transform the cropped image using perspective:
[0048] The YOLO11 model was introduced and equipped with a mask module, such as... Figure 3 As shown, this module uses semantic segmentation technology to accurately identify objects within the detection box, processing only the image within the detection box to ensure high efficiency in semantic recognition. Furthermore, it can distinguish cigarette boxes within the detection box in greater detail. When an object is occluded or reflects light, resulting in excessive background within the detection box, semantic segmentation technology can filter out some of the background. Subsequently, perspective transformation technology is used to map irregular polygons to 224. On 224-pixel images, it is ensured that the images used for classification are almost background-free, effectively reducing background interference.
[0049] The cropped image is predicted by the target classification model to obtain the object classification result. The processing procedure is as follows:
[0050] The classification model uses softmax to classify the obtained features:
[0051] To address the challenge of recognizing numerous, small cigarette boxes, a focus loss function is added to the loss function of the improved YOLO11 model. This loss function enhances the model's ability to recognize small objects. In some embodiments of this invention, the following further methods are also included: A focus loss function is added to the loss function of the improved YOLO11 model. The expression of the focus loss function is as follows:
[0052] In the formula, Indicates the weights of positive and negative samples. Indicates the focus parameter, This represents the probability predicted by the model.
[0053] To better implement the deep learning-based cigarette box specification identification method in this embodiment of the invention, based on the deep learning-based cigarette box specification identification method, correspondingly, as follows: Figure 4 As shown, this embodiment of the invention also provides a deep learning-based cigarette box specification identification device. The deep learning-based cigarette box specification identification device 400 includes: The cigarette box image acquisition module 401 is used to acquire the cigarette box image of the target cigarette. The target cigarette category identification module 402 is used to input the cigarette box image of the target cigarette into a well-trained deep learning model to obtain the category of the target cigarette. The training process for a fully trained deep learning model includes: Obtain a dataset of cigarette pack images; The cigarette box image dataset is input into the improved YOLO11 model to obtain a polygon set of cigarette boxes. The improved YOLO11 model adds mask modules to the neck and head of the YOLO11 model. The mask module on the neck includes two convolutional layers and upsampling, and the mask module on the head includes two convolutional layers, two activation functions and transposed convolutional layers. The polygon set of the cigarette box is subjected to boundary correction and smoothing to obtain the polygon set of the processed cigarette box. The polygon set of the processed cigarette box is then cropped and perspective transformed to obtain the polygon set of the target cigarette box. The polygon set of the target cigarette box is input into the preset target classification model to obtain the classification result corresponding to the cigarette box image dataset.
[0054] The deep learning-based cigarette box specification identification device 400 provided in the above embodiments can realize the technical solution described in the above embodiment of the deep learning-based cigarette box specification identification method. The specific implementation principle of each module or unit can be found in the corresponding content in the above embodiment of the deep learning-based cigarette box specification identification method, which will not be repeated here.
[0055] like Figure 5 As shown, the present invention also provides an electronic device 500. The electronic device 500 includes a processor 501, a memory 502, and a display 503. Figure 5 Only some components of the electronic device 500 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0056] In some embodiments, processor 501 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 502 or process data, such as a deep learning-based method for identifying cigarette box specifications in this invention.
[0057] In some embodiments, processor 501 may be a single server or a group of servers. The server group may be centralized or distributed. In some embodiments, processor 501 may be local or remote. In some embodiments, processor 501 may be implemented on a cloud platform. In some embodiments, the cloud platform may include a private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, internal cloud, multi-cloud, or any combination thereof.
[0058] In some embodiments, memory 502 may be an internal storage unit of electronic device 500, such as a hard disk or memory of electronic device 500. In other embodiments, memory 502 may also be an external storage device of electronic device 500, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 500.
[0059] Furthermore, the memory 502 may include both internal storage units of the electronic device 500 and external storage devices. The memory 502 is used to store application software and various types of data installed on the electronic device 500.
[0060] In some embodiments, display 503 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 503 is used to display information from electronic device 500 and to display a visual user interface. Components 501-503 of electronic device 500 communicate with each other via a system bus.
[0061] In one embodiment, when processor 501 executes a deep learning-based cigarette box specification identification program stored in memory 502, the following steps can be implemented: Obtain an image of the cigarette box containing the target cigarette; The cigarette box image of the target cigarette is input into a well-trained deep learning model to obtain the category of the target cigarette. The training process for a fully trained deep learning model includes: Obtain a dataset of cigarette pack images; The cigarette box image dataset is input into the improved YOLO11 model to obtain a polygon set of cigarette boxes. The improved YOLO11 model adds mask modules to the neck and head of the YOLO11 model. The mask module on the neck includes two convolutional layers and upsampling, and the mask module on the head includes two convolutional layers, two activation functions and transposed convolutional layers. The polygon set of the cigarette box is subjected to boundary correction and smoothing to obtain the polygon set of the processed cigarette box. The polygon set of the processed cigarette box is then cropped and perspective transformed to obtain the polygon set of the target cigarette box. The polygon set of the target cigarette box is input into the preset target classification model to obtain the classification result corresponding to the cigarette box image dataset.
[0062] It should be understood that when the processor 501 executes a deep learning-based cigarette box specification identification program in the memory 502, in addition to the functions mentioned above, it can also perform other functions, as detailed in the description of the corresponding method embodiments above.
[0063] Furthermore, the embodiments of the present invention do not specifically limit the type of electronic device 500 mentioned. Electronic device 500 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, electronic device 500 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0064] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0065] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for identifying cigarette pack specifications based on deep learning, characterized in that, include: Obtain an image of the cigarette box containing the target cigarette; The cigarette box image of the target cigarette is input into a well-trained deep learning model to obtain the category of the target cigarette. The training process for a fully trained deep learning model includes: Obtain a dataset of cigarette pack images; The cigarette box image dataset is input into the improved YOLO11 model to obtain a polygon set of cigarette boxes. The improved YOLO11 model adds mask modules to the neck and head of the YOLO11 model. The mask module on the neck includes two convolutional layers and upsampling, and the mask module on the head includes two convolutional layers, two activation functions and transposed convolutional layers. The polygon set of the cigarette box is subjected to boundary correction and smoothing to obtain the polygon set of the processed cigarette box. The polygon set of the processed cigarette box is then cropped and perspective transformed to obtain the polygon set of the target cigarette box. The polygon set of the target cigarette box is input into the preset target classification model to obtain the classification result corresponding to the cigarette box image dataset.
2. The method for identifying cigarette box specifications based on deep learning according to claim 1, characterized in that, The acquisition of the cigarette box image dataset includes: The labelme software was used to annotate the cigarette boxes in the cigarette box images to obtain a cigarette box image dataset.
3. The method for identifying cigarette box specifications based on deep learning according to claim 1, characterized in that, The preset target classification model includes: One or more of the following: YOLO11 model, RF-DETR, YOLO-NAS, and RTMDet.
4. The method for identifying cigarette box specifications based on deep learning according to claim 1, characterized in that, The process of performing boundary correction and smoothing on the polygon set of the cigarette box to obtain the processed polygon set of the cigarette box includes: The target image in the polygon set of the cigarette box is subjected to boundary correction and smoothing processing based on the polygon bilateral filtering algorithm to obtain the boundary of the first polygon image. Based on the guided filtering algorithm, the target image in the polygon set of the cigarette box is subjected to boundary correction and smoothing processing to obtain the boundary of the second polygon image. The boundary of the target image is determined based on the boundary of the first polygonal image and the boundary of the second polygonal image; The polygon set of the cigarette box corresponding to the polygon set of the processed cigarette box is determined based on the boundary of the target image.
5. The method for identifying cigarette box specifications based on deep learning according to claim 4, characterized in that, Determining the boundary of the target image based on the first polygonal image boundary and the second polygonal image boundary includes: The boundary of the target image is determined based on the boundary of the first polygonal image and the average value of the boundary of the first polygonal image.
6. The method for identifying cigarette pack specifications based on deep learning according to claim 1, characterized in that, The polygon set of the processed cigarette box is clipped and perspective transformed to obtain the polygon set of the target cigarette box, including: Each image in the polygon set of the processed cigarette box is mapped to the original image and cropped to obtain the cropped cigarette box image; The cropped cigarette box image is subjected to perspective transformation to obtain a polygon set of the cigarette box label.
7. The method for identifying cigarette box specifications based on deep learning according to claim 1, characterized in that, Also includes: A focus loss function is added to the loss function of the improved YOLO11 model. The expression of the focus loss function is as follows: In the formula, Indicates the weights of positive and negative samples. Indicates the focus parameter, This represents the probability predicted by the model.
8. A device for identifying cigarette pack specifications based on deep learning, characterized in that, include: The cigarette box image acquisition module for the target cigarette is used to acquire images of the cigarette box of the target cigarette. The target cigarette category identification module is used to input the cigarette box image of the target cigarette into a well-trained deep learning model to obtain the category of the target cigarette. The training process for a fully trained deep learning model includes: Obtain a dataset of cigarette pack images; The cigarette box image dataset is input into the improved YOLO11 model to obtain a polygon set of cigarette boxes. The improved YOLO11 model adds mask modules to the neck and head of the YOLO11 model. The mask module on the neck includes two convolutional layers and upsampling, and the mask module on the head includes two convolutional layers, two activation functions and transposed convolutional layers. The polygon set of the cigarette box is subjected to boundary correction and smoothing to obtain the polygon set of the processed cigarette box. The polygon set of the processed cigarette box is then cropped and perspective transformed to obtain the polygon set of the target cigarette box. The polygon set of the target cigarette box is input into the preset target classification model to obtain the classification result corresponding to the cigarette box image dataset.
9. An electronic device, characterized in that, Including memory and processor, among which, The memory is used to store programs; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the deep learning-based cigarette box specification identification method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the deep learning-based method for identifying cigarette box specifications as described in any one of claims 1 to 7.