Microwave cigarette moisture density detection method
By constructing a microwave cigarette moisture density detection model and utilizing a neural network with a multi-head attention module and a local feature extraction module, the problems of lag and accuracy in cigarette density and moisture detection were solved, achieving high-speed online detection and improved accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU RETOOL SCI & TECH CO LTD
- Filing Date
- 2024-06-28
- Publication Date
- 2026-06-26
AI Technical Summary
Existing methods for detecting cigarette density and moisture content cannot achieve high-speed online measurement and suffer from problems such as low measurement accuracy, complex equipment, and difficulty in maintenance.
A detection model combining microwave technology with a multi-head attention module and a local feature extraction module was developed. The model parameters were optimized using training and validation sets. The model was trained using the backpropagation algorithm and mean square error function to construct a neural network model for detecting the moisture density of cigarettes. The model performance was evaluated using metrics such as accuracy, precision, and recall.
It improves the accuracy and speed of tobacco moisture and density detection, alleviates the problem of detection lag, and provides an effective decision-making reference for automated detection.
Smart Images

Figure CN118606681B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cigarette testing, and more particularly to a microwave method for detecting the moisture density of cigarettes. Background Technology
[0002] In the actual production process of cigarettes, the detection and control of cigarette density and moisture content are crucial, as these two indicators are key factors in measuring cigarette quality. Previously, the detection of cigarette density and moisture content typically required two separate sets of equipment, making it impossible to simultaneously obtain the density and moisture levels of the cigarettes. Moisture detection, in particular, often had to be performed offline, making high-speed online measurement impossible. Methods for measuring cigarette density include weighing, infrared detection, and radioactive material detection, while methods for moisture detection include drying and far-infrared detection. However, these methods either cannot achieve high-speed online detection, are affected by environmental factors such as temperature, resulting in inaccurate measurements, or involve radioactive materials that could pollute and harm the surrounding environment and personnel. Although some methods are still in use, they are gradually being phased out as technology advances. In recent years, a method for measuring cigarette density and moisture content using microwaves has emerged; however, it employs early microwave technology, resulting in complex equipment design, outdated technology, difficulty in maintenance, and drawbacks such as low measurement accuracy and poor stability. Summary of the Invention
[0003] The purpose of this invention is to design a microwave method for detecting the moisture density of cigarettes in order to solve the above-mentioned problems.
[0004] The present invention achieves the above objectives through the following technical solutions:
[0005] A method for detecting the moisture density of microwave cigarettes, comprising:
[0006] S1. Obtain the dataset and divide it into training, validation and test sets, and determine the input and output variables;
[0007] S2. Construct a detection model. The detection model includes an input layer, a multi-head attention module, and a local feature extraction module. The input layer is used to input input variables into the multi-head attention module and the local feature extraction module. The output of the multi-head attention module is used as the input of the local feature extraction module. The multi-head attention module adopts multiple self-attention mechanisms to obtain multiple sets of attention results. Then, the multiple sets of attention results are concatenated and linearly projected to obtain the final attention result. The local feature extraction module includes 4 convolutional layer modules and 3 fully connected layer modules from input to output. The last fully connected layer module outputs the predicted values of tobacco stick density and tobacco stick moisture content.
[0008] S3. The training and validation sets are imported into the detection model. The backpropagation algorithm is used to adjust and optimize the model parameters, and the mean square error function is used as the loss function in the optimization process to obtain the optimized detection model.
[0009] S4. Import the optimized detection model into the test set, and evaluate the generalization and robustness of the optimized detection model using multiple metrics such as accuracy, precision, recall and F1-score.
[0010] S5. Obtain the data to be predicted, and use the optimized detection model to make real-time predictions to obtain the moisture content and density of the cigarette sticks.
[0011] The beneficial effects of this invention are as follows: Addressing the issues of time lag in manually detecting the moisture content and density of cigarette sticks, and the inability to provide timely feedback of detection values in actual production environments, a detection model has been established. This model significantly alleviates the lag problem. Furthermore, compared to other conventional deep learning models, this detection model greatly improves the detection accuracy of the moisture content and density of cigarette sticks, providing operators with effective decision-making references and contributing to the improvement of the automated detection speed and accuracy in the cigarette moisture and density control process. Attached Figure Description
[0012] Figure 1 This is a flowchart of the microwave cigarette moisture density detection method of the present invention;
[0013] Figure 2 This is a schematic diagram of the data acquisition device;
[0014] Figure 3 This is a schematic diagram of the resonant cavity module;
[0015] The corresponding figure labels are:
[0016] 1-Channel, 2-Inner shell of cavity, 3-Outer shell of cavity. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0018] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0019] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0020] In the description of this invention, it should be understood that the terms "upper," "lower," "inner," "outer," "left," "right," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this invention is in use, or the orientation or positional relationship commonly understood by those skilled in the art. They are only used to facilitate the description of this invention and to simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0021] Furthermore, the terms "first," "second," etc., are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0022] In the description of this invention, it should also be noted that, unless otherwise explicitly specified and limited, terms such as "set" and "connection" should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be a connection within two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0023] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0024] like Figure 1 As shown, a microwave method for detecting the moisture density of cigarettes includes:
[0025] S1. Obtain the dataset. After removing outliers and null values from the input data using data cleaning methods, divide the dataset into training, validation, and test sets. Perform correlation analysis on the input and output feature variables to determine the input and output variables. Input variables include resonant frequency ΔW, half-power bandwidth change ΔQ, and microwave transmission frequency f. a ,f b The detector detects the output microwave signal U a Ub As input variables, the output variables include tobacco stick density and tobacco stick moisture content;
[0026] S2. Construct a detection model. The detection model includes an input layer, a multi-head attention module, and a local feature extraction module. The input layer is used to input input variables into the multi-head attention module and the local feature extraction module. The output of the multi-head attention module is used as the input of the local feature extraction module. The multi-head attention module adopts multiple self-attention mechanisms to obtain multiple sets of attention results. Then, the multiple sets of attention results are concatenated and linearly projected to obtain the final attention result. The local feature extraction module includes 4 convolutional layer modules and 3 fully connected layer modules from input to output. The last fully connected layer module outputs the predicted values of tobacco density and tobacco moisture content. Each convolutional layer module uses the LeakyReLU activation function as a one-dimensional batch normalization layer.
[0027] S3. The training and validation sets are imported into the detection model. The backpropagation algorithm is used to adjust and optimize the model parameters, and the mean square error function is used as the loss function in the optimization process to obtain the optimized detection model.
[0028] S4. Import the optimized detection model into the test set, and evaluate the generalization and robustness of the optimized detection model using multiple metrics such as accuracy, precision, recall and F1-score.
[0029] S5. Obtain the data to be predicted, and use the optimized detection model to make real-time predictions to obtain the moisture content and density of the cigarette sticks.
[0030] like Figure 2 As shown, a data acquisition device is used to collect data to be predicted. The acquisition device includes a microwave signal generation module, a resonant cavity module, a detector module, a controller, a sensor module, and an encoder module. The microwave signal generation module emits microwave signals of different frequencies and is connected to the input terminal of the resonant cavity module. The output terminal of the resonant cavity module is connected to the input terminal of the detector module. The detector module detects the output microwave signal of the resonant cavity module and its output terminal is connected to the input terminal of the controller. The controller controls the high-speed data acquisition area and is connected to both the microwave signal generation module and the detector module. The sensor module is connected to the high-speed data acquisition area of the controller, and the encoder module is connected to the enhanced quadrature encoder pulse area of the controller.
[0031] like Figure 3 As shown, the resonant cavity module includes a cavity shell 3 and a cavity inner shell 2. The cavity inner shell 2 is installed inside the cavity shell 3. A resonant cavity is formed between the cavity shell 3 and the cavity inner shell 5. A channel 1 is provided on the resonant cavity module. The cigarette to be collected passes through the channel 1. A microwave signal input probe and an output probe pass through the cavity shell 3.
[0032] The detection module detects the output microwave signal from the resonant cavity module, obtaining the microwave energy value after absorption by the cigarette. The high-speed data acquisition area consists of a high-speed AD conversion module, which performs high-speed conversion and sampling on the detected microwave signal, converting the analog signal into a digital signal for transmission to the controller. The controller, based on a high-speed DSP chip, switches microwave signals, coordinates device operation, processes microwave signal data acquired in the high-speed data acquisition area, and calculates and analyzes the density and moisture data of the cigarette. It also controls the sensors and encoders.
[0033] The working principle of the microwave cigarette moisture density detection method of the present invention is as follows:
[0034] Determine the input and output variables required for the detection model, including the resonant frequency ΔW, half-power bandwidth change ΔQ, and microwave transmission frequency f acquired by the acquisition device. a ,f b The detector module detects and outputs microwave signal U. a U b As input variables, the moisture content and density of the tobacco sticks are used as output variables. Data cleaning methods are employed to remove outliers and null values from the input data. Correlation analysis is then performed on the input and output variables to select the features most strongly correlated with the moisture content and density of the tobacco sticks as the final input data. The data is then standardized to serve as training data for the subsequent neural network model. The standardization formula is shown below:
[0035]
[0036] Where, x i ′,x i These are the standardized data and the original data, respectively; μ i ,σ i Let be the mean and variance of the i-th data group, respectively.
[0037] Appropriate data preprocessing was performed on the input variables, and the standardized data was divided into training set, validation set and test set in a ratio of 7:2:1.
[0038] Build the detection model structure;
[0039] The local feature extraction module in the detection model, which uses a one-dimensional convolutional neural network, can effectively capture local features in the data. However, this also makes the one-dimensional convolutional neural network insensitive to many other features besides local features, thus reducing the model's generalization ability. The multi-head attention mechanism of the multi-head attention module can help the one-dimensional convolutional neural network better notice long-range dependencies and global features in the data, thereby improving the model's generalization ability and robustness. Specifically, this is manifested as follows:
[0040] Multi-head attention is used to apply multiple self-attention mechanisms to multiple sequences in the input data, resulting in multiple sets of attention results. These results are then concatenated and linearly projected to obtain the final attention result. Finally, the final attention result is combined with feature information extracted by a one-dimensional convolutional neural network. Therefore, multi-head attention can simultaneously handle problems with multiple points of interest, helping deep learning models better handle the complex relationships between various input sequences and output variables.
[0041] The multi-head attention mechanism specifically represents the input feature vector as X = {x1, x2, ..., x...} n}, where X∈R n×d The multi-head attention calculation is then obtained as follows:
[0042] head(X) = concat(h1,h2,...,h h W o
[0043]
[0044] Where h represents the number of heads; Q∈R d×d , K∈R d×d , V∈R d×d K and V represent the d-dimensional query, key, and value of the input feature sequence, respectively; h i W represents the i-th attention head. o The weight parameters are for linear projection, and each attention head is obtained by performing self-attention calculations on Q, K, and V.
[0045] A one-dimensional convolutional neural network consists of four convolutional layers and three fully connected layers. It uses 1×3 convolutional kernels, with the number of kernels in the four layers being 16, 32, 16, and 8 respectively. The first and fourth convolutional layers each use a 1×2 pooling layer with a stride of 2. Each convolutional layer uses a LeakyReLU activation function as a one-dimensional batch normalization layer. The formula for calculating the LeakyReLU activation function is as follows:
[0046]
[0047] Here, α is a positive number much less than 1. This activation function can effectively suppress the phenomenon that neurons are never activated during model training.
[0048] After four convolutional layers, three fully connected layers receive the input from the final convolutional layer. These three fully connected layers have 8, 4, and 2 neurons respectively, and output predicted values for the tobacco density and moisture content in the final fully connected layer. Furthermore, a Dropout layer is connected after each fully connected layer to prevent overfitting during training.
[0049] The model is trained by inputting processed training and validation data. During the training process, the model is optimized by adjusting parameters and model structure to improve model performance and accuracy. The final trained model is saved for subsequent prediction of tobacco density and moisture content.
[0050] The optimal model that has been trained is loaded and tested on the test set data. The generalization and robustness of the model are evaluated by combining multiple indicators. Finally, the moisture content and density of the tobacco sticks are predicted in real time based on the collected data.
[0051] Compared to existing technologies, this paper addresses the time lag inherent in manual detection of tobacco stick moisture content and density, as well as the inability to provide timely feedback in actual production environments. A detection model for predicting tobacco stick moisture content and density has been established, significantly mitigating this lag. Furthermore, compared to other conventional deep learning models, this model substantially improves the detection accuracy of tobacco stick moisture content and density, providing operators with effective decision-making references and contributing to improved automation detection speed and accuracy in cigarette moisture and density control.
[0052] The technical solutions of the present invention are not limited to the specific embodiments described above. Any technical modifications made in accordance with the technical solutions of the present invention fall within the protection scope of the present invention.
Claims
1. A method for detecting the moisture density of microwave cigarettes, characterized in that, include: S1. Obtain the dataset and divide it into training, validation and test sets, and determine the input and output variables; Specifically, after obtaining the dataset, data cleaning methods are used to remove outliers and null values from the input data. Then, the data is partitioned, and correlation analysis is performed on the input and output feature variables to determine the input and output variables. The input variables include the resonant frequency. Half-power bandwidth variation Microwave transmission frequency The detector detects the output microwave signal. As input variables, the output variables include tobacco stick density and tobacco stick moisture content; S2. Construct a detection model. The detection model includes an input layer, a multi-head attention module, and a local feature extraction module. The input layer is used to input input variables into the multi-head attention module and the local feature extraction module. The output of the multi-head attention module is used as the input of the local feature extraction module. The multi-head attention module adopts multiple self-attention mechanisms to obtain multiple sets of attention results. Then, the multiple sets of attention results are concatenated and linearly projected to obtain the final attention result. The local feature extraction module includes 4 convolutional layer modules and 3 fully connected layer modules from input to output. The last fully connected layer module outputs the predicted values of tobacco stick density and tobacco stick moisture content. S3. The training and validation sets are imported into the detection model. The backpropagation algorithm is used to adjust and optimize the model parameters, and the mean square error function is used as the loss function in the optimization process to obtain the optimized detection model. S4. Import the optimized detection model into the test set, and evaluate the generalization and robustness of the optimized detection model using multiple metrics such as accuracy, precision, recall and F1-score. S5. Obtain the data to be predicted, and use the optimized detection model to make real-time predictions to obtain the moisture content and density of the cigarette sticks.
2. The microwave cigarette moisture density detection method according to claim 1, characterized in that, Each convolutional layer module uses the LeakyReLU activation function as a one-dimensional batch normalization layer.
3. The microwave cigarette moisture density detection method according to claim 1, characterized in that, In S5, a data acquisition device is used to collect the data to be predicted. The acquisition device includes a microwave signal generation module, a resonant cavity module, a detector module, a controller, a sensor module, and an encoder module. The microwave signal generation module emits microwave signals of different frequencies and is connected to the input terminal of the resonant cavity module. The output terminal of the resonant cavity module is connected to the input terminal of the detector module. The detector module detects the output microwave signal of the resonant cavity module and its output terminal is connected to the input terminal of the controller. The controller controls the high-speed data acquisition area and is connected to both the microwave signal generation module and the detector module. The sensor module is connected to the high-speed data acquisition area of the controller, and the encoder module is connected to the enhanced quadrature encoder pulse area of the controller.
4. The microwave cigarette moisture density detection method according to claim 3, characterized in that, The resonant cavity module includes a cavity shell and a cavity inner shell. The cavity inner shell is installed inside the cavity shell, and a resonant cavity is formed between the cavity shell and the cavity inner shell. The resonant cavity module is provided with a channel through which the cigarette to be collected passes. A microwave signal input probe and an output probe pass through the cavity shell.