Cigarette identification method and device, computer equipment and storage medium
By generating grayscale images and binary enhanced images, and using multi-model collaborative methods, the problem of low recognition accuracy of cigarette recognition technology under conditions of insufficient light or unsatisfactory viewing angle is solved, achieving higher recognition accuracy and reliability.
Patent Information
- Application Number
- CN202411994463.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-02
AI Technical Summary
The existing cigarette recognition technology has low recognition accuracy in the case of dark light or unsatisfactory viewing angle, and due to insufficient data set diversity, the generalization ability of the model is limited, resulting in misidentification and misidentification problems.
By generating grayscale images and binary enhancement images corresponding to the images to be identified, and inputting these images into the cigarette detection model and cigarette recognition model, the coordinate position and label of the candidate cigarettes are determined, and the final target cigarette recognition is carried out through the collaborative cooperation of multiple models.
It improves the accuracy and reliability of cigarette recognition, reduces the misidentification rate and misidentification rate, and enhances the recognition ability under conditions of insufficient light or poor viewing angle.
Smart Images

Figure CN119919662A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a cigarette identification method, device, computer equipment and storage medium. Background Art
[0002] In recent years, with the improvement of public health awareness, cigarette recognition technology has received widespread attention, especially in the monitoring of non-smoking areas such as schools and public places. Cigarette detection has become an important means to ensure environmental health. With the development of artificial intelligence and machine learning technology, image recognition technology based on deep learning has gradually become a research hotspot in the field of cigarette detection. By training deep learning models such as convolutional neural networks, the automatic recognition accuracy of cigarette images has been significantly improved. It can capture smoking behavior on campus through cameras, issue alarms after real-time analysis, and take timely measures.
[0003] However, despite some progress in cigarette detection technology based on AI and image recognition, the accuracy of cigarette recognition will drop significantly in low light or poor viewing angles. In addition, current cigarette detection technology usually relies on a large amount of data training, but due to the difficulty in obtaining data in real scenes, the lack of diversity in data sets, and the limited generalization ability of the model, the accuracy of the cigarette recognition system is low, and there are problems of misidentification and missed recognition. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a cigarette identification method, device, computer equipment and storage medium.
[0005] According to a first aspect of an embodiment of the present disclosure, the present application provides a cigarette identification method, the method comprising:
[0006] According to the image to be identified, a grayscale image and a binary enhanced image corresponding to the image to be identified are generated;
[0007] Inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, determining the coordinate position and a first label of at least one candidate cigarette from the image to be identified, wherein the first label includes a cigarette label and a cigarette-like label;
[0008] For each candidate cigarette, a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the candidate cigarette in the binary enhanced image are input into a cigarette recognition model to obtain a second label determined by the cigarette recognition model for the candidate cigarette, wherein the second label includes a fogged cigarette, a non-fog cigarette, and a non-cigarette;
[0009] A target cigarette is determined from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette.
[0010] In combination with any embodiment of the present disclosure, generating a binary enhanced image corresponding to the image to be identified according to the image to be identified includes:
[0011] Binarize the image to be recognized to generate a binary image;
[0012] For each pixel point in the binary image, the binary image is enhanced according to the pixel value of the pixel point to generate a binary enhanced image corresponding to the image to be identified.
[0013] In combination with any embodiment of the present disclosure, for each pixel point in the binary image, enhancing the binary image according to the pixel value of the pixel point to generate a binary enhanced image corresponding to the image to be identified includes:
[0014] For each pixel point with a pixel value of 0 in the binary image, the pixel value of the pixel point is set to a first value, and for each pixel point with a pixel value of 1 in the binary image, the pixel value of the pixel point is set to a second value, so as to obtain a binary enhanced image corresponding to the image to be identified, wherein the first value is less than 0 and the second value is greater than 1.
[0015] In combination with any embodiment of the present disclosure, the step of inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determining the coordinate position and the first label of at least one candidate cigarette from the image to be identified comprises:
[0016] Inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determining a label of each object in the image to be identified based on the cigarette detection model, wherein the label includes cigarette, quasi-cigarette and non-cigarette;
[0017] At least one object labeled as a cigarette or a cigarette-like object in the image to be identified is taken as a candidate cigarette, and the coordinate position and the first label of the candidate cigarette are output.
[0018] In combination with any embodiment of the present disclosure, the step of inputting the first cropped image corresponding to the candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image into a cigarette recognition model to obtain a second label determined by the cigarette recognition model for the candidate cigarette includes:
[0019] Inputting the first cropped image corresponding to the candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image into a cigarette recognition model, and determining the confidence corresponding to each label of the candidate cigarette through each activation function in the cigarette recognition model;
[0020] For each label of the candidate cigarette, taking the weighted average of the confidences corresponding to the label determined by each activation function as the final confidence corresponding to the label;
[0021] The label with the highest final confidence is used as the second label of the candidate cigarette.
[0022] In combination with any embodiment of the present disclosure, the step of determining a target cigarette from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette includes:
[0023] The candidate cigarette is determined to be a target cigarette when any of the following conditions is met:
[0024] The second label of the candidate cigarette is a foggy cigarette;
[0025] The first label of the candidate cigarette is a cigarette, and the second label is a non-fogging cigarette.
[0026] In combination with any embodiment of the present disclosure, the method further includes:
[0027] For each candidate cigarette, inputting a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the binary enhanced image into the feature vector extraction model to obtain a target feature vector of the candidate cigarette;
[0028] For each candidate cigarette, compare the target feature vector of the candidate cigarette with each standard feature vector in the cigarette feature library, and determine the third label of the candidate cigarette according to the similarity between the target feature vector and each standard feature vector, wherein the third label includes fogging cigarettes, fog-free cigarettes and similar cigarettes, and the similar cigarettes include chalk and student pens;
[0029] The step of determining a target cigarette from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette comprises:
[0030] A target cigarette is determined from the at least one candidate cigarette according to the first label, the second label and the third label of each candidate cigarette.
[0031] In combination with any embodiment of the present disclosure, the step of determining a target cigarette from the at least one candidate cigarette according to the first label, the second label, and the third label of each candidate cigarette includes:
[0032] The candidate cigarette is determined to be a target cigarette when any of the following conditions is met:
[0033] There is at least one fogged cigarette in the second label and the third label of the candidate cigarette;
[0034] The first label of the candidate cigarette is a cigarette, and the second label or the third label is a non-fogging cigarette.
[0035] In combination with any embodiment of the present disclosure, the method further includes:
[0036] For each candidate cigarette, if the confidence corresponding to the first label and / or the second label of the candidate cigarette is less than a confidence threshold, the candidate cigarette is deleted.
[0037] In a second aspect, the present application also provides a cigarette identification device, comprising:
[0038] An image generation module, used to generate a grayscale image and a binary enhanced image corresponding to the image to be identified according to the image to be identified;
[0039] a label determination module, used for inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determining the coordinate position and a first label of at least one candidate cigarette from the image to be identified, wherein the first label includes a cigarette label and a cigarette-like label;
[0040] a label acquisition module, for each candidate cigarette, inputting a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the candidate cigarette in the binary enhanced image into a cigarette recognition model to obtain a second label determined by the cigarette recognition model for the candidate cigarette, wherein the second label includes a fogged cigarette, a non-fog cigarette, and a non-cigarette;
[0041] The target determination module is used to determine a target cigarette from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette.
[0042] In one embodiment, the image generation module is specifically used for:
[0043] Binarize the image to be recognized to generate a binary image;
[0044] For each pixel point in the binary image, the binary image is enhanced according to the pixel value of the pixel point to generate a binary enhanced image corresponding to the image to be identified.
[0045] In one embodiment, the image generation module is specifically used for:
[0046] For each pixel point with a pixel value of 0 in the binary image, the pixel value of the pixel point is set to a first value, and for each pixel point with a pixel value of 1 in the binary image, the pixel value of the pixel point is set to a second value, so as to obtain a binary enhanced image corresponding to the image to be identified, wherein the first value is less than 0 and the second value is greater than 1.
[0047] In one embodiment, the tag determination module is specifically used to:
[0048] Inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determining a label of each object in the image to be identified based on the cigarette detection model, wherein the label includes cigarette, quasi-cigarette and non-cigarette;
[0049] At least one object labeled as a cigarette or a cigarette-like object in the image to be identified is taken as a candidate cigarette, and the coordinate position and the first label of the candidate cigarette are output.
[0050] In one embodiment, the tag acquisition module is specifically used to:
[0051] Inputting the first cropped image corresponding to the candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image into a cigarette recognition model, and determining the confidence corresponding to each label of the candidate cigarette through each activation function in the cigarette recognition model;
[0052] For each label of the candidate cigarette, taking the weighted average of the confidences corresponding to the label determined by each activation function as the final confidence corresponding to the label;
[0053] The label with the highest final confidence is used as the second label of the candidate cigarette.
[0054] In one embodiment, the target determination module is specifically used to:
[0055] The candidate cigarette is determined to be a target cigarette when any of the following conditions is met:
[0056] The second label of the candidate cigarette is a foggy cigarette;
[0057] The first label of the candidate cigarette is a cigarette, and the second label is a non-fogging cigarette.
[0058] In one embodiment, the cigarette identification device further comprises:
[0059] A feature comparison module, for each candidate cigarette, inputting a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the binary enhanced image into the feature vector extraction model to obtain a target feature vector of the candidate cigarette;
[0060] For each candidate cigarette, compare the target feature vector of the candidate cigarette with each standard feature vector in the cigarette feature library, and determine the third label of the candidate cigarette according to the similarity between the target feature vector and each standard feature vector, wherein the third label includes fogging cigarettes, fog-free cigarettes and similar cigarettes, and the similar cigarettes include chalk and student pens;
[0061] The target determination module is specifically used for:
[0062] A target cigarette is determined from the at least one candidate cigarette according to the first label, the second label and the third label of each candidate cigarette.
[0063] In one embodiment, the target determination module is specifically used to:
[0064] The candidate cigarette is determined to be a target cigarette when any of the following conditions is met:
[0065] There is at least one fogged cigarette in the second label and the third label of the candidate cigarette;
[0066] The first label of the candidate cigarette is a cigarette, and the second label or the third label is a non-fogging cigarette.
[0067] In one embodiment, the cigarette identification device further comprises:
[0068] The cigarette deletion module is used to delete each candidate cigarette if the confidence corresponding to the first label and / or the second label of the candidate cigarette is less than a confidence threshold.
[0069] In a third aspect, the present application provides a computer program product, comprising a computer program / instructions, which implement the steps of the method described in any embodiment when the computer program / instructions are executed by a processor.
[0070] In a fourth aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in any of the above embodiments when executing the program.
[0071] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any of the above embodiments.
[0072] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0073] In the disclosed embodiment, a grayscale image and a binary enhanced image corresponding to the image to be identified are generated, and the first label of at least one candidate cigarette is identified from the image to be identified according to the image to be identified, the grayscale image and the binary enhanced image through a cigarette detection model; then, the first cropped image corresponding to each candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image are detected by the cigarette recognition model to determine the second label of each candidate cigarette; then, the target cigarette is determined according to the first label and the second label of each candidate cigarette. This solution can more accurately determine the candidate cigarettes and the labels corresponding to each candidate cigarette from the image to be identified through the collaborative cooperation between the cigarette detection model and the cigarette recognition model, and then perform the final target cigarette identification based on the label of each candidate cigarette, which can significantly improve the accuracy and reliability of identification and reduce the false recognition rate and missed recognition rate.
[0074] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] The accompanying drawings, which are incorporated in and constitute a part of this disclosure, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0076] Figure 1 FIG. 4 is a flow chart of a cigarette identification method shown in some exemplary embodiments.
[0077] Figure 2 Schematic diagrams showing the coordinate position and first label of a candidate cigarette according to some exemplary embodiments.
[0078] Figure 3 is a flow chart of another cigarette identification method shown in some exemplary embodiments.
[0079] Figure 4 FIG. 4 is a flow chart of yet another cigarette identification method shown in some exemplary embodiments.
[0080] Figure 5 is a flow chart of yet another cigarette identification method shown in some exemplary embodiments.
[0081] Figure 6 FIG. 4 is a block diagram of a cigarette identification device showing some exemplary embodiments.
[0082] Figure 7The figure is a hardware structure diagram of a computer device shown in some exemplary embodiments. DETAILED DESCRIPTION
[0083] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0084] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0085] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0086] Although cigarette detection technology based on AI and image recognition has made some progress, it still faces a series of challenges in practical applications, especially in educational environments such as campuses. First, existing cigarette detection systems often find it difficult to accurately identify pens used by students, chalk used by teachers, and other slender objects (such as pointers, laser pointers, etc.) that are similar in shape to cigarettes, which can easily lead to false alarms or missed alarms; secondly, existing models may have limitations in accurately identifying cigarettes with different appearances and burning states, which can easily lead to misidentification. Furthermore, image recognition technology is very sensitive to factors such as ambient lighting, camera angle, and image resolution. In dim light or unsatisfactory viewing angles, the accuracy of cigarette recognition will drop significantly.
[0087] In view of this, the present disclosure provides a cigarette recognition method, device, computer equipment and storage medium. The cigarette recognition method can be applied to a scenario where cigarette recognition is performed on a captured image. Optionally, the cigarette recognition method can be performed by an image processing system, and the image processing system can be integrated on a terminal device. The terminal device can acquire images captured by an image acquisition device (such as a monitoring device) and perform cigarette recognition on the acquired images.
[0088] Next, the embodiments of the present disclosure are described in detail.
[0089] The first aspect of the present disclosure provides a cigarette identification method. Figure 1 , which comprises the following steps:
[0090] S101, generating a grayscale image and a binary enhanced image corresponding to an image to be identified according to the image to be identified.
[0091] Among them, the image to be identified refers to the image that needs to be identified as a cigarette, the grayscale image refers to the image in which the color in the image to be identified is converted into grayscale; the binary enhanced image refers to the image in which the pixel values in the image are converted into two states (such as 0 and 1) and enhanced.
[0092] Optionally, the image to be identified acquired by the image acquisition device can be acquired, and grayscale processing can be performed on the image to be identified, so as to generate a grayscale image corresponding to the image to be identified; further, the image to be identified can be binarized by OTSU (Otsu's method), dynamic threshold method, Sobel operator edge detection method and other methods, so as to generate a binary image corresponding to the image to be identified, and then the generated binary image can be enhanced to generate a binary enhanced image corresponding to the image to be identified.
[0093] S102, inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determining the coordinate position and a first label of at least one candidate cigarette from the image to be identified.
[0094] The first label includes a cigarette label and a cigarette-like label. A cigarette label refers to a label that is determined to be a cigarette, and a cigarette-like label refers to a label that has a certain degree of similarity with a cigarette but cannot be determined to be a cigarette. A cigarette detection model refers to a model used to perform preliminary cigarette recognition on an image to be recognized, and may be a YOLOv5 model, etc.
[0095] One possible implementation method is to input the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determine the label of each object in the image to be identified based on the cigarette detection model; take at least one object in the image to be identified that is labeled as a cigarette or a cigarette-like object as a candidate cigarette, and output the coordinate position and the first label of the candidate cigarette.
[0096] The labels include cigarettes, quasi-cigarettes and non-cigarettes.
[0097] Optionally, the image to be identified, as well as the grayscale image and binary enhanced image corresponding to the generated image to be identified, can be input into the cigarette detection model, and the image to be identified can be preliminarily identified as a cigarette through the cigarette detection model, and the label and confidence of each object in the image to be identified can be determined; illustratively, for any object, the confidence corresponding to the object label as a cigarette, the confidence corresponding to the label as a cigarette-like object, and the confidence corresponding to the label as a non-cigarette can be determined, and then the label corresponding to the highest confidence can be used as the label of the object. For example, for any object, it can be determined that the confidence corresponding to the object label as a cigarette is 0.7, the confidence corresponding to the label as a cigarette-like object is 0.2, and the confidence corresponding to the label as a non-cigarette is 0.1, and then the label corresponding to the highest confidence of 0.7, that is, cigarette, can be used as the label of the object. Further, at least one object labeled as a cigarette or a cigarette-like object can be used as a candidate cigarette, and the label of the candidate cigarette can be used as the first label, and the coordinate position and the first label of the candidate cigarette can be output.
[0098] It should be noted that the image to be identified is input into the cigarette detection model, and the cigarette detection model performs preliminary cigarette identification on the image to be identified, and can output the following: Figure 2 The identification image shown is marked with the coordinate positions and first labels of the candidate cigarettes, and may also include the confidence level corresponding to the first label of each candidate cigarette.
[0099] S103, for each candidate cigarette, inputting the first cropped image corresponding to the candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image into the cigarette recognition model to obtain the second label determined by the cigarette recognition model for the candidate cigarette.
[0100] The second label includes a fogged cigarette, a non-fog cigarette and a non-cigarette. The cigarette recognition model refers to a model for detecting each candidate cigarette, which can be a resnet50 model or the like.
[0101] Optionally, after determining at least one candidate cigarette, the first cropped image of each candidate cigarette can be cropped from the image to be identified, and the second cropped image of each candidate cigarette can be cropped from the binary enhanced image according to the coordinate position of each candidate cigarette determined by the cigarette detection model. Furthermore, the cropped first cropped image and the second cropped image of each candidate cigarette can be input into the cigarette recognition model. Through the cigarette recognition model, for each candidate cigarette, the confidence corresponding to the object label as a foggy cigarette, the confidence corresponding to the label as a fogless cigarette, and the confidence corresponding to the label as a non-cigarette can be determined, and then the label corresponding to the highest confidence can be used as the second label of the object. For example, for each candidate cigarette, it can be determined that the confidence corresponding to the object label as a foggy cigarette is 0.3, the confidence corresponding to the label as a class cigarette is 0.6, and the confidence corresponding to the label as a non-cigarette is 0.1, and then the label corresponding to the highest confidence of 0.6, that is, the fogless cigarette, is used as the second label of the object.
[0102] S104: Determine a target cigarette from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette.
[0103] The target cigarette refers to a target determined as a real cigarette from multiple candidate cigarettes.
[0104] Optionally, after obtaining the first label and the second label of each candidate cigarette, the candidate cigarette can be determined as the target cigarette if any of the following conditions is met: the second label of the candidate cigarette is a foggy cigarette; the first label of the candidate cigarette is a cigarette, and the second label is a fog-free cigarette.
[0105] Specifically, after determining the first label and the second label of each candidate cigarette, each candidate cigarette can be judged according to the first label and the second label of each candidate cigarette. Exemplarily, if the second label of any candidate cigarette is a fogged cigarette, then no matter the first label of the candidate cigarette is a cigarette or a non-cigarette, the candidate cigarette is determined to be the target cigarette; if the first label of any candidate cigarette is a cigarette and the second label is a non-fog cigarette, then the candidate cigarette is determined to be the target cigarette.
[0106] It should be noted that the confidence thresholds of the first label and the second label can be preset, and for each candidate cigarette, the first label and the second label of each candidate cigarette are compared with the preset confidence threshold, and if the confidence corresponding to the first label and / or the second label of the candidate cigarette is less than the confidence threshold, the candidate cigarette is deleted. For example, if the confidence corresponding to the first label of any candidate cigarette is 0.4, the confidence of the second label is 0.7, and the preset confidence threshold is 0.5, it can be determined that the first confidence of the candidate cigarette is less than the confidence threshold, and then the candidate cigarette is deleted to ensure the credibility of each candidate cigarette determined, thereby improving the accuracy of determining the target cigarette from multiple candidate cigarettes.
[0107] In the disclosed embodiment, a grayscale image and a binary enhanced image corresponding to the image to be identified are generated, and the first label of at least one candidate cigarette is identified from the image to be identified according to the image to be identified, the grayscale image and the binary enhanced image through a cigarette detection model; then, the first cropped image corresponding to each candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image are detected by the cigarette recognition model to determine the second label of each candidate cigarette; then, the target cigarette is determined according to the first label and the second label of each candidate cigarette. This solution can more accurately determine the candidate cigarettes and the labels corresponding to each candidate cigarette from the image to be identified through the collaborative cooperation between the cigarette detection model and the cigarette recognition model, and then perform the final target cigarette identification based on the label of each candidate cigarette, which can significantly improve the accuracy and reliability of identification and reduce the false recognition rate and missed recognition rate.
[0108] Based on the above embodiments, in an exemplary embodiment, Figure 3 As shown, a feasible implementation method is provided for generating a binary enhanced image corresponding to the image to be identified in the above S101, which specifically includes the following steps:
[0109] S301, binarizing the image to be recognized to generate a binary image.
[0110] Optionally, after obtaining the image to be identified, the image to be identified can be binarized by using methods such as the OTSU method, the dynamic threshold method, and the Sobel operator edge detection method, thereby generating a binary image corresponding to the image to be identified.
[0111] S302 , for each pixel point in the binary image, according to the pixel value of the pixel point, performing enhancement processing on the binary image to generate a binary enhanced image corresponding to the image to be identified.
[0112] Optionally, after obtaining the binary image corresponding to the image to be identified, each pixel point in the binary image may be enhanced by performing pixel value enhancement processing on each pixel point, thereby generating a binary enhanced image corresponding to the image to be identified.
[0113] Exemplarily, when the binary image corresponding to the generated image to be identified is an image marked with 0 and 1 states, for each pixel point with a pixel value of 0 in the binary image, the pixel value of the pixel point can be set to a first value, and for each pixel point with a pixel value of 1 in the binary image, the pixel value of the pixel point can be set to a second value, so as to obtain a binary enhanced image corresponding to the image to be identified, wherein the first value is less than 0 and the second value is greater than 1.
[0114] The first value is a negative number, and the second value is a positive number.
[0115] For example, for each pixel point with a pixel value of 0 in the binary image, the pixel value of the pixel point can be set to -15; for each pixel point with a pixel value of 1 in the binary image, the pixel value of the pixel point can be set to 20, thereby generating a binary enhanced image corresponding to the image to be identified.
[0116] It can be understood that by setting the pixel value of each pixel point with a pixel value of 0 in the binary image to a first value, and setting the pixel value of each pixel point with a pixel value of 1 in the binary image to a second value, the binary image can be enhanced to a certain extent, thereby more efficiently and accurately generating a binary enhanced image corresponding to the image to be identified.
[0117] In this embodiment, by binarizing the image to be identified to generate a binary image, and then enhancing the binary image according to the pixel value of each pixel in the binary image, a binary enhanced image corresponding to the image to be identified can be generated more efficiently and accurately, thereby using the binary enhanced image and the image to be identified to improve the accuracy of cigarette identification.
[0118] In an exemplary embodiment, Figure 4 As shown, the above S103 is refined, and specifically includes the following steps:
[0119] S401, inputting the first cropped image corresponding to the candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image into a cigarette recognition model, and determining the confidence corresponding to each label of the candidate cigarette through each activation function in the cigarette recognition model.
[0120] Among them, the output layer in the cigarette recognition model includes multiple activation functions.
[0121] Optionally, the first cropped image corresponding to the candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image can be input into the cigarette recognition model, and each activation function in the cigarette detection model detects the candidate cigarette, and determines the confidence corresponding to each label of the candidate cigarette output by each activation function. For example, the cigarette recognition model includes activation function a, activation function b and activation function c, and each activation function determines the confidence corresponding to each label for the candidate cigarette, that is, activation function a detects the candidate cigarette and determines that the confidence of the candidate cigarette labeled as a foggy cigarette is p a1 , the confidence level of the label "non-fogging cigarette" is p a2 , the confidence level of the label being non-cigarette is p a3 ; The activation function b detects the candidate cigarettes and determines that the confidence level of the candidate cigarettes labeled as foggy cigarettes is p b1 , the confidence level of the label "non-fogging cigarette" is p b2 , the confidence level of the label being non-cigarette is p b3 ; The activation function c detects the candidate cigarettes and determines that the confidence level of the candidate cigarettes labeled as foggy cigarettes is p c1 , the confidence level of the label "non-fogging cigarette" is p c2 , the confidence level of the label being non-cigarette is p c3 .
[0122] S402: For each label of the candidate cigarette, a weighted average of the confidences corresponding to the label determined by each activation function is used as a final confidence corresponding to the label.
[0123] Optionally, after determining the confidence of each label of the candidate cigarette, the weight corresponding to each activation function can be determined, so as to determine the weighted average of the confidences corresponding to each label of the candidate cigarette, and use the weighted average as the final confidence corresponding to the label.
[0124] For example, if the weight of activation function a is determined to be 0.5, the weight of activation function b is determined to be 0.2, and the weight of activation function c is determined to be 0.3, the final confidence of each label of the candidate cigarette can be determined by the following formula 1.
[0125] p final =0.5p a +0.2p b +0.3p c (1)
[0126] Among them, p final Refers to the final confidence of any label in the candidate cigarettes.
[0127] S403: Use the label with the highest final confidence as the second label of the candidate cigarette.
[0128] Optionally, after determining the final confidence of each label in the candidate cigarette, the label with the highest final confidence can be used as the second label of the candidate cigarette. For example, if the final confidence of the candidate cigarette labeled as foggy cigarette is 0.58, the final confidence of the label labeled as non-fog cigarette is 0.22, and the final confidence of the label labeled as non-cigarette is 0.2, then the second label of the candidate cigarette can be determined to be foggy cigarette.
[0129] In this embodiment, the first cropped image and the second cropped image of the candidate cigarette are input into the cigarette recognition model, and the confidence corresponding to each label of the candidate cigarette is determined through multiple activation functions in the cigarette recognition model. Then, for each label, the weighted average of the confidence corresponding to the label determined by each activation function is used as the final confidence corresponding to the label, and the label with the highest final confidence is used as the second label of the candidate cigarette. The second label of the candidate cigarette can be determined more accurately and reasonably, thereby improving the accuracy of finally determining the target cigarette from the candidate cigarettes and avoiding the occurrence of misidentification and missed identification.
[0130] In an exemplary embodiment, Figure 5 As shown, the cigarette identification method further includes the following steps:
[0131] S501, for each candidate cigarette, inputting a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the binary enhanced image into the feature vector extraction model to obtain a target feature vector of the candidate cigarette.
[0132] The feature vector extraction model refers to a model for extracting feature vectors of the first cropped image and the second cropped image of the candidate cigarette. The target feature vector refers to a feature vector determined by fusing multiple feature vectors extracted from the first cropped image and the second cropped image.
[0133] Optionally, for each candidate cigarette, the first cropped image and the second cropped image of the candidate cigarette can be input into a feature vector extraction model, and multiple feature vectors can be extracted from the first cropped image and the second cropped image respectively through the feature vector extraction model. Then, the multiple feature vectors extracted can be fused through weighted averaging, deep learning and other methods to determine the target feature vector of the candidate cigarette.
[0134] S502, for each candidate cigarette, compare the target feature vector of the candidate cigarette with each standard feature vector in the cigarette feature library, and determine the third label of the candidate cigarette according to the similarity between the target feature vector and each standard feature vector.
[0135] The third label includes fogging cigarettes, fog-free cigarettes and similar cigarettes, and the similar cigarettes include chalk and student pens. The cigarette feature library refers to a pre-set database for storing feature vectors labeled as fogging cigarettes, fog-free cigarettes and similar cigarettes, and the standard feature vector refers to a feature vector pre-stored in the cigarette feature library.
[0136] Optionally, after determining the target feature vector of each candidate cigarette, for each candidate cigarette, the target feature vector of the candidate cigarette can be compared with each standard feature vector in the cigarette feature library to determine the similarity between the target feature vector of the candidate cigarette and each standard feature vector; further, the label corresponding to the standard feature vector with the highest similarity to the target feature vector of the candidate cigarette can be used as the third label of the candidate cigarette.
[0137] On the basis of the above embodiment, in an exemplary embodiment, an implementable method is provided for the above S104, and a target cigarette can be determined from the at least one candidate cigarette according to the first label, the second label and the third label of each candidate cigarette.
[0138] Optionally, after determining the third label of each candidate cigarette, the first label and the second label of each candidate cigarette may be combined to jointly determine whether the candidate cigarette is a target cigarette. Exemplarily, the candidate cigarette may be determined to be a target cigarette if any of the following conditions are met: at least one of the second label and the third label of the candidate cigarette contains fog; the first label of the candidate cigarette is a cigarette, and the second label or the third label is a non-fogging cigarette.
[0139] Specifically, if any one of the second label and the third label of the candidate cigarette is a foggy cigarette, the candidate cigarette can be determined to be the target cigarette; if neither the second label nor the third label of the candidate cigarette is a foggy cigarette, then if the first label of the candidate cigarette is a cigarette, and any one of the second label and the third label is a fog-free cigarette, then the candidate cigarette can be determined to be the target cigarette.
[0140] It can be understood that by introducing a feature vector extraction model, the feature vector extraction model performs feature extraction on the first cropped image and the second cropped image of each candidate cigarette, thereby determining the target feature vector of each candidate cigarette; further, the target feature vector is compared with each standard feature vector in the cigarette feature library to determine the standard feature vector with the highest similarity to the target feature vector, and the label of the standard feature vector is used as the third label of the target feature vector, so that the third label of each candidate cigarette can be determined more accurately and reasonably, and then according to the first label, second label and third label of each candidate cigarette, it is possible to improve the accuracy and efficiency of determining whether each candidate cigarette is a target cigarette, thereby avoiding misidentification and missed identification.
[0141] Corresponding to the embodiments of the aforementioned method, the present disclosure also provides embodiments of a device and a terminal to which the device is applied.
[0142] Second, as Figure 6 As shown, the present application also provides a cigarette identification device, comprising:
[0143] The image generation module 601 is used to generate a grayscale image and a binary enhanced image corresponding to the image to be identified according to the image to be identified;
[0144] The label determination module 602 is used to input the image to be identified, the grayscale image and the binary enhanced image into the cigarette detection model, and determine the coordinate position and the first label of at least one candidate cigarette from the image to be identified, wherein the first label includes a cigarette label and a cigarette-like label;
[0145] The label acquisition module 603 is used to input, for each candidate cigarette, a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the candidate cigarette in the binary enhanced image into a cigarette recognition model to obtain a second label determined by the cigarette recognition model for the candidate cigarette, wherein the second label includes a fogged cigarette, a non-fog cigarette, and a non-cigarette;
[0146] The target determination module 604 is configured to determine a target cigarette from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette.
[0147] In one embodiment, the image generation module 601 is specifically used for:
[0148] Binarize the image to be recognized to generate a binary image;
[0149] For each pixel point in the binary image, the binary image is enhanced according to the pixel value of the pixel point to generate a binary enhanced image corresponding to the image to be identified.
[0150] In one embodiment, the image generation module 601 is specifically used for:
[0151] For each pixel point with a pixel value of 0 in the binary image, the pixel value of the pixel point is set to a first value, and for each pixel point with a pixel value of 1 in the binary image, the pixel value of the pixel point is set to a second value, so as to obtain a binary enhanced image corresponding to the image to be identified, wherein the first value is less than 0 and the second value is greater than 1.
[0152] In one embodiment, the tag determination module 602 is specifically used to:
[0153] Inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determining a label of each object in the image to be identified based on the cigarette detection model, wherein the label includes cigarette, quasi-cigarette and non-cigarette;
[0154] At least one object labeled as a cigarette or a cigarette-like object in the image to be identified is taken as a candidate cigarette, and the coordinate position and the first label of the candidate cigarette are output.
[0155] In one embodiment, the tag acquisition module 603 is specifically used to:
[0156] Inputting the first cropped image corresponding to the candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image into a cigarette recognition model, and determining the confidence corresponding to each label of the candidate cigarette through each activation function in the cigarette recognition model;
[0157] For each label of the candidate cigarette, taking the weighted average of the confidences corresponding to the label determined by each activation function as the final confidence corresponding to the label;
[0158] The label with the highest final confidence is used as the second label of the candidate cigarette.
[0159] In one embodiment, the target determination module 604 is specifically used to:
[0160] The candidate cigarette is determined to be a target cigarette when any of the following conditions is met:
[0161] The second label of the candidate cigarette is a foggy cigarette;
[0162] The first label of the candidate cigarette is a cigarette, and the second label is a non-fogging cigarette.
[0163] In one embodiment, the cigarette identification device further comprises:
[0164] A feature comparison module, for each candidate cigarette, inputting a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the binary enhanced image into the feature vector extraction model to obtain a target feature vector of the candidate cigarette;
[0165] For each candidate cigarette, compare the target feature vector of the candidate cigarette with each standard feature vector in the cigarette feature library, and determine the third label of the candidate cigarette according to the similarity between the target feature vector and each standard feature vector, wherein the third label includes fogging cigarettes, fog-free cigarettes and similar cigarettes, and the similar cigarettes include chalk and student pens;
[0166] The target determination module 604 is specifically used for:
[0167] A target cigarette is determined from the at least one candidate cigarette according to the first label, the second label and the third label of each candidate cigarette.
[0168] In one embodiment, the target determination module 604 is specifically used to:
[0169] The candidate cigarette is determined to be a target cigarette when any of the following conditions is met:
[0170] There is at least one fogged cigarette in the second label and the third label of the candidate cigarette;
[0171] The first label of the candidate cigarette is a cigarette, and the second label or the third label is a non-fogging cigarette.
[0172] In one embodiment, the cigarette identification device further comprises:
[0173] The cigarette deletion module is used to delete each candidate cigarette if the confidence corresponding to the first label and / or the second label of the candidate cigarette is less than a confidence threshold.
[0174] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.
[0175] A third aspect of the present disclosure provides a computer program product, including a computer program / instruction, which implements the method described in the first aspect when executed by a processor.
[0176] For the device embodiments and computer program product embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. In addition, the device embodiments described above are merely schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the disclosed solution. Those of ordinary skill in the art can understand and implement it without paying creative labor.
[0177] In a fourth aspect, the embodiments of the cigarette identification device provided by the present disclosure can be applied to computer equipment. Figure 7 , which exemplarily shows a hardware schematic diagram of a computer device. For example, device 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0178] Device 700 may include one or more of the following components: a processing component 701 , a memory 702 , a power component 703 , a multimedia component 704 , an audio component 705 , an input / output (I / O) interface 706 , a sensor component 707 , and a communication component 708 .
[0179] The processing component 701 generally controls the overall actions of the device 700, such as actions associated with display, phone calls, data communications, camera actions, and recording actions. The processing component 701 may include one or more processors 709 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 701 may include one or more modules to facilitate the interaction between the processing component 701 and other components. For example, the processing component 701 may include a multimedia module to facilitate the interaction between the multimedia component 704 and the processing component 701.
[0180] The memory 702 is configured to store various types of data to support operations on the device 700. Examples of such data include instructions for any application or method operating on the device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0181] The power component 703 provides power to the various components of the device 700. The power component 703 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 700.
[0182] The multimedia component 704 includes a screen providing an output interface between the device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide action. In some embodiments, the multimedia component 704 includes a front camera and / or a rear camera. When the device 700 is in an action mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0183] The audio component 705 is configured to output and / or input audio signals. For example, the audio component 705 includes a microphone (MIC), and when the device 700 is in an action mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 702 or sent via the communication component 708. In some embodiments, the audio component 705 also includes a speaker for outputting audio signals.
[0184] I / O interface 706 provides an interface between processing component 701 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0185] The sensor assembly 707 includes one or more sensors for providing various aspects of status assessment for the device 700. For example, the sensor assembly 707 can detect the open / closed state of the device 700, the relative positioning of components, such as the display and keypad of the device 700, and the sensor assembly 707 can also detect the position change of the device 700 or a component of the device 700, the presence or absence of user contact with the device 700, the orientation or acceleration / deceleration of the device 700, and the temperature change of the device 700. The sensor assembly 707 can also include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 707 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 707 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0186] The communication component 708 is configured to facilitate wired or wireless communication between the device 700 and other devices. The device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G or 5G or a combination thereof. In an exemplary embodiment, the communication component 708 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 708 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0187] In an exemplary embodiment, the device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to execute the cigarette identification method of the above-mentioned computer device.
[0188] In a fifth aspect, the present disclosure, in an exemplary embodiment, further provides a non-transitory computer-readable storage medium including instructions, such as a memory 702 including instructions, and the instructions can be executed by a processor 709 of a device 700 to complete the cigarette identification method of the computer device. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0189] The above describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0190] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the inventions claimed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not claimed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0191] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0192] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the scope of protection of the present disclosure.
Claims
1. A cigarette identification method, characterized in that: The method comprises: According to the image to be identified, a grayscale image and a binary enhanced image corresponding to the image to be identified are generated; Inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, determining the coordinate position and a first label of at least one candidate cigarette from the image to be identified, wherein the first label includes a cigarette label and a cigarette-like label; For each candidate cigarette, a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the candidate cigarette in the binary enhanced image are input into a cigarette recognition model to obtain a second label determined by the cigarette recognition model for the candidate cigarette, wherein the second label includes a fogged cigarette, a non-fog cigarette, and a non-cigarette; A target cigarette is determined from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette.
2. The method according to claim 1, characterized in that The step of generating a binary enhanced image corresponding to the image to be identified according to the image to be identified includes: Binarize the image to be recognized to generate a binary image; For each pixel point in the binary image, the binary image is enhanced according to the pixel value of the pixel point to generate a binary enhanced image corresponding to the image to be identified.
3. The method according to claim 2, characterized in that The step of performing enhancement processing on each pixel point in the binary image according to the pixel value of the pixel point to generate a binary enhanced image corresponding to the image to be identified includes: For each pixel point with a pixel value of 0 in the binary image, the pixel value of the pixel point is set to a first value, and for each pixel point with a pixel value of 1 in the binary image, the pixel value of the pixel point is set to a second value, so as to obtain a binary enhanced image corresponding to the image to be identified, wherein the first value is less than 0 and the second value is greater than 1.
4. The method according to claim 1, characterized in that: The step of inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determining the coordinate position and the first label of at least one candidate cigarette from the image to be identified comprises: Inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determining a label of each object in the image to be identified based on the cigarette detection model, wherein the label includes cigarette, quasi-cigarette and non-cigarette; At least one object labeled as a cigarette or a cigarette-like object in the image to be identified is taken as a candidate cigarette, and the coordinate position and the first label of the candidate cigarette are output.
5. The method according to claim 1, characterized in that The step of inputting a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the binary enhanced image into a cigarette recognition model to obtain a second label determined by the cigarette recognition model for the candidate cigarette includes: Inputting the first cropped image corresponding to the candidate cigarette in the image to be identified and the second cropped image corresponding to the binary enhanced image into a cigarette recognition model, and determining the confidence corresponding to each label of the candidate cigarette through each activation function in the cigarette recognition model; For each label of the candidate cigarette, taking the weighted average of the confidences corresponding to the label determined by each activation function as the final confidence corresponding to the label; The label with the highest final confidence is used as the second label of the candidate cigarette.
6. The method according to claim 1, characterized in that The step of determining a target cigarette from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette comprises: The candidate cigarette is determined as the target cigarette when any of the following conditions is met: The second label of the candidate cigarette is a foggy cigarette; The first label of the candidate cigarette is a cigarette, and the second label is a non-fogging cigarette.
7. The method according to claim 1, characterized in that The method further comprises: For each candidate cigarette, inputting a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the binary enhanced image into the feature vector extraction model to obtain a target feature vector of the candidate cigarette; For each candidate cigarette, compare the target feature vector of the candidate cigarette with each standard feature vector in the cigarette feature library, and determine the third label of the candidate cigarette according to the similarity between the target feature vector and each standard feature vector, wherein the third label includes fogging cigarettes, fog-free cigarettes and similar cigarettes, and the similar cigarettes include chalk and student pens; The step of determining a target cigarette from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette comprises: A target cigarette is determined from the at least one candidate cigarette according to the first label, the second label and the third label of each candidate cigarette.
8. The method according to claim 7, characterized in that The step of determining a target cigarette from the at least one candidate cigarette according to the first label, the second label, and the third label of each candidate cigarette comprises: The candidate cigarette is determined as the target cigarette when any of the following conditions is met: There is at least one fogged cigarette in the second label and the third label of the candidate cigarette; The first label of the candidate cigarette is a cigarette, and the second label or the third label is a non-fogging cigarette.
9. The method according to claim 1, characterized in that: The method further comprises: For each candidate cigarette, if the confidence corresponding to the first label and / or the second label of the candidate cigarette is less than a confidence threshold, the candidate cigarette is deleted.
10. A cigarette identification device, characterized in that: The device comprises: An image generation module, used to generate a grayscale image and a binary enhanced image corresponding to the image to be identified according to the image to be identified; a label determination module, used for inputting the image to be identified, the grayscale image and the binary enhanced image into a cigarette detection model, and determining the coordinate position and a first label of at least one candidate cigarette from the image to be identified, wherein the first label includes a cigarette label and a cigarette-like label; a label acquisition module, for each candidate cigarette, inputting a first cropped image corresponding to the candidate cigarette in the image to be identified and a second cropped image corresponding to the candidate cigarette in the binary enhanced image into a cigarette recognition model to obtain a second label determined by the cigarette recognition model for the candidate cigarette, wherein the second label includes a fogged cigarette, a non-fog cigarette, and a non-cigarette; The target determination module is used to determine a target cigarette from the at least one candidate cigarette according to the first label and the second label of each candidate cigarette.
11. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
12. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 9 is implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.