Cigarette combustion carbon thread detection method and system based on parallel mixed attention mechanism
By adopting the parallel mixing attention mechanism and the rapid pooling module of the characteristic pyramid in the detection of cigarette combustion carbon lines, the problem of low accuracy of the existing detection methods in variable lighting and complex backgrounds is solved, and high-precision carbon line detection is achieved to meet the needs of cigarette quality control and production optimization.
Patent Information
- Application Number
- CN202411893922.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-03-28
AI Technical Summary
The existing cigarette combustion carbon line detection method has low detection accuracy under variable light and complex background conditions, and cannot achieve industrial-grade detection accuracy, making it difficult to meet the needs of cigarette quality control and production optimization.
The cigarette combustion carbon line detection method and system based on the parallel mixed attention mechanism is adopted. The detection model is constructed by combining three attention mechanisms: channel, space and coordinates, and combined with the feature pyramid rapid pooling module and the effective cross-crossing loss function to achieve high-precision detection of carbon lines.
It improves the accuracy and stability of cigarette combustion carbon line detection, and can accurately identify carbon line characteristics under variable light and complex background conditions, meeting the needs of cigarette quality control and production optimization.
Smart Images

Figure CN119722647A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cigarette detection, and in particular to a cigarette burning charcoal line detection method and system based on a parallel hybrid attention mechanism. Background Art
[0002] As a tobacco product widely consumed around the world, the quality of cigarettes directly affects the consumer experience. The apparent burning quality of cigarettes, especially the performance of the cigarette charcoal line, is one of the key factors affecting the quality of cigarette smoking. As the cigarette market becomes increasingly mature, consumers have higher and higher requirements for the smoking experience of cigarettes. The detection of burning charcoal lines helps to evaluate the matching of cigarette paper and tobacco when cigarettes are burning, thereby improving the smoothness of smoking and the comfort of the taste of cigarettes. When the cigarette is burning and inhaled, under the control of the smoking system, the cigarette regularly presents two states of burning and smoldering. The width and uniformity of the cigarette burning charcoal line vary with the burning length of the cigarette. During the puff interval, the cigarette is in a smoldering state, the ash column temperature is low, the charcoal line at the bottom of the ash column is narrow, and the charcoal line is gray-black in color. Figure 1a During the duration of the puff, the cigarette burns completely, the char line is wide, and the ash and char line appear red due to burning. Figure 1b As shown in the figure, the color of the ash area changes rapidly with the temperature. Real-time acquisition of ash images during the combustion process and detection of the state of the burning char line are helpful to evaluate the temperature, uniformity and rate of cigarette combustion, and provide a scientific basis for the adjustment of cigarette formula and improvement of production process, so as to achieve the purpose of optimizing cigarette combustion characteristics.
[0003] The burning charcoal line of a cigarette plays an important role in the burning process of a cigarette. As the cigarette burns and is smoked, the burning charcoal line will continue to move backward along the cigarette toward the filter tip. This is because during the smoking process, the cigarette paper and tobacco are ignited and continue to burn, forming an obvious carbonization line, namely the burning charcoal line. The burning charcoal line may be extinguished, burn unevenly or burn too fast. The shape of the burning charcoal line is not fixed, but is affected by many factors such as the suction force, air flow, the quality of the cigarette paper, the moisture and density of the tobacco; during the smoking process, the charcoal line may show different morphological changes such as wavy and jagged. In the early stage of lighting a cigarette, the burning charcoal line usually appears black or dark brown due to the rapid carbonization of the cigarette paper and tobacco at high temperature. As the burning progresses, the coke on the surface of the charcoal line may gradually be burned off. Combined with the burning of tobacco and cigarette paper, the cigarette is in different degrees of burning state, and the heat and chemical reactions generated are also different. The color of the burning charcoal line will gradually change, showing different tones. In summary, the burning charcoal line of cigarettes has the characteristics of dynamic movement, large morphological differences and color changes during the smoking process, which poses challenges to the commonly used detection methods.
[0004] The currently commonly used method for identifying burning charcoal lines is to locate the burning lines by extracting the region of interest, performing grayscale value segmentation, and morphological analysis. These methods have the following problems in practical applications: ① When the lighting conditions and background of the detection system change, the key parameters of the algorithm need to be repeatedly tested and adjusted; ② The target tracking accuracy, stability and efficiency are low during real-time detection; ③ The detection algorithm cannot be replicated in other systems, which is not conducive to the formulation of a unified standard detection method.
[0005] With the development of deep learning technology and computer computing power, deep learning target detection methods are widely used in various scenarios for defect detection, target recognition and other tasks. They are widely used in multiple tobacco detection scenarios such as cigarette packaging defect detection, tobacco component identification, cigarette box detection and classification. In various cigarette combustion performance detection tasks, the common characteristics of cigarette burning charcoal lines are small targets, large numbers, different scales and shapes of burning lines, and some complex backgrounds. Mainstream target detection algorithms cannot achieve industrial-level detection accuracy, and are prone to losing targets or inaccurate positioning, which limits the application of deep learning target detection methods in cigarette combustion quality detection.
[0006] In view of this, the inventor, based on many years of experience in production design in this field and related fields, has designed a cigarette burning charcoal line detection method and system based on a parallel hybrid attention mechanism after repeated experiments, in order to solve the problems existing in the prior art. Summary of the invention
[0007] The purpose of the present invention is to provide a method and system for detecting cigarette burning charcoal lines based on a parallel hybrid attention mechanism, which can effectively improve the accuracy and stability of cigarette burning charcoal line detection.
[0008] To achieve the above-mentioned invention object, the present invention proposes a method and system for detecting burning charcoal lines of cigarettes based on a parallel hybrid attention mechanism, wherein multi-dimensional image data of the entire cigarette burning process is collected and pre-processed;
[0009] A detection model for cigarette burning charcoal lines based on a parallel hybrid attention mechanism is constructed. The detection model for cigarette burning charcoal lines is embedded with a parallel hybrid attention mechanism, which includes a channel attention mechanism, a spatial attention mechanism, and a coordinate attention mechanism.
[0010] The pre-processed multi-dimensional image data is input into a detection model of a cigarette burning charcoal line and the detection model of a cigarette burning charcoal line is trained;
[0011] The trained cigarette burning charcoal line detection model is used to detect the cigarette burning charcoal line during the entire cigarette burning process.
[0012] The present invention also proposes a system for implementing a cigarette burning charcoal line detection method based on a hybrid attention mechanism, wherein the system comprises:
[0013] An image acquisition module, used to collect multi-dimensional image data at different time points during the cigarette burning process in real time;
[0014] A data processing module, used to perform the image preprocessing steps in the method, including color calibration, illumination uniformity adjustment and image denoising;
[0015] The YOLO network module with parallel hybrid attention mechanism receives the preprocessed image data and combines the three attention mechanisms of channel, space and coordinate to detect the char lines of cigarettes;
[0016] The feature extraction and matching module, combined with the feature pyramid fast pooling module, extracts and matches the multi-scale features of the carbon line target;
[0017] The output module is used to output the carbon line detection results in real time, including the visualization images and numerical analysis results of the carbon line width, uniformity and crack area.
[0018] The present invention also provides a computer-readable storage medium, wherein a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0019] The present invention further provides a computer device, comprising a memory and a processor, wherein a computer program that can be run on the processor is stored in the memory, wherein the steps of the above method are implemented when the processor executes the computer program.
[0020] Compared with the prior art, the present invention has the following characteristics and advantages:
[0021] The cigarette burning charcoal line detection method and system based on parallel hybrid attention mechanism proposed in the present invention can improve the detection accuracy of charcoal lines under variable lighting and complex background conditions by integrating three attention mechanisms: channel, space and coordinate. It can effectively address the shortcomings of traditional methods under environmental changes, and provide a scientific basis for cigarette formula adjustment and production process improvement, thereby optimizing cigarette combustion characteristics and meeting consumers' demand for high-quality cigarettes. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings described herein are only for explanation purposes and are not intended to limit the scope of the present invention in any way. In addition, the shapes and proportional dimensions of the various components in the figures are only schematic, used to help understand the present invention, and are not specifically limited to the shapes and proportional dimensions of the various components of the present invention. Those skilled in the art can select various possible shapes and proportional dimensions to implement the present invention according to the teachings of the present invention.
[0023] Figure 1a The puff interval image of the cigarette combustion process of the present invention;
[0024] Figure 1b The image of the cigarette combustion process of the present invention during inhalation;
[0025] Figure 2 Schematic diagram of the PHAM-YOLO network model structure;
[0026] Figure 3a Schematic diagram of the overall structure of the parallel hybrid attention mechanism PHAM;
[0027] Figure 3b Schematic diagram of the channel attention module of the parallel hybrid attention mechanism PHAM;
[0028] Figure 3c Schematic diagram of the spatial attention module of the parallel hybrid attention mechanism PHAM;
[0029] Figure 3d Schematic diagram of the coordinate attention module of the parallel hybrid attention mechanism PHAM;
[0030] Figure 4 It is the schematic diagram of SPPF structure;
[0031] Figure 5 It is a schematic diagram of the average precision mean;
[0032] Figure 6a This is a burning charcoal line detection scene diagram for a free burning test of a conventional cigarette;
[0033] Figure 6b This is a burning charcoal line detection scene diagram for a free burning test of slim cigarettes;
[0034] Figure 6c A diagram of the burning charcoal line detection scene for testing the falling tendency of slim cigarettes;
[0035] Figure 6d A burning charcoal line detection scene diagram for a free burning test of a cigarette;
[0036] Figure 6e is the PR curve of cigarettes;
[0037] Figure 7 Schematic diagram of the cigarette burning charcoal line detection method based on the parallel hybrid attention mechanism of the present invention. DETAILED DESCRIPTION
[0038] The details of the present invention can be more clearly understood with reference to the accompanying drawings and the description of the specific embodiments of the present invention. However, the specific embodiments of the present invention described herein are only used for the purpose of explaining the present invention and cannot be understood as limiting the present invention in any way. Under the guidance of the present invention, technicians can conceive of any possible variations based on the present invention, which should all be considered to belong to the scope of the present invention.
[0039] The present invention proposes a cigarette burning char line detection method and system based on a parallel hybrid attention mechanism, which collects multi-dimensional image data of the entire cigarette burning process and pre-processes the multi-dimensional image data;
[0040] A detection model for cigarette burning charcoal lines based on a parallel hybrid attention mechanism is constructed. The detection model for cigarette burning charcoal lines is embedded with a parallel hybrid attention mechanism, which includes a channel attention mechanism, a spatial attention mechanism, and a coordinate attention mechanism.
[0041] The pre-processed multi-dimensional image data is input into a detection model of a cigarette burning charcoal line and the detection model of a cigarette burning charcoal line is trained;
[0042] The trained cigarette burning charcoal line detection model is used to detect the cigarette burning charcoal line during the entire cigarette burning process.
[0043] The present invention proposes a method and system for detecting burning charcoal lines of cigarettes based on a parallel hybrid attention mechanism. By collecting and preprocessing multi-dimensional image data of the entire process of cigarette burning, and constructing a detection model embedded with a parallel hybrid attention mechanism, high-precision detection of burning charcoal lines of cigarettes is achieved. The three attention mechanisms of channel, space, and coordinates are used to improve the model's ability to recognize charcoal line features under complex backgrounds, and the accuracy and stability of detection are further enhanced through model training. Finally, real-time and accurate tracking and identification of burning charcoal lines of cigarettes are achieved, providing strong technical support for cigarette quality control and production optimization.
[0044] In an optional implementation of the present invention, preprocessing the multi-dimensional image data at least includes color calibration, illumination uniformity adjustment and image denoising of the multi-dimensional image.
[0045] Specifically, the color calibration step ensures that the color deviation caused by different lighting conditions or equipment differences during the image acquisition process is corrected, making the color information in the image more accurate and consistent. The illumination uniformity adjustment step optimizes the problem of uneven illumination in the image. By adjusting the illumination intensity and distribution, the brightness and contrast of the image are more balanced, thereby improving the accuracy of subsequent feature extraction. The image denoising step enhances the quality and effectiveness of the image by applying a noise filtering algorithm to remove random noise and interference factors such as smoke and dust in the image. The preprocessing step is performed through multi-dimensional image data, and a noise filtering algorithm is applied to remove random noise and interference factors such as smoke and dust in the image, thereby enhancing the quality and effectiveness of the image. These preprocessing steps together ensure the stability and consistency of the image data, providing high-quality image data for subsequent charcoal line detection.
[0046] In an optional example of this implementation, collecting multi-dimensional image data of the entire cigarette burning process includes: real-time monitoring of ambient light changes during cigarette burning, and adjusting the collection strategy based on the real-time ambient light changes.
[0047] Specifically, the changes in ambient light during cigarette burning are monitored in real time, using specific sensors or image analysis algorithms to capture real-time changes in light intensity and spectral distribution. These data are then used to adjust the image acquisition strategy, and the system can also adjust the white balance according to the spectral composition of the light to ensure the true reproduction of image color. Through this dynamic adjustment strategy based on real-time ambient light changes, the collected image data can more accurately reflect the actual situation of cigarette burning, providing high-quality image input for subsequent char line detection.
[0048] In an optional embodiment of the present invention, the detection model of cigarette burning charcoal lines extracts and matches charcoal line features in multi-dimensional image data multiple times by applying a feature pyramid fast pooling module.
[0049] Specifically, the feature pyramid fast pooling module can extract and match the features of carbon line targets of different scales, and improve the recognition ability of multi-scale carbon line targets. By performing multi-layer pooling operations on multi-dimensional image data, the feature information at different levels is effectively integrated, thereby capturing the subtle features of carbon lines.
[0050] In an optional embodiment of the present invention, the detection model of the burning charcoal line of the cigarette uses an effective intersection-over-union loss function to regress the charcoal line detection bounding box to achieve tracking and positioning of the charcoal line during the dynamic burning process.
[0051] Specifically, during the dynamic burning process, the technology of regressing the char line detection bounding box using the effective intersection over union (EIOU) loss function is used to accurately track and locate the char line through the cigarette burning char line detection model with a parallel hybrid attention mechanism. The EIOU loss function comprehensively considers the overlapping area, the distance between the center points, and the actual width and height difference, thereby optimizing the regression process of the detection bounding box. During the training phase, the EIOU loss between the predicted bounding box and the true bounding box of the neural network model is calculated and used for back propagation to update the model weights. This process enables the model to automatically adjust, reduce detection errors, and improve the accuracy of char line detection, especially the detection errors caused by changes in the burning state in the char line area, ensuring stable tracking and precise positioning of the char line during the dynamic burning process.
[0052] In an optional embodiment of the present invention, the RGB channels in the multi-dimensional image data are dynamically weighted through a channel attention mechanism and a channel attention feature map is obtained.
[0053] Specifically, the RGB channels of the cigarette burning image are analyzed to determine the importance of each channel in char line detection. Subsequently, through a dynamic weighting strategy, the system can automatically adjust the weight of each channel according to changes in image content and environmental conditions to strengthen the response to char line features. This weighting process takes into account color changes under different lighting and background conditions, ensuring that char line features can be accurately extracted in various environments. Through this mechanism, a channel attention feature map that highlights the char line area can be obtained, providing more accurate input for subsequent feature extraction and char line detection.
[0054] In an optional embodiment of the present invention, a convolutional neural network is matched with the gray column morphological changes in the multi-dimensional image data through a spatial attention mechanism to generate a spatial attention feature map.
[0055] Specifically, the multi-dimensional image data of the entire cigarette burning process is first obtained through the cigarette burning image acquisition system, and then these images are preprocessed, including color calibration, illumination uniformity adjustment, and image noise removal, to ensure the stability and consistency of the image data. Next, the preprocessed image is input into the YOLO network of the parallel hybrid attention mechanism, in which the spatial attention mechanism matches the morphological changes of the gray column through the convolutional neural network, automatically identifies the significant features in the charcoal line area of the cigarette burning, and enhances the visibility of the target in the complex background. This mechanism generates a spatial attention feature map through a 2D global pooling operation and uses a convolution kernel to reduce the channel dimension to 1, so that the charcoal line area can still be accurately identified in the case of irregular cracks in the burning ash column. By enhancing the recognition ability of the convolutional neural network for the morphological changes of the gray column, the performance of charcoal line detection is significantly improved.
[0056] In an optional embodiment of the present invention, based on a coordinate attention mechanism, char lines are located in multi-dimensional image data through time series images of cigarette burning.
[0057] Specifically, the cigarette burning charcoal line detection method based on the parallel hybrid attention mechanism of the present invention particularly includes a coordinate attention mechanism, which accurately locates the charcoal line by analyzing the time series images of cigarette burning in the multi-dimensional image data. The system first captures a series of cigarette burning images that change over time to form time series data. Then, the coordinate attention mechanism is applied to these images to accurately locate the charcoal line by identifying the position changes of the charcoal line in the image and combining the dynamic change trend of the charcoal line. This mechanism uses geometric features to optimize the positioning of the charcoal line target, ensuring the precise match between the detection frame and the actual charcoal line, thereby achieving accurate tracking and positioning of the charcoal line during the dynamic burning process. In this way, the coordinate attention mechanism not only improves the accuracy of charcoal line detection, but also enhances the model's adaptability to the dynamic changes of the charcoal line, making the detection results more stable and reliable.
[0058] In an optional embodiment of the present invention, a trained cigarette burning charcoal line detection model is used to detect the cigarette burning charcoal line during the entire cigarette burning process, including real-time generation of cigarette burning charcoal line detection results, and outputting the width, uniformity and crack area of the charcoal line.
[0059] Specifically, the image acquisition module collects multi-dimensional image data at different time points during the cigarette burning process in real time. Subsequently, these data are fed into the trained cigarette burning char line detection model, which integrates three attention mechanisms: channel, space, and coordinates to improve the accuracy of char line detection. The cigarette burning char line detection model quickly and accurately analyzes the input image data, identifies the exact location of the char line, and quantifies the characteristics of the char line, including its width, uniformity, and crack area. This information is then output in real time by the output module, providing direct technical support for quality control and process optimization in the cigarette production process.
[0060] The cigarette burning charcoal line detection method based on parallel hybrid attention mechanism proposed in this invention combines the complexity of cigarette burning process and uses a deep learning algorithm that integrates three attention mechanisms: channel, space and coordinate. Figure 7 The following steps are shown:
[0061] 1) Obtain multi-dimensional image data of the entire cigarette burning process through a cigarette burning image acquisition system;
[0062] 2) Preprocessing the acquired images, including color calibration, illumination uniformity adjustment, and image noise removal, to ensure the stability and consistency of image data;
[0063] 3) Input the preprocessed image into the YOLO network with parallel hybrid attention mechanism, where:
[0064] a) The channel attention mechanism improves the detection accuracy of cigarette char lines under different lighting and background conditions by weighting the feature maps of each channel;
[0065] b) The spatial attention mechanism is used to automatically identify the salient features in the burning charcoal line area of the cigarette and enhance the visibility of the target in the complex background;
[0066] c) The coordinate attention mechanism optimizes the positioning of the carbon line target based on geometric features to ensure the accurate matching of the detection box with the actual carbon line;
[0067] 4) Apply the feature pyramid rapid pooling module (SPPF) to extract and match the features of multi-scale carbon wire targets to improve the recognition ability of carbon wires of different sizes;
[0068] 5) Using the effective intersection over union (EIOU) loss function, the bounding box of the char line detection is regressed to ensure accurate tracking and positioning of the char line during the dynamic combustion process.
[0069] The system for implementing the cigarette burning charcoal line detection method based on the hybrid attention mechanism proposed by the present invention specifically includes:
[0070] 1. Image acquisition module includes:
[0071] A high-resolution still imaging camera used to obtain static images of the char lines during cigarette burning.
[0072] A dynamic imaging camera is used to capture real-time images of the changing char lines as a cigarette burns.
[0073] Through dual-camera collaborative imaging, the charcoal line characteristics of cigarette burning can be captured at different time points and viewing angles, ensuring clear images even under complex background conditions.
[0074] 2. Data processing module:
[0075] The collected raw image data is processed by the preprocessing module, including:
[0076] Color calibration: Use a standard color chart to calibrate the image to eliminate color deviations under different lighting conditions.
[0077] Light uniformity adjustment: According to the changes in ambient light, adjust the light uniformity of the image to ensure the clarity and consistency of the cigarette charcoal line image during the burning process.
[0078] Image denoising: Use noise filtering algorithms to remove interference factors such as smoke and ash generated during cigarette burning, thereby enhancing the quality and effectiveness of the image.
[0079] 3. YOLO network module with parallel hybrid attention mechanism
[0080] YOLO (You Only Look Once) is one of the most representative deep learning target detection algorithms. With its advantages of fast running speed and high detection accuracy, it has been successfully applied in a large number of applications. The algorithm has now developed to the eighth generation, but the more stable YOLO v5 network structure is still commonly used. Aiming at the image features of cigarette burning charcoal lines in different detection equipment scenarios such as straight lines and turntables, the parallel hybrid attention mechanism PHAM (Parallel Hybrid Attention Mechanism) is embedded in the YOLO v5 network structure to build a PHAM-YOLO network model.
[0081] Figure 2 This is a schematic diagram of the network structure of PHAM-YOLO. The PHAM-YOLO network is divided into the backbone network Backbone, the feature processing network Neck, and the target prediction network Head. Among them, CBS, Focus, and CSP are the three main convolution modules in each network: ① The CBS convolution module consists of the convolution layer Conv, the normalization layer BactchNorm2d, and the activation function SiLU; ② The Focus module downsamples and splices the initial data in alternate columns, and the original H×W×3 image is sliced into a feature map of H / 2×W / 2×12. After splicing, it undergoes a CBS convolution operation again, becoming a size of H / 2×W / 2×32. This operation can ensure that information is not lost during downsampling; ③ CSP is a residual module, CSP1 (divided into CSP1_1 and CSP1_3) is used in Backbone, and CSP2 is used in Neck. In addition, the function of the Concat module is to splice the feature map. PHAM-YOLO embeds the PHAM module in the backbone network of YOLO v5. The PHAM module contains three attention mechanisms: channel, space, and coordinates. It can effectively focus on defect features and reduce the weight input of useless background information. In addition, PHAM-YOLO also uses the pyramid fast pooling (SPPF) module to use continuous fixed convolution kernels to quickly pool the input feature map to fuse feature maps of different receptive fields to improve the expressiveness of the feature map; the bounding box regression (BBR) is used to improve the accuracy of the burning charcoal line positioning, and the EIOU (Efficient Intersection over Union) is introduced as the boundary loss function to solve the ambiguity of the CIOU (complete Intersection on Union) loss function, making the BBR regression more accurate.
[0082] 3. PHAM-YOLO network structure
[0083] YOLO (You Only Look Once) is one of the most representative deep learning target detection algorithms. With its advantages of fast running speed and high detection accuracy, it has been successfully applied in a large number of applications. The algorithm has now developed to the eighth generation, but the more stable YOLO v5 network structure is still commonly used. Aiming at the image features of cigarette burning charcoal lines in different detection equipment scenarios such as straight lines and turntables, the parallel hybrid attention mechanism PHAM (Parallel Hybrid Attention Mechanism) is embedded in the YOLO v5 network structure to build a PHAM-YOLO network model.
[0084] Figure 2 This is a schematic diagram of the network structure of PHAM-YOLO. The PHAM-YOLO network is divided into the backbone network Backbone, the feature processing network Neck, and the target prediction network Head. Among them, CBS, Focus, and CSP are the three main convolution modules in each network: ① The CBS convolution module consists of the convolution layer Conv, the normalization layer BactchNorm2d, and the activation function SiLU; ② The Focus module downsamples and splices the initial data in alternate columns, and the original H×W×3 image is sliced into a feature map of H / 2×W / 2×12. After splicing, it undergoes a CBS convolution operation again, becoming a size of H / 2×W / 2×32. This operation can ensure that information is not lost during downsampling; ③ CSP is a residual module, CSP1 (divided into CSP1_1 and CSP1_3) is used in Backbone, and CSP2 is used in Neck. In addition, the function of the Concat module is to splice the feature map. PHAM-YOLO embeds the PHAM module in the backbone network of YOLO v5. The PHAM module contains three attention mechanisms: channel, space, and coordinates. It can effectively focus on defect features and reduce the weight input of useless background information. In addition, PHAM-YOLO also uses the pyramid fast pooling (SPPF) module to use continuous fixed convolution kernels to quickly pool the input feature map to fuse feature maps of different receptive fields to improve the expressiveness of the feature map; the bounding box regression (BBR) is used to improve the accuracy of the burning charcoal line positioning, and the EIOU (Efficient Intersection over Union) is introduced as the boundary loss function to solve the ambiguity of the CIOU (complete Intersection on Union) loss function, making the BBR regression more accurate.
[0085] 4. Parallel Hybrid Attention Mechanism PHAM
[0086] The PHAM module contains three attention mechanisms: channel, space, and coordinate, which can effectively focus on defect features and reduce the weight input of useless background information. Figure 3a It is a schematic diagram of the network structure of PHAM, where the upper branch is composed of a channel attention mechanism module and a spatial attention mechanism module, and the lower branch is a coordinate attention mechanism module. Figure 3b It is the structural diagram of the channel attention mechanism module, which performs two-dimensional global maximum / average pooling operations on the initial features F to obtain two sets of feature vectors, and then transmits these two sets of feature vectors to the multi-layer perceptron (MLP) network to obtain the channel attention feature map W c (F). Figure 3c It is the structural diagram of the spatial attention mechanism module, which performs a 2D global pooling operation and uses a convolution kernel to reduce the channel dimension to 1 to generate a spatial attention feature map W. s (F). Then, W s (F) and W c (F) Convolution is performed to obtain the attention mechanism diagram W1(F) of the upper branch. The channel attention and spatial attention of the upper branch are obtained through global pooling to capture the local correlation of the feature map.
[0087] Figure 3d This is the structure diagram of the coordinate attention mechanism module of the lower branch. First, the input feature map is average pooled in the horizontal and vertical directions using convolution kernels of size (H, 1) and (1, W), respectively. The output of the c-th channel with a height of h and a width of w is:
[0088]
[0089]
[0090] By transforming formula (1.1) and formula (1.2), we can obtain the global receptive field and accurate location information. In order to make better use of the generated features, first, z h and z w Concatenate
[117] Operation, the connected features are processed by transformation function and nonlinear activation function respectively, and output f:
[0091] f=δ(F1([Z h ,Z w ]))(1.3)
[0092] Where F1 is the conversion function with a convolution kernel of 1×1, δ is the nonlinear activation function, and f is the intermediate feature map that encodes spatial information in the horizontal and vertical directions.
[0093] Secondly, f is divided into two independent tensors, and the coordinate attention mechanism map W2(F) of the lower branch is obtained through convolution and nonlinear transformation, which is mainly used to capture the non-local correlation of the feature map. Finally, the attention mechanism maps W1(F) and W2(F) of the upper and lower branches are fused and transformed into W(F) through the nonlinear activation function δ to form the PHAM mechanism, as shown in formula (1.4).
[0094] W(F)=δ[W1(F)+W2(F)](1.4)
[0095] 5. Feature pyramid fast pooling
[0096] The SPP (Spatial Pyramid Pooling) structure is used to change the size of the feature map in the YOLO network. SPP first performs a CBS operation on the input feature map, and then performs a maximum pooling operation on the feature map output by CBS using convolution kernels of sizes 3×3, 5×5, and 9×9, and then cascades it with the feature map output by CBS and sends it to the CBS module. Although the SPP module realizes the function of converting feature maps to a specific size, this parallel connection method ignores the impact of feature maps with different receptive fields on model performance and increases the additional computational overhead of the model.
[0097] The SPPF (Spatial Pyramid Fast Pooling) structure replaces the parallel maximum pooling operation of three convolution kernels of different sizes in the original SPP with the serial operation of three convolution kernels of the same size. Figure 4 As shown in the figure, SPPF first performs a 5×5 maximum pooling operation on the data transmitted serially from the CBS structure (cancelling ① and ②), and then passes the data into the CBS structure through cascade concatenation (adding ③ and ④). SPPF uses continuous fixed convolution kernels to pool the input feature maps, fusing feature maps of different receptive fields, enriching the expressive power of feature maps without increasing computational overhead.
[0098] 6. EIOU loss function
[0099] In target detection, the function of the boundary loss function is to determine the positive and negative samples and evaluate the distance between the predicted box and the true box. IOU is the ratio of the intersection and union between the predicted box and the true box, as shown in formula (1.5). It satisfies non-negativity, identity, symmetry and triangle inequality. Regardless of the size of the predicted box, its value is between 0 and 1. In actual use, IOU loss is shown in formula (1.6). However, IOU loss cannot optimize the situation where the real box and the predicted box do not intersect, nor can it reflect how the real box and the predicted box intersect. In order to solve these problems, the minimum enclosing rectangle of the real box and the predicted box is introduced on the basis of IOU, as shown in formula (1.7):
[0100]
[0101] L IOU =1-IOU(1.6)
[0102]
[0103] Where: C is the area of the minimum circumscribed rectangle of the predicted box and the true box, but GIOU loss still has some problems. When the predicted box and the true box are included, GIOU loss degenerates into IOU loss; when the predicted box and the true box intersect, the convergence is slow in the horizontal and vertical directions. DIOU loss and CIOU loss, these two types of losses directly minimize the normalized distance between the predicted box and the true box to increase the convergence speed, and make the regression results more accurate when the target box overlaps or even contains the target box, as shown in formulas (1.8) to (1.11).
[0104]
[0105] Among them: α is the weight function, ν is used to measure the consistency of the aspect ratio, ρ represents the Euclidean distance between the two center points, and c represents the diagonal length of the minimum circumscribed rectangle of the predicted box and the true box. However, DIOU loss does not consider the vertical and horizontal dimensions of the predicted bounding box during the regression process, and there is still room for further improvement in accuracy; CIOU loss describes a relative value, but there is a certain ambiguity. This paper uses the EIOU loss function instead of the CIOU loss function as the boundary loss function, and its definition is shown in formula (1.12). It comprehensively considers the overlapping area, the distance between the center points, and the actual width and height difference. It solves the problems existing in the CIOU loss function, making the model converge faster and the regression process more stable.
[0106]
[0107] 7. Model training
[0108] The purpose of model training is to use machine learning algorithms and a large amount of training data to enable the model to accurately identify the category and location of objects in the image. Through training, the model can learn the characteristics and location information of different objects, so as to accurately identify new images.
[0109] Python 3.7 and Pytorch 1.5 framework were used for training under Ubuntu 18.04 LTS 64-bit operating system. NVIDIA GTX 2080Ti graphics card (NVIDIA, USA) was used for deep learning training. The PHAM-YOLO network was used for training and validation on the dataset constructed in 3.4. The training parameters of the network were as follows: the number of epochs was set to 500, the image size imgsz was set to 640×640×3, the initial learning rate was set to 0.01, the final learning rate was set to 0.001, the weight decay was set to 0.0005, the SGD optimization algorithm was used, and the training batch size was set to 16.
[0110] 8. Experimental results and discussion
[0111] 8.1 Evaluation Metrics
[0112] The performance of the model was evaluated in accordance with the requirements of T / SAITA 001-2021 "Specifications for the Evaluation of Artificial Intelligence Computer Vision Systems". The evaluation indicators include precision, recall rate and mean average precision.
[0113] (1) Accuracy
[0114] Precision (P) is the ratio of positive samples in a set predicted to be positive samples, and the calculation method is shown in formula (1.13).
[0115]
[0116] In the formula, TP represents the ratio of correctly predicted negative samples to all negative samples; FP represents the ratio of incorrectly predicted negative samples to all negative samples
[0117] (2) Recall rate
[0118] The recall rate (R) is the ratio of correctly predicted positive samples to all positive samples, and the calculation method is shown in formula (1.14).
[0119]
[0120] Where FN represents the number of positive samples predicted as negative by the model.
[0121] (3) Average precision
[0122] The mean average precision (mAP) can comprehensively measure the performance of the model. mAP is expressed as the area under the recall-precision curve, such as Figure 5 As shown in Figure 2, the larger the mAP value, the better the model classification performance.
[0123] The present invention proposes a system for implementing a cigarette burning charcoal line detection method based on a hybrid attention mechanism, wherein the system comprises:
[0124] An image acquisition module, used to collect multi-dimensional image data at different time points during the cigarette burning process in real time;
[0125] A data processing module, used to perform the image preprocessing steps in the method, including color calibration, illumination uniformity adjustment and image denoising;
[0126] The YOLO network module with parallel hybrid attention mechanism receives the preprocessed image data and combines the three attention mechanisms of channel, space and coordinate to detect the char lines of cigarettes;
[0127] The feature extraction and matching module, combined with the feature pyramid fast pooling module, extracts and matches the multi-scale features of the carbon line target;
[0128] The output module is used to output the carbon line detection results in real time, including the visualization images and numerical analysis results of the carbon line width, uniformity and crack area.
[0129] The system for implementing the cigarette burning char line detection method based on the hybrid attention mechanism proposed in the present invention performs char line detection by real-time acquisition and preprocessing of cigarette burning image data, combines the YOLO network with the parallel hybrid attention mechanism, and uses the feature pyramid fast pooling technology to extract multi-scale features. Finally, the key parameters such as the width, neatness and crack area of the char line are output in real time, thereby improving the accuracy and efficiency of char line detection and providing an innovative technical solution for cigarette quality monitoring.
[0130] The present invention provides a computer-readable storage medium on which a computer program is stored, wherein the computer program implements the steps of the above method when executed by a processor.
[0131] The computer-readable storage medium proposed by the present invention stores executable instructions. When the executable instructions are executed by a processor, the processor will be caused to execute any implementation of a system for implementing a cigarette burning charcoal line detection method based on a hybrid attention mechanism in the above-mentioned embodiments.
[0132] In another optional embodiment of the present invention, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EE PROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories. In some embodiments, the executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted language, or declarative or procedural language), and may be deployed in any form, including being deployed as an independent program or being deployed as a module, component, subroutine, or other unit suitable for use in a computing environment. As an example, the executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected by a communication network.
[0133] The present invention proposes a computer device, including a memory and a processor, wherein a computer program that can be run on the processor is stored in the memory, wherein when the processor executes the computer program, steps for implementing a cigarette burning charcoal line detection method based on a hybrid attention mechanism are implemented.
[0134] The present invention proposes a computer device, a memory for storing executable instructions; a processor for executing the executable instructions stored in the memory to implement a cigarette burning charcoal line detection method based on a hybrid attention mechanism.
[0135] The specific implementation process of the present invention is now described in detail with reference to the embodiments:
[0136] Ablation experiment
[0137] In order to verify the impact of the improvements on the model performance, the original YOLOv5 is used as the baseline network, the EIOUloss loss function is used instead of the CIOU loss function, the PHAM attention mechanism is added, and the SPPF module is used instead of the SPP module to conduct ablation experiments. The ablation test results of each change are shown in Table 1.1. Among them, the EIOU loss function solves the problem of inaccurate BBR regression, which improves the mAP of the model by 1.8 percentage points; the SPPF module integrates feature maps of different receptive fields, improves the expression ability of feature maps, and improves the mAP of the model by 1.5 percentage points; the PHAM attention mechanism has the greatest performance improvement on the model, and the mAP is increased by 4.5 percentage points compared with the original network; when the three modules are fused, the mAP is the highest, which is 5.0 percentage points higher than the original network. The results show that for the task of multi-target burning charcoal line detection under complex background, the performance of the network can be improved by embedding the PHAM mechanism, replacing the SPPF structure and the EIOU loss function. After the three are fused, the best detection results can be achieved, and the mAP of the model reaches 99%.
[0138] Table 1.1
[0139]
[0140] Comparison with other object detection algorithms
[0141] In order to further verify the effectiveness of the PHAM-YOLO network for cigarette burning charcoal line detection, the current mainstream target detection algorithms, including YOLOv3, YOLOv4, SSD, Faster R-CNN and YOLOv5, were selected for comparison, and the results are shown in Table 1.2. As can be seen from Table 1.2, the PHAM-YOLO network model performs best, with an mAP of 99.0%, which is 5.0 percentage points higher than the YOLOv5 model, and a greater improvement than other types of detection algorithms, indicating that the PHAM-YOLO network model can effectively detect the cigarette burning charcoal lines of multiple targets in complex scenes.
[0142] Table 1.2
[0143]
[0144]
[0145] like Figure 6a to Figure 6eAs shown in the figure, there are three detection scenes of the turntable type 10-channel (free burning test), turntable type 1-channel (head falling tendency test), and linear type 5-channel (ash packaging performance test) detection equipment. In the three detection tasks, whether for regular cigarettes or slim cigarettes, PHAM-YOLO showed good detection results, with mAP reaching 99.0%, and the model only had a 1% probability of judging the target as background, indicating that PHAM-YOLO can achieve correct recognition and precise positioning of cigarette burning lines under different detection scenes, different scales, different shapes, and complex backgrounds.
[0146] Summarize
[0147] Aiming at three detection scenarios of cigarette burning and smoking, the present invention proposes a burning charcoal line tracking algorithm based on the constructed cigarette burning charcoal line detection data, which realizes the real-time tracking and accurate identification of the cigarette burning charcoal line, and provides a technical means for the detection of the width and uniformity of the cigarette burning charcoal line.
[0148] First, the performance of the YOLO v5 model was improved by embedding a parallel hybrid attention mechanism (PHAM), using feature pyramid fast pooling, and bounding box regression. The average precision of the model after the fusion of the three modules increased by 5.0 percentage points.
[0149] Secondly, the performance of the model was evaluated using standard methods. The average accuracy, precision and recall of the proposed PHAM-YOLO network detection were 99.0%, 99.8% and 99.0%, respectively, which were higher than other types of target detection methods. In the three application scenarios, the model only had a 1% probability of judging the target as background. The cigarette burning charcoal line detection method based on the PHAM-YOLO network model can be applied to the accurate detection of burning charcoal lines in multiple scenarios.
[0150] The detailed explanation of the above-mentioned embodiments is only intended to explain the present invention so as to facilitate a better understanding of the present invention. However, these descriptions cannot be interpreted as limitations on the present invention for any reason. In particular, the various features described in different embodiments may also be arbitrarily combined with each other to form other embodiments. Unless there is a clear description to the contrary, these features should be understood to be applicable to any embodiment and are not limited to the described embodiments.
Claims
1. A cigarette burning charcoal line detection method based on parallel hybrid attention mechanism, characterized in that: Collecting multi-dimensional image data of the entire process of cigarette burning and preprocessing the multi-dimensional image data; A detection model for burning charcoal lines of cigarettes based on a parallel hybrid attention mechanism is constructed, wherein the detection model for burning charcoal lines of cigarettes is embedded with a parallel hybrid attention mechanism, wherein the parallel hybrid attention mechanism includes a channel attention mechanism, a spatial attention mechanism, and a coordinate attention mechanism; Inputting the preprocessed multi-dimensional image data into the detection model of the cigarette burning charcoal line and training the detection model of the cigarette burning charcoal line; The trained cigarette burning charcoal line detection model is used to detect the cigarette burning charcoal line during the whole process of cigarette burning.
2. The cigarette burning charcoal line detection method based on parallel hybrid attention mechanism according to claim 1, characterized in that: The multi-dimensional image data is preprocessed, including at least color calibration, illumination uniformity adjustment and image denoising of the multi-dimensional image.
3. The cigarette burning charcoal line detection method based on parallel hybrid attention mechanism as claimed in claim 2, characterized in that: Collect multi-dimensional image data of the entire cigarette burning process, including: The changes in ambient light during cigarette burning are monitored in real time, and the acquisition strategy is adjusted based on the real-time changes in ambient light.
4. The method for detecting burning charcoal lines of cigarettes based on a parallel hybrid attention mechanism according to claim 1, characterized in that: The detection model of cigarette burning charcoal lines extracts and matches charcoal line features in the multi-dimensional image data multiple times by applying the feature pyramid fast pooling module.
5. The method for detecting burning charcoal lines of cigarettes based on a parallel hybrid attention mechanism according to claim 1, characterized in that: The cigarette burning charcoal line detection model uses an effective intersection-over-union loss function to regress the charcoal line detection boundary box, thereby achieving tracking and positioning of the charcoal line during the dynamic burning process.
6. The method for detecting burning charcoal lines of cigarettes based on a parallel hybrid attention mechanism according to claim 1, characterized in that: The channel attention mechanism is used to dynamically weight the RGB channels in the multi-dimensional image data and obtain a channel attention feature map.
7. The method for detecting burning charcoal lines of cigarettes based on a parallel hybrid attention mechanism according to claim 1, characterized in that: The spatial attention mechanism is used to match the convolutional neural network with the gray column morphological changes in the multi-dimensional image data and generate a spatial attention feature map.
8. The method for detecting burning charcoal lines of cigarettes based on a parallel hybrid attention mechanism according to claim 1, characterized in that: Based on the coordinate attention mechanism, char lines are located in multi-dimensional image data through time series images of cigarette burning.
9. The method for detecting burning charcoal lines of cigarettes based on a parallel hybrid attention mechanism according to claim 1, characterized in that: The trained cigarette burning charcoal line detection model is used to detect the cigarette burning charcoal line during the whole process of cigarette burning, including real-time generation of cigarette burning charcoal line detection results, and the ability to output the width, uniformity and crack area of the charcoal line.
10. A system for implementing a cigarette burning charcoal line detection method based on a hybrid attention mechanism, characterized in that: The system comprises: An image acquisition module, used to collect multi-dimensional image data at different time points during the cigarette burning process in real time; A data processing module, used to perform the image preprocessing steps in the method, including color calibration, illumination uniformity adjustment and image denoising; The YOLO network module with parallel hybrid attention mechanism receives the preprocessed image data and combines the three attention mechanisms of channel, space and coordinate to detect the char lines of cigarettes; The feature extraction and matching module, combined with the feature pyramid fast pooling module, extracts and matches the multi-scale features of the carbon line target; The output module is used to output the carbon line detection results in real time, including the visualization images and numerical analysis results of the carbon line width, uniformity and crack area.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
12. A computer device comprising a memory and a processor, wherein a computer program capable of running on the processor is stored in the memory, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Cited By
Heat energy regulation and control system and method for acid pickling co-production of machine-made carbon and activated carbon
CN120045950A
A heat energy regulation system and method for co-producing pickled mechanism charcoal and activated carbon
CN120045950B