A method for testing the authenticity of mixed cigarette samples
By analyzing the relationship between the moisture content and odor characteristics of cigarettes, a regression prediction model was established to solve the problem of differences in moisture content and odor characteristics in cigarette identification, and achieve rapid, accurate and efficient identification of cigarettes.
Patent Information
- Application Number
- CN202410977371.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-07-22
AI Technical Summary
In the process of identifying the authenticity of cigarettes, cigarettes from different manufacturers have different moisture contents due to differences in production processes and raw material ratios, which affects the odor characteristics. It is difficult to establish a unified identification standard, and the odor characteristics are greatly affected by the storage environment and time. Increased identification difficulty.
By analyzing the relationship between the moisture content and odor characteristics of cigarettes from different manufacturers, a regression prediction model is established, and the actual measured moisture content and the allowable error value predicted by the model are combined to determine the authenticity of the cigarettes, and a regression prediction model for the mixing ratio is constructed to improve the mixing Cigarette identification accuracy.
It achieves rapid and accurate identification of cigarettes, improves identification accuracy, provides scientific data support for quality control and supervision of the cigarette industry, and can efficiently distinguish mixed or multi-source cigarette samples on the market.
Smart Images

Figure CN118521324B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cigarette identification, and in particular to a method for testing the authenticity of mixed multiple cigarette samples. Background Art
[0002] In the process of identifying the authenticity of cigarettes, multiple cigarette samples need to be tested. However, due to differences in production processes and raw material ratios among cigarettes produced by different manufacturers, the water content of each sample is not the same.
[0003] The moisture content of cigarettes is one of the key factors affecting their odor characteristics. In the actual identification process, it is necessary to comprehensively consider the two indicators of cigarette odor and moisture content in order to make an accurate authenticity judgment. Because the number of cigarette samples is large and their sources are complex, it is a very time-consuming and labor-intensive task to test them one by one and obtain odor and moisture content data. In addition, the moisture content of cigarette samples from different batches varies greatly, making it difficult to establish a unified judgment standard. The odor characteristics of cigarettes will also change due to the influence of storage environment and time, further increasing the difficulty of identification.
[0004] Therefore, it is necessary to research and develop a new technical solution to capture and analyze the odor and moisture content characteristics of cigarettes through innovative methods and establish a scientific discrimination model to achieve rapid and accurate identification of the authenticity of cigarettes. Summary of the invention
[0005] In order to solve the problems existing in the above-mentioned prior art, the purpose of the present disclosure is to provide a method for testing the authenticity of mixed multiple cigarette samples. The method for testing the authenticity of mixed multiple cigarette samples analyzes the relationship between the moisture content and odor characteristics of cigarettes from different manufacturers, estimates the moisture content of the cigarettes to be tested through a regression prediction model, and compares the measured moisture content with the allowable error value predicted by the model to determine the authenticity of the cigarettes; for cigarette samples marked with mixed labels, a regression prediction model for the mixing ratio is constructed, which combines the moisture content and odor characteristics of cigarettes from different manufacturers to improve the accuracy of mixed cigarette identification.
[0006] The present invention discloses a method for testing the authenticity of mixed multiple cigarette samples, comprising:
[0007] Step S1, obtaining cigarette samples produced by different manufacturers, measuring the moisture content of each of the cigarette samples, and monitoring and recording the environmental conditions during the measurement process in real time to establish a cigarette sample moisture content database;
[0008] Step S2, extracting the odor characteristics of each of the cigarette samples, and classifying the extracted odor characteristic data to construct a cigarette odor characteristic data set of different manufacturers;
[0009] Step S3, associating the cigarette sample moisture content database with the cigarette odor characteristic data set, analyzing the relationship between moisture content and odor characteristics in historical samples of cigarettes from different manufacturers, and establishing a moisture content-odor characteristic regression prediction model;
[0010] Step S4, simulating the odor release and moisture content changes of the cigarette sample under different environmental conditions, dynamically adjusting the moisture content-odor characteristic regression prediction model, and generating moisture content allowable error values corresponding to different environmental conditions;
[0011] Step S5, collecting the odor characteristics of the cigarette to be tested and inputting them into the moisture content-odor characteristic regression prediction model, combining the environmental condition data monitored in real time, adjusting the moisture content data output by the moisture content-odor characteristic regression prediction model, and obtaining an estimated value of the moisture content of the cigarette to be tested;
[0012] Step S6, determining a threshold range of moisture content of the cigarette to be tested according to the moisture content estimation value of the cigarette to be tested and the moisture content allowable error value corresponding to the environmental condition data monitored in real time, and judging the authenticity of the cigarette to be tested by comparing the moisture content measurement data of the cigarette to be tested with the moisture content threshold range;
[0013] Step S7: construct a cigarette mixing related regression prediction model based on the cigarette mixing label and the mixing ratio of cigarettes from different manufacturers in the cigarette mixing label, combined with the moisture content-odor characteristic regression prediction model corresponding to different manufacturers, to identify the cigarette to be tested.
[0014] Preferably, the step S1 specifically includes:
[0015] Obtaining the cigarette samples produced by multiple different manufacturers, collecting basic information of the cigarette samples, and entering the information into a database to establish a cigarette sample information table;
[0016] Selecting the cigarette samples to be measured according to the cigarette sample information table, measuring the moisture content of each cigarette sample using a moisture content measuring instrument, and collecting ambient temperature and humidity data in real time during the measurement process using a temperature and humidity sensor;
[0017] The collected cigarette sample moisture content measurement values, environmental temperature and humidity data and sample information are associated to generate a complete sample measurement record, and stored in the cigarette sample moisture content database.
[0018] Preferably, the step S2 specifically includes:
[0019] Obtaining the cigarette samples produced by multiple different manufacturers, collecting basic information of the cigarette samples, and entering the information into a database to establish a cigarette sample information table;
[0020] Selecting a suitable odor sensor array combination according to the odor components and concentration range of the cigarette sample;
[0021] Extracting odor characteristics of each cigarette sample according to the odor sensor array to obtain time-series odor signal data of the sample;
[0022] Preprocess the raw time series data collected by the odor sensor;
[0023] Using the normalization method, combined with the characteristics of cigarette odor data, the appropriate normalization range and scaling factor are selected;
[0024] A deep learning model that processes time series data is used to perform feature extraction and representation learning on the preprocessed odor signal data;
[0025] Design the specific structure of the deep learning model and obtain high-level feature representation of odor signals through training;
[0026] Annotating the odor signal characteristic data according to the manufacturer information of the cigarette sample;
[0027] The labeling process is quality controlled, the labeled odor characteristic data are divided according to manufacturer information, and the cigarette odor characteristic data sets of different manufacturers are constructed.
[0028] Preferably, the step S3 specifically includes:
[0029] Matching the sample information of the cigarette sample moisture content database with the sample information of the cigarette odor characteristic data set, and obtaining a comprehensive data set including sample moisture content and odor characteristics by inner joining or left joining the two data sets;
[0030] Perform data cleaning and preprocessing on the comprehensive data set, and perform descriptive statistical analysis on the data set using the Apriori association rule mining algorithm;
[0031] Evaluate the mined association rules in terms of statistical indicators and business significance, calculate the indicators of each rule, and select the rules with the highest association strength;
[0032] The final moisture content-odor feature association rule set is obtained by combining rule filtering conditions with manual review;
[0033] Using feature selection methods, a subset of key odor features with the highest correlation with water content and the strongest predictive ability is selected from the odor feature data;
[0034] Based on the selected subset of key odor characteristics, a moisture content-odor characteristic regression prediction model is established.
[0035] Preferably, the step S4 specifically includes:
[0036] Extracting environmental condition information corresponding to each of the cigarette samples from the cigarette sample moisture content database, performing feature selection and dimension reduction on environmental condition parameters, and selecting a parameter subset with the highest correlation with cigarette moisture content and odor release;
[0037] Clustering algorithms are used to cluster parameter subsets, and the optimal number of clusters is determined by the elbow method or silhouette coefficient method to obtain several typical environmental condition categories;
[0038] Design a simulation experiment plan for each typical environmental condition category, simulate the odor release and moisture content change process of the cigarette sample under different environmental conditions, and collect odor data and moisture content data in real time;
[0039] The odor data and moisture content data collected from the simulation experiment are combined with the original cigarette sample moisture content-odor characteristic data set;
[0040] Use timestamp or batch number fields to correlate and synchronize data from different sources to obtain an enhanced dataset containing sample data under different environmental conditions;
[0041] Based on the enhanced data set, the moisture content-odor feature regression prediction model is retrained, and the environmental condition parameters are introduced as additional input features;
[0042] If there is an interactive effect between environmental conditions and odor characteristics, new composite features are constructed by combining or crossing features;
[0043] Dynamically adjusting the parameters and structure of the moisture content-odor characteristic regression prediction model, and using cross-validation and Bootstrap methods to evaluate the prediction performance of the dynamically adjusted moisture content-odor characteristic regression prediction model under different environmental conditions, and calculating the prediction error distribution under various environmental condition categories;
[0044] The allowable threshold and empirical rule of prediction error are set according to business needs. For each environmental condition category, the allowable error value of moisture content corresponding to different environmental conditions is generated according to its prediction error distribution and allowable threshold.
[0045] Preferably, the step S5 specifically includes:
[0046] Placing the cigarette to be tested in a simulated experimental environment, collecting odor characteristic data and environmental condition data of the cigarette to be tested in real time, selecting the data at the last time point as the representative odor characteristic of the cigarette to be tested, and obtaining a time series of the odor characteristic and the environmental condition of the cigarette to be tested;
[0047] Preprocessing the collected time series of odor characteristics of the cigarette to be tested to obtain a standardized odor characteristic vector of the cigarette to be tested;
[0048] Inputting the standardized odor feature vector of the cigarette to be tested into the trained moisture content-odor feature regression prediction model, and outputting the corresponding moisture content prediction value according to the input odor feature vector;
[0049] Collecting real-time monitoring environmental condition data of the cigarette to be tested, standardizing the environmental condition data using a Z-score standardization method, converting the value of each environmental parameter into a Z value under a standard normal distribution, and obtaining a standardized environmental condition feature vector;
[0050] Find the allowable moisture content prediction error range under the current environmental conditions in the three-dimensional mapping table, use the KNN algorithm to find the K historical environmental conditions that are most similar to the current environmental conditions, and take the intersection of the prediction error ranges under these K conditions as the current allowable prediction error range;
[0051] By calculating the Mahalanobis distance between the current environmental condition feature vector and all environmental condition feature vectors in the training data, when the distance exceeds the preset quantile of the training data, the current environmental condition is marked as an "abnormal environment";
[0052] According to the search result of the three-dimensional mapping table, the moisture content prediction value of the cigarette to be tested output by the moisture content-odor characteristic regression prediction model is dynamically calibrated to obtain a calibrated moisture content estimation value.
[0053] Preferably, the step S6 specifically includes:
[0054] Obtain the estimated value of the moisture content and the real-time temperature and humidity data of the cigarette to be tested, search the corresponding moisture content allowable error value interval in the environmental condition-moisture content error mapping table according to the real-time collected environmental parameter data, and use the piecewise linear interpolation method to perform first-order interpolation on the environmental parameter values and error values at the endpoints of the interval to obtain the allowable error value under the current environmental conditions;
[0055] The interpolated allowable error value is added and subtracted from the estimated moisture content of the cigarette to be tested to obtain the upper and lower limits of the dynamic threshold of the moisture content of the cigarette to be tested, thereby forming the current moisture content threshold range of the cigarette to be tested.
[0056] Preferably, in step S6, judging the authenticity of the cigarette to be tested comprises the following steps:
[0057] If the measured value of the moisture content of the cigarette to be tested is within the moisture content threshold range of the cigarette to be tested, it is judged to be a genuine cigarette;
[0058] If the measured value of the moisture content of the cigarette to be tested is not within the moisture content threshold range of the cigarette to be tested, it is judged to be a fake cigarette.
[0059] Preferably, the step S7 specifically includes:
[0060] According to the obtained mixed label information of the cigarette to be tested and the characteristics of the cigarette packaging label, a corresponding recognition technology is selected, and a verification and error correction mechanism of the recognition result is established;
[0061] According to the manufacturer information in the mixed tag, the moisture content-odor feature regression prediction model corresponding to each manufacturer is searched in the cigarette manufacturer-model mapping table, each manufacturer's model is loaded into the memory, the cigarette mixing related regression prediction model is constructed, and a model list is formed.
[0062] Preferably, in step S7, selecting the corresponding recognition technology includes the following steps:
[0063] If the mixing ratio information is printed on the label in text form, the OCR technology is used to extract the mixing ratio data by preprocessing, segmenting, feature extraction and pattern matching the label image;
[0064] If the mixing ratio information is stored in the form of an RFID tag or an NFC tag, the mixing ratio is obtained by reading the data block in the tag using the corresponding radio frequency identification technology.
[0065] The authenticity testing method for mixing multiple cigarette samples disclosed in the present invention has the following advantages:
[0066] The disclosed authenticity testing method for a mixture of multiple cigarette samples analyzes the relationship between the moisture content and odor characteristics of cigarettes from different manufacturers, estimates the moisture content of the cigarettes to be tested through a regression prediction model, and compares the measured moisture content with the allowable error value predicted by the model to judge the authenticity of the cigarettes; for cigarette samples marked with mixed labels, a regression prediction model for the mixing ratio is constructed, which combines the moisture content and odor characteristics of cigarettes from different manufacturers, thereby improving the accuracy of identifying mixed cigarettes; by integrating environmental monitoring, data mining and deep learning technologies, the accuracy of identifying the authenticity and quality of cigarettes is also improved, and scientific data support is also provided for quality control and supervision in the cigarette industry; in addition, an innovative method is provided for the identification of mixed cigarettes on the market, which can efficiently distinguish mixed or multi-source cigarette samples on the market, thereby improving the accuracy and practicality of identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 It is a flow chart of a method for testing the authenticity of mixed multiple cigarette samples disclosed in the present invention. DETAILED DESCRIPTION
[0068] like Figure 1 As shown, the authenticity testing method for mixing multiple cigarette samples disclosed in the present invention comprises:
[0069] Step S1, obtaining cigarette samples produced by different manufacturers, measuring the moisture content of each cigarette sample, and monitoring and recording the environmental conditions during the measurement process in real time to establish a cigarette sample moisture content database;
[0070] Step S2, extracting odor characteristics from each cigarette sample, and constructing odor characteristic data sets of cigarettes from different manufacturers by classifying the extracted odor characteristic data; the classification of the extracted odor characteristic data may be performed in combination with a deep learning algorithm;
[0071] Step S3, associating the cigarette sample moisture content database with the cigarette odor characteristic data set, analyzing the relationship between moisture content and odor characteristics in historical samples of cigarettes from different manufacturers, and establishing a moisture content-odor characteristic regression prediction model;
[0072] Step S4, simulating the odor release and moisture content changes of cigarette samples under different environmental conditions, dynamically adjusting the moisture content-odor characteristic regression prediction model, and generating moisture content allowable error values corresponding to different environmental conditions;
[0073] Step S5, collecting the odor characteristics of the cigarette to be tested and inputting them into the moisture content-odor characteristic regression prediction model, combining the real-time monitored environmental condition data, adjusting the moisture content data output by the moisture content-odor characteristic regression prediction model, and obtaining an estimated value of the moisture content of the cigarette to be tested;
[0074] Step S6, determining the moisture content threshold range of the cigarette to be tested according to the moisture content estimation value of the cigarette to be tested and the moisture content allowable error value corresponding to the environmental condition data monitored in real time, and judging the authenticity of the cigarette to be tested by comparing the moisture content measurement data of the cigarette to be tested with the moisture content threshold range;
[0075] Step S7: construct a cigarette mixing related regression prediction model based on the presence of a cigarette mixing label on the cigarette to be tested and the mixing ratio of cigarettes from different manufacturers in the cigarette mixing label, combined with the moisture content-odor feature regression prediction models corresponding to different manufacturers, to identify the cigarette to be tested.
[0076] Furthermore, in this embodiment, step S1 specifically includes:
[0077] Obtain cigarette samples produced by multiple different manufacturers, collect basic information of the cigarette samples, enter them into the database, and establish a cigarette sample information table; the basic information of the cigarette samples includes cigarette brand, model, and batch;
[0078] Select cigarette samples to be measured according to the cigarette sample information table, use a moisture content measuring instrument to measure the moisture content of each cigarette sample, and use a temperature and humidity sensor to collect ambient temperature and humidity data in real time during the measurement process;
[0079] The collected moisture content measurement values of cigarette samples, ambient temperature and humidity data and sample information are associated to generate a complete sample measurement record, which is then stored in the cigarette sample moisture content database; the RaspberryPi development board is selected to realize data collection and synchronization between sensors and measuring instruments; the record fields include sample number, brand, model, batch, moisture content measurement value, measurement time, ambient temperature and ambient humidity; the data is stored in the cigarette sample moisture content database in JSON format;
[0080] Furthermore, the data in the moisture content database of cigarette samples were statistically analyzed to calculate the indicators of different brands of cigarettes under different temperature and humidity conditions, including the mean, variance, and range of moisture content. The environmental conditions were divided into categories according to different combinations of temperature and humidity, and the changing trend of moisture content of cigarettes under each category was analyzed.
[0081] According to the statistical analysis results, select a suitable prediction model, such as an ARIMA model based on time series or a support vector regression (SVR) model based on machine learning, to build a cigarette moisture content prediction model;
[0082] The cigarette moisture content prediction model is trained and tuned through feature selection and hyperparameter optimization methods. The moisture content change of cigarettes in different time spans in the future is predicted using historical sample data and corresponding environmental conditions. The prediction results are presented in the form of specific moisture content values and change trend graphs.
[0083] Regularly evaluate and optimize the cigarette moisture content prediction model, evaluate the model performance based on prediction error indicators, including root mean square error (RMSE) and mean absolute percentage error (MAPE), and optimize the model hyperparameters through cross-validation and grid search methods;
[0084] Model evaluation is performed regularly every day. When the prediction error exceeds the preset threshold, the model optimization process is triggered to generate an optimized model version. The model optimization and evaluation results are fed back to cigarette manufacturers to provide them with decision-making support for moisture content control and adjustment.
[0085] Regularly maintain and update the moisture content database of cigarette samples, and retrain the prediction model with newly collected sample data every week or month to adapt to possible changes in data distribution;
[0086] Here is an example:
[0087] When obtaining cigarette sample information, a barcode scanner can be used to read the barcode on the sample package to automatically identify the cigarette brand, model, and batch information. Then, the sample information can be uploaded to the database in JSON format through the API interface to create a cigarette sample information table.
[0088] When selecting samples to be measured, you can use SQL query statements to randomly select a certain number of samples from the sample information table, or filter samples based on specific conditions (such as brand, batch);
[0089] The DHT22 temperature and humidity sensor can be connected to the RaspberryPi through the I2C interface, and the Python AdafruitDHT library is used to read the sensor data. The ambient temperature and humidity data are collected every 1 minute and recorded synchronously with the moisture content measurement value. When performing data statistical analysis, the pandas library can be used to load the measurement records in JSON format into a DataFrame, and then the groupby function can be used to group by fields such as brand and environmental conditions, calculate the mean and variance of the moisture content of each group, and use the matplotlib library to draw visual charts such as box plots and line graphs of moisture content under different conditions to intuitively display the distribution characteristics and changing trends of moisture content;
[0090] When building a cigarette moisture content prediction model, we chose to use the ARIMA model and SVR model in the scikit-learn library, taking historical moisture content measurements, ambient temperature and humidity, and other features as input to predict the moisture content in the next 1, 3, and 7 days.
[0091] Optimize model hyperparameters through grid search and cross-validation, such as the p, d, and q values of the ARIMA model and the kernel function and regularization coefficient of the SVR model. Select the parameter combination with the smallest RMSE as the optimal model. Evaluate model performance on a daily basis. If the MAPE exceeds 5%, trigger the model retraining and optimization process.
[0092] The cigarette moisture content prediction model is updated every month using sample data from the most recent month, while the historical version model is retained. The prediction effects of the new and old models are compared through A / B testing. If the RMSE and MAPE of the new model are better than the old model, the new model is deployed online. Otherwise, it is rolled back to the old version model, and the hyperparameters are adjusted to retrain and optimize.
[0093] Furthermore, in this embodiment, step S2 specifically includes:
[0094] Obtain cigarette samples produced by multiple different manufacturers, collect basic information of the cigarette samples, enter them into the database, and establish a cigarette sample information table; the basic information of the cigarette samples includes cigarette brand, model, and batch;
[0095] According to the odor components and concentration range of the cigarette sample, a suitable odor sensor array combination is selected; the selection of a suitable odor sensor array combination should be based on the sensitivity, response time, and working temperature and humidity range indicators of the sensor;
[0096] Extracting odor characteristics of each cigarette sample according to the odor sensor array to obtain time-series odor signal data of the sample;
[0097] Preprocess the raw time series data collected by the odor sensor; the preprocessing includes outlier detection and removal, missing value processing, and data normalization;
[0098] Adopting the normalization method, combining the characteristics of cigarette odor data, selecting the appropriate normalization range and scaling factor; the normalization method can select the maximum and minimum value normalization or Z-score normalization;
[0099] A deep learning model for processing time series data is used to extract features and learn representations of the preprocessed odor signal data; a long short-term memory network (LSTM) can be selected as a deep learning model for processing time series data;
[0100] Design the specific structure of the deep learning model, and obtain the high-level feature representation of the odor signal through training; Design the specific structure of the deep learning model including the number of hidden layers, number of neurons, activation function, loss function and other hyperparameters, and obtain the high-level feature representation of the odor signal through training;
[0101] The odor signal characteristic data are annotated according to the manufacturer information of the cigarette samples; the odor characteristic data are annotated by manual olfactory identification and labeling, combined with the odor description in the product manual of the cigarette samples and the qualitative and quantitative results of the gas chromatography-mass spectrometry (GC-MS) analysis instrument;
[0102] Conduct quality control on the labeling process, divide the labeled odor characteristic data according to manufacturer information, and construct cigarette odor characteristic data sets from different manufacturers; for quality control, the method of multiple people's independent labeling and cross-validation can be selected;
[0103] Using machine learning algorithms, such as support vector machines (SVMs) and random forests, and deep learning algorithms, such as deep neural networks (DNNs), to classify and train cigarette odor feature datasets from different manufacturers;
[0104] During the training process, recursive feature elimination (RFE) and sequential feature selection (SFS) methods are used for feature selection, and confusion matrix, ROC curve, and F1 value evaluation indicators are used to evaluate model performance and select the model and feature subset with the best performance;
[0105] Establish a model update mechanism to regularly collect new cigarette sample data. When the amount of new data reaches a certain scale or the model performance drops below a threshold, use incremental learning or online learning to fine-tune and update the model with the new data. At the same time, monitor the trend of model performance changes and upgrade or roll back the model in a timely manner.
[0106] Here is an example:
[0107] When obtaining cigarette sample information, a barcode scanner can be used to read the barcode on the sample package, automatically identify information such as cigarette brand and model, and extract text information such as production date through OCR technology;
[0108] The sensor array is composed of six metal oxide gas sensors, including TGS2600, TGS2602, and TGS2620. The sensitivity of the sensor is within the range of 0.110ppm, the response time is less than 10s, the operating temperature is -1050℃, and the relative humidity is 5% to 95%;
[0109] The sensor array was placed in a sealed sample testing chamber, and the temperature in the chamber was controlled at 25°C and the relative humidity was 50% to ensure the consistency of the testing conditions of different samples. The odor signal of each sample was collected for 60 seconds, the sampling frequency was 10Hz, and each sensor collected 600 data points;
[0110] The time series data of each sensor is normalized to the maximum and minimum values, and the data is scaled to the interval [0,1] to eliminate the differences in the response amplitudes of different sensors. Then, the normalized time series data is input into the odor feature extraction model consisting of a 3-layer LSTM network. The number of hidden units in each LSTM layer is 128, and the ReLU activation function and mean_squared_error loss function are used. The optimizer is Adam, and the learning rate is set to 0.001.
[0111] After the model was trained for 100 epochs, the error on the validation set was less than 0.01, and the high-level feature vector of the odor signal was obtained;
[0112] Invite 5 experts with rich smoking experience to smell and annotate the odor characteristics of each cigarette sample, and compare them with the GC-MS analysis results to determine the main odor components of the samples and the manufacturers they belong to;
[0113] SVM and random forest models were used to classify the odor feature data. RFE and SFS were used to select the 20 most important features. Through 5-fold cross-validation and grid search, the optimal hyperparameters of SVM were determined to be Gaussian kernel function and regularization coefficient C=10, and the optimal hyperparameters of random forest were determined to be 100 decision trees and 10 maximum tree depth.
[0114] On the test set, the classification accuracy of SVM and random forest both reached over 95%, and the F1 value exceeded 0.95;
[0115] 200 new samples are collected every quarter. When the number of new samples accumulates to 1,000 or the accuracy of the model on new samples drops below 90%, the model is incrementally trained using the new samples and the performance of the updated model is evaluated to ensure continuous optimization and adaptability of the model.
[0116] Furthermore, in this embodiment, step S3 specifically includes:
[0117] The sample information of the cigarette sample moisture content database is matched with the sample information of the cigarette odor characteristic data set, and a comprehensive data set including the sample moisture content and odor characteristics is obtained by inner joining or left joining the two data sets; the inner joining or left joining of the two data sets is realized through the key fields such as sample number, brand, and model;
[0118] The comprehensive data set was cleaned and preprocessed, and the descriptive statistical analysis of the data set was performed using the Apriori association rule mining algorithm; data cleaning and preprocessing included removing sample records with missing values exceeding a preset ratio or containing obvious outliers; the water content data was linearly scaled to the interval [0, 1] using the minimum-maximum normalization method; the odor feature data was converted to a standard normal distribution with a mean of 0 and a standard deviation of 1 using the Z-score standardization method, and possible outliers in the normalized and standardized data were checked and processed; and the support and confidence threshold ranges of the Apriori algorithm were preliminarily estimated, and then the parameter settings were gradually adjusted and optimized through multiple experiments and parameter sensitivity analysis;
[0119] Evaluate the mined association rules in terms of statistical indicators and business significance, calculate the indicators of each rule, and screen out the rules with the highest association strength; the indicators of each rule include support, confidence, lift, and leverage;
[0120] The final moisture content-odor feature association rule set was obtained by combining rule filtering conditions with manual review. In order to better set the rules, the interpretability and operability of the rules were evaluated by combining cigarette domain knowledge and expert experience, and the rules that were inconsistent with business logic or redundant were eliminated.
[0121] A feature selection method was used to select the key odor feature subset with the highest correlation with moisture content and the strongest predictive ability from the odor feature data; the Pearson correlation coefficient and mutual information statistical indicators were used to evaluate the correlation between odor features and moisture content, and recursive feature elimination method and L1 regularization were used to select features based on model performance. Principal component analysis and independent component analysis were used to transform and reduce the dimension of the data;
[0122] Based on the selected key odor feature subset, a moisture content-odor feature regression prediction model is established;
[0123] Furthermore, multiple linear regression, decision tree regression, and support vector regression algorithms were used, respectively, with sample moisture content as the dependent variable and key odor characteristics as the independent variable, to train regression models, and hyperparameters were tuned through grid search and other methods to obtain candidate models with the optimal parameter combination;
[0124] The 5-fold cross-validation method is used to evaluate the performance of candidate regression models. The mean square error, determination coefficient, and mean absolute percentage error evaluation indicators of each model on the validation set are calculated. These indicators are weighted averaged according to the weight coefficients set according to business needs to obtain a comprehensive performance score.
[0125] The model with the highest comprehensive score and the best generalization performance is selected as the final moisture content prediction model, and the moisture content-odor feature association rules and prediction model are regularly updated and maintained;
[0126] Based on the newly collected cigarette sample data, the comprehensive data set is updated, the association rules are re-mined, and the prediction model is retrained and optimized;
[0127] When the number of new samples reaches a certain scale or the prediction error exceeds the threshold, the model update process is triggered to generate a new set of association rules and prediction models to adapt to the changing trend of data distribution and improve the accuracy and robustness of the model;
[0128] Here is an example:
[0129] When associating and fusing data sets, you can choose to use the SQL JOIN operation, use the sample number as the connection key, and perform inner or left connection on the moisture content database table and the odor feature dataset table to generate a comprehensive data table containing fields such as sample number, moisture content, and odor feature vector;
[0130] The comprehensive data table was cleaned by using the dropna() function in Python's pandas library to delete records with missing values exceeding 20% by row. The Z-score method was used to calculate the Z value of each field of each record. Records with an absolute value of Z greater than 3 were marked as outliers and removed.
[0131] The MinMaxScaler in the sklearn library is used to normalize the moisture content field, and the StandardScaler is used to standardize the odor feature field;
[0132] By calculating the descriptive statistical indicators of the comprehensive data table, such as the mean, standard deviation, and quantile of moisture content and odor characteristics, the minimum support and confidence thresholds of the Apriori algorithm were preliminarily estimated to be 0.05 and 0.8, respectively;
[0133] Use the apriori function and association_rules function in the mlxtend library to mine frequent item sets and association rules under the conditions of setting minimum support, confidence, and maximum item set length;
[0134] Calculate and sort the evaluation indicators of the rules, such as lift, leverage, conviction, etc., filter out invalid rules with lift less than 1 or conviction less than 1.2, and have business experts score the interpretability and operability of the rules, and eliminate rules with scores less than 3 points (out of 5 points);
[0135] The Pearson correlation coefficient, mutual information, Gini index and other indicators were used to evaluate the correlation between odor characteristics and water content, and the features with absolute correlation coefficients greater than 0.3 were selected as the preliminary feature pool. Based on the preliminary feature pool, the RFE recursive feature elimination method was applied to eliminate a certain proportion (for example, 10%) of features each time, and the regression model was repeatedly trained until the model performance began to decline, and the final key feature subset was obtained;
[0136] Based on the key odor feature subsets, we built models such as multivariate linear regression, decision tree regression, and support vector regression. We used 5-fold cross validation to perform grid search optimization on model hyperparameters (such as regularization coefficient, tree depth, and kernel function type) to obtain the optimal parameter combination for each model.
[0137] The sample data was randomly divided into a training set and a test set in a ratio of 8:2. Various models with the optimal parameter combination were fitted on the training set and predicted on the test set. The performance indicators such as MSE, R-square, and MAPE of each model were calculated. The comprehensive performance score was calculated with the weight coefficients of MSE, R-square, and MAPE being 0.5, 0.3, and 0.2 respectively. The support vector regression model with the highest comprehensive score was selected as the final model.
[0138] Regularly (for example, every quarter) use newly collected sample data to perform incremental training and performance evaluation on the model. When the number of new samples exceeds 20% of the original training samples or the MAPE of the model on the new samples exceeds 10%, the full model update process is triggered, and feature selection, model training and evaluation are re-performed to generate an updated prediction model.
[0139] Furthermore, in this embodiment, step S4 specifically includes:
[0140] Extract the environmental condition information corresponding to each cigarette sample from the cigarette sample moisture content database, perform feature selection and dimension reduction on the environmental condition parameters, and select the parameter subset with the highest correlation with cigarette moisture content and odor release;
[0141] Clustering algorithms are used to cluster parameter subsets, and the optimal number of clusters is determined by the elbow method or silhouette coefficient method to obtain several typical environmental condition categories;
[0142] For each typical environmental condition category, a simulation experiment plan is designed to simulate the odor release and moisture content change process of cigarette samples under different environmental conditions, and collect odor data and moisture content data in real time; the design of the simulation experiment plan needs to clearly define the range and accuracy requirements for controlling parameters such as temperature and humidity, use multiple sensors to monitor the environmental parameters in the experimental box in real time, and use the PID control algorithm to achieve dynamic adjustment and stable maintenance of environmental parameters. Appropriate cleaning and reset procedures are set between different batches of experiments to ensure the consistency of experimental conditions; by controlling the temperature and humidity parameters in the experimental box, the odor release and moisture content change process of cigarette samples under different environmental conditions are simulated;
[0143] The odor data and moisture content data collected from the simulation experiment are merged with the original cigarette sample moisture content-odor characteristic data set; when merging, attention should be paid to the differences in data format, sampling frequency, numerical range, etc., and the data should be cleaned, aligned and standardized as necessary;
[0144] Use timestamp or batch number fields to link and synchronize data from different sources to obtain an enhanced dataset containing sample data under different environmental conditions;
[0145] Based on the enhanced dataset, the moisture content-odor feature regression prediction model is retrained, and the environmental condition parameters are introduced as additional input features;
[0146] If there is an interactive effect between environmental conditions and odor characteristics, new composite features are constructed by combining or crossing features; for example, the product term of temperature and humidity, the interaction term of odor characteristics and temperature, to capture the modulation effect of environmental conditions on odor release and moisture content changes;
[0147] Dynamically adjust the parameters and structure of the moisture content-odor feature regression prediction model, and use cross-validation and Bootstrap methods to evaluate the prediction performance of the dynamically adjusted moisture content-odor feature regression prediction model under different environmental conditions, and calculate the prediction error distribution under various environmental conditions; adjust the parameters and results to adapt to the prediction tasks under different environmental conditions;
[0148] The allowable threshold and empirical rule of prediction error are set according to business needs. For each environmental condition category, the allowable error value of moisture content corresponding to different environmental conditions is generated according to its prediction error distribution and allowable threshold. The allowable threshold of prediction error is set according to business needs in combination with factors such as the quality grade and price positioning of cigarette products, usage scenarios and user experience under different environmental conditions, and the distribution of prediction errors in historical data. The empirical rule includes taking the mean of historical prediction errors plus or minus two standard deviations as the initial threshold, and then making dynamic adjustments based on business feedback and user evaluation.
[0149] On the basis of generating the environmental condition-water content allowable error mapping table, the corresponding relationship between the prediction error and the quality grade is further constructed, and the prediction error is divided into multiple intervals, each interval corresponds to a quality grade, forming a three-dimensional mapping table of environmental condition-water content prediction error-quality grade as a reference for product quality judgment;
[0150] Regularly update and maintain the environmental conditions-moisture content allowable error-quality grade mapping table, dynamically adjust the prediction model and error threshold based on newly collected cigarette sample data and simulation experiment data, and continuously optimize the prediction performance and business applicability;
[0151] Here is an example:
[0152] Environmental condition parameters, including temperature, humidity, and air pressure, were extracted from the moisture content database of cigarette samples. The Pearson correlation coefficient and mutual information index were used to evaluate the correlation between each parameter and the moisture content and odor release of cigarettes. Parameters with an absolute value of correlation coefficient greater than 0.6 or mutual information greater than 0.5 were selected as the final feature subset.
[0153] The feature subsets were normalized using Min-Max, and then clustered using the K-means clustering algorithm. The silhouette coefficients under different K values were calculated, and the K value with the largest silhouette coefficient was selected as the optimal number of clusters, resulting in five typical environmental condition categories.
[0154] For each category, a simulation experiment plan was designed to control the temperature in the experimental box within the range of 20±1℃ and the relative humidity within the range of 60%±5%, and the actual temperature and humidity values were recorded;
[0155] The DHT22 temperature and humidity sensor and the BMP280 air pressure sensor were used to collect environmental parameters in the experimental box through the Raspberry Pi, and the temperature and humidity were adjusted every 5 minutes using the PID control algorithm to stabilize them within the target range. At the same time, the MQ-135 gas sensor was used to collect the odor data of the cigarette samples, and the SHT31 temperature and humidity sensor was used to collect the moisture content data on the surface of the cigarette samples. The sampling frequency was 1 minute / time.
[0156] The collected odor sensor data and moisture content data were aligned according to the timestamps in ISO8601 format, and left-joined with the original dataset according to the sample number. Missing values were mean-filled, and features with a value range difference of more than 3 times were logarithmically transformed. Finally, an enhanced dataset containing 100,000 records and 30 features was obtained.
[0157] On the basis of the original regression prediction model, the interaction terms between environmental condition characteristics and odor characteristics are added, such as the product term between temperature and the concentration of seven main odor substances, the interaction term between humidity and water content, etc., to construct an augmented feature space.
[0158] Lasso regression with L1 regularization and tree-based GBDT model were used to optimize hyperparameters through grid search to obtain the optimal model parameters. 5-fold cross validation and Bootstrap resampling methods were used to evaluate the prediction performance under different environmental conditions, calculate indicators such as RMSE, MAE, R-square, and draw prediction error distribution histograms and box plots;
[0159] Referring to the national standard for cigarette samples, the upper limit of moisture content prediction error is 1% for high-end cigarettes, 1.5% for mid-range cigarettes, and 2% for low-end cigarettes. The prediction error is divided into four intervals: 0-1%, 1%-1.5%, 1.5%-2%, and above 2%, corresponding to the four quality levels of excellent products, qualified products, marginal products, and defective products, and a three-dimensional mapping table of environmental conditions-moisture content prediction error-quality level is established;
[0160] The mapping table is updated with 10,000 newly collected data every month. When the KL divergence between the distribution of new data and the original data is greater than 0.5, the prediction model is retrained. The updated mapping table is synchronized to the cigarette production and quality inspection links, and the mapping table is embedded in the production process parameter setting and quality inspection threshold determination system to achieve adaptive quality control based on environmental conditions and prediction errors;
[0161] The updated mapping table is synchronized to the cigarette production MES system and quality inspection LIMS system in JSON format to achieve end-to-end quality traceability.
[0162] Furthermore, in this embodiment, step S5 specifically includes:
[0163] The cigarette to be tested is placed in a simulated experimental environment, and the odor characteristic data and environmental condition data of the cigarette to be tested are collected in real time. The data at the last time point is selected as the representative odor characteristic of the cigarette to be tested, and the odor characteristic time series and environmental condition time series of the cigarette to be tested are obtained; the odor sensor array and environmental parameter sensor used in the model training stage are used to collect the odor characteristic data and environmental condition data of the cigarette to be tested in real time;
[0164] The collected time series of the odor characteristics of the cigarettes to be tested are preprocessed to obtain the standardized odor characteristic vector of the cigarettes to be tested; the preprocessing includes operations such as removing outliers, smoothing noise, and normalization, and then the wavelet transform algorithm is used to perform multi-scale decomposition on the time series to extract local time-frequency characteristics;
[0165] Inputting the standardized odor feature vector of the cigarette to be tested into the trained moisture content-odor feature regression prediction model, and outputting the corresponding moisture content prediction value according to the input odor feature vector;
[0166] Collecting real-time monitoring environmental condition data of the cigarettes to be tested, standardizing the environmental condition data using the Z-score standardization method, converting the value of each environmental parameter into a Z value under a standard normal distribution, and obtaining a standardized environmental condition feature vector; the real-time monitoring environmental condition data of the cigarettes to be tested include temperature, humidity, and air pressure;
[0167] Find the allowable moisture content prediction error range under the current environmental conditions in the three-dimensional mapping table, use the KNN algorithm to find the K historical environmental conditions that are most similar to the current environmental conditions, and take the intersection of the prediction error ranges under these K conditions as the current allowable prediction error range;
[0168] By calculating the Mahalanobis distance between the current environmental condition feature vector and all environmental condition feature vectors in the training data, when the distance exceeds the preset quantile of the training data, the current environmental condition is marked as an "abnormal environment";
[0169] According to the search result of the three-dimensional mapping table, the moisture content prediction value of the cigarette to be tested output by the moisture content-odor characteristic regression prediction model is dynamically calibrated to obtain the calibrated moisture content estimation value;
[0170] If the current environmental condition is marked as "abnormal environment", the estimated value of water content will be output and marked as "needs manual review";
[0171] Compare the calibrated estimated moisture content of the cigarette to be tested with the quality grade threshold in the three-dimensional mapping table to determine the quality grade of the cigarette to be tested. If the estimated moisture content is higher than the high-quality threshold, it is marked as "high-quality", if it is lower than the low-quality threshold, it is marked as "low-quality", and if it is between the two, it is marked as "qualified";
[0172] For cigarettes marked as "requires manual review", professional quality inspectors will conduct sensory evaluation and physical and chemical index tests, and feed back the review results to the system for updating and optimizing the three-dimensional mapping table and regression prediction model;
[0173] Here is an example:
[0174] Place the cigarette samples to be tested in a constant temperature and humidity chamber, set the temperature to 25±1℃, and the relative humidity to 60%±2%, consistent with the model training environment conditions;
[0175] Using the fox-4000 electronic nose odor sensor array and the SHT31 temperature and humidity sensor, data was collected every 1 minute for 5 consecutive minutes to obtain odor characteristic data and environmental condition data at 5 time points. For the odor characteristic data, the 8 sensor response values at the 5th minute were selected as the odor characteristic vector of the cigarette to be tested;
[0176] The odor feature vector is normalized to 0-1, and then decomposed into 5 scales using the db4 wavelet basis function in wavelet transform, and the wavelet coefficients of each scale are extracted as the time-frequency representation of the odor feature, and a total of 40 wavelet coefficient features are obtained. The 40 extracted odor wavelet features are input into the trained SVM regression model to obtain the preliminary prediction value of the moisture content of the cigarette to be tested;
[0177] For environmental condition data, the mean and standard deviation of temperature and humidity on historical environmental condition data are calculated respectively, and then the temperature and humidity values of the environmental conditions to be tested are Z-score standardized to obtain a standardized environmental feature vector;
[0178] The KNN algorithm is used to find the five nearest neighbors with the closest Euclidean distance from the historical environmental conditions, and the minimum value of the moisture content prediction error under these five nearest neighbors -0.5% and the maximum value of +0.8% are obtained as the moisture content prediction error range allowed under the current environment;
[0179] Calculate the Mahalanobis distance between the characteristic vector of the environment to be tested and the mean vector of the historical environmental conditions. If it exceeds twice the standard deviation of the historical data, it is determined to be an abnormal environment.
[0180] Calibrate the initially predicted moisture content according to the prediction error range. If the calibrated moisture content estimate exceeds the qualified product moisture content range of 15% to 18% and the environmental conditions are abnormal, mark the result as "requires manual review";
[0181] The estimated moisture content is compared with the national standard quality grade thresholds of ≤16% for superior products, 16% to 18% for qualified products, and >18% for defective products to obtain the quality grade;
[0182] For the cigarettes to be tested that need manual review, two quality inspectors with more than five years of experience will conduct sensory evaluation and KarlFischer titration to determine the moisture content, and fill in the review opinions;
[0183] When the review results are inconsistent with the system estimation results, it is necessary to conduct cause analysis and formulate improvement measures to form a closed-loop quality control process;
[0184] Upload the quality grade label and moisture content estimate of the tested cigarettes to the quality traceability system, generate a test report, and simultaneously update the moisture content database of cigarette samples;
[0185] If the manual review result is inconsistent with the system judgment result, the SVM model and KNN nearest neighbor are updated, and the cigarette formula and production process parameters are modified;
[0186] Upload moisture content estimates and quality grades to the MES system, print test labels, and write results to the sample line record database to achieve real-time monitoring of incoming material quality.
[0187] Furthermore, in this embodiment, step S6 specifically includes:
[0188] Obtain the moisture content estimation value and real-time temperature and humidity data of the cigarette to be tested, find the corresponding moisture content allowable error value interval in the environmental condition-moisture content error mapping table based on the real-time collected environmental parameter data, use the piecewise linear interpolation method to perform first-order interpolation on the environmental parameter value and error value at the end point of the interval, and obtain the allowable error value under the current environmental conditions; the moisture content estimation value is consumed from the output queue of the regression prediction model, and the environmental parameters are subscribed from the data stream of the monitoring system, and data synchronization and matching are performed through time windows and associated fields;
[0189] Performing addition and subtraction operations on the allowable error value obtained by interpolation and the estimated value of the moisture content of the cigarette to be tested, obtaining the upper and lower limits of the dynamic threshold value of the moisture content of the cigarette to be tested, and forming the current threshold range of the moisture content of the cigarette to be tested;
[0190] The threshold interval is adjusted according to the confidence level of the estimate (e.g., regression confidence interval, prediction standard error). The higher the confidence level, the narrower the threshold interval.
[0191] Regularly calibrate and monitor the performance of moisture content measuring instruments, automatically perform zero-point calibration and full-scale calibration before measurement, and record instrument measurement status and environmental parameters in real time;
[0192] Call the data interface of the instrument to obtain the moisture content measurement value of the current cigarette sample in real time, and convert the measurement value into a standard numerical format through data cleaning and format conversion. Mark and filter the measurement values that exceed the instrument measurement range or are under abnormal environmental conditions;
[0193] Use the interval judgment algorithm to match and compare the water content measurement value with the threshold range interval to determine whether the measurement value falls within the threshold interval. At the same time, the threshold range is expanded to multiple levels such as qualified, critical, and unqualified, and the corresponding judgment results are given according to the position of the measurement value within different threshold ranges;
[0194] The authenticity determination result is associated with other attribute information of the cigarette sample to be tested to generate structured sample determination record data, including fields such as sample number, brand, moisture content estimation value, moisture content measurement value, threshold range, environmental parameters, and determination result.
[0195] Furthermore, in this embodiment, in step S6, determining the authenticity of the cigarette to be tested includes the following steps:
[0196] If the measured value of the moisture content of the cigarette to be tested is within the moisture content threshold range of the cigarette to be tested, it is judged to be a genuine cigarette;
[0197] If the measured value of the moisture content of the cigarette to be tested is not within the moisture content threshold range of the cigarette to be tested, it is judged to be a fake cigarette;
[0198] An example of step S6 is as follows:
[0199] The estimated moisture content of the cigarette sample to be tested is obtained through the message queue Kafka, and the estimated value is consumed from the output queue of the random forest regression model. At the same time, the real-time temperature and humidity data are subscribed from the environmental monitoring system through the MQTT protocol, and a 5-minute time window is set. The two data streams are correlated and matched by the sample number;
[0200] According to the real-time collected temperature of 25℃ and humidity of 65%, the corresponding moisture content allowable error value interval is found in the environmental condition-moisture content error mapping table. The environmental parameter values (20℃, 60%) and (30℃, 70%) at the end points of the interval and the corresponding error values 5% and 5% are interpolated in the first order by piecewise linear interpolation method, and the accurate allowable error value under the current environmental conditions is 08%;
[0201] The interpolated allowable error value of 08% is added and subtracted from the estimated moisture content of the sample to be tested, 15%, and the upper limit of the dynamic threshold of the moisture content of the sample is 158%, and the lower limit is 142%.
[0202] At the same time, the threshold interval is adjusted according to the confidence level of the estimated value of 95%. The higher the confidence level, the narrower the threshold interval. The adjusted threshold interval is;
[0203] Regularly calibrate and monitor the performance of infrared moisture measuring instruments, automatically perform zero point calibration and full scale calibration before measurement, and record the instrument measurement status and environmental parameters in real time;
[0204] The RS485 data interface of the instrument is called to obtain the moisture content of the current cigarette sample to be tested in real time, which is 13%. The measured value is converted into a standard numerical format through data cleaning and format conversion;
[0205] Mark and filter the measured values that exceed the instrument measurement range of 0-20% or the environmental conditions are abnormal. Use the interval judgment algorithm to match and compare the water content measurement value of 13% with the threshold range interval to determine whether the measured value falls within the threshold interval.
[0206] The threshold range is expanded to three levels: qualified, critical, and unqualified. The corresponding judgment result is given as qualified according to the position of the measured value within the qualified threshold range;
[0207] The authenticity determination result is associated with other attribute information of the cigarette sample to be tested to generate structured sample determination record data, including fields such as sample number S10001, brand Yunyan, estimated moisture content 15%, measured moisture content 13%, threshold range, environmental parameters 25°C and 65%, and qualified determination result;
[0208] Regularly conduct statistical analysis on historical judgment record data in the cigarette authenticity identification database, calculate indicators such as the genuine cigarette rate and counterfeit cigarette rate of each brand of cigarettes, and the judgment accuracy rate under different environmental conditions, and use visual methods such as percentage charts and control charts to display them, intuitively reflecting the judgment results of each brand of cigarettes and environmental conditions;
[0209] The rule-based expert system Drools is used to abstract business rules into IF-THEN form, and matching and reasoning are performed through the rule engine to automatically generate warning information and disposal suggestions. At the same time, machine learning algorithms such as decision tree C5 and association rule Apriori are introduced to mine hidden patterns and rules from historical judgment records and dynamically optimize threshold ranges and judgment rules.
[0210] Furthermore, in this embodiment, step S7 specifically includes:
[0211] According to the mixed label information of the cigarettes to be tested and the characteristics of the cigarette packaging labels, the corresponding recognition technology is selected, and the verification and error correction mechanism of the recognition results is established to form a mixed ratio vector;
[0212] According to the manufacturer information in the mixed tag, the moisture content-odor feature regression prediction model corresponding to each manufacturer is searched in the cigarette manufacturer-model mapping table, each manufacturer's model is loaded into the memory, a cigarette mixing-related regression prediction model is constructed, and a model list is formed;
[0213] Furthermore, the mixture ratio vector is normalized. The normalization method may be maximum and minimum value normalization, zero mean unit variance normalization, or Softmax normalization. An appropriate normalization function is selected according to the distribution characteristics of the mixture ratio data.
[0214] The normalized weight coefficient can be directly used for weighted averaging, or further regularized or constrained. For example, L1 regularization can produce a sparse weight vector, L2 regularization can control the magnitude of the weight, and non-negative weight constraints can avoid the appearance of negative weights, etc., to optimize the properties and effects of the weight coefficient.
[0215] Construct a weighted average function, and average the prediction results of each manufacturer's model according to the optimized weight coefficient to obtain the preliminary prediction output of the cigarette mixing model;
[0216] On the basis of weighted average, an ensemble learning algorithm is further adopted. The ensemble learning algorithm can select Bayesian model averaging or stacking to integrate the prediction results of each manufacturer's model again.
[0217] For Bayesian model averaging, different prior probabilities are set according to the prior performance of each manufacturer's model or expert experience, and then the likelihood probability of each model is calculated using the mixed cigarette sample data, the posterior probability is calculated using the Bayesian theorem, and the prediction results of each model are weighted averaged according to the posterior probability;
[0218] For stacking, the prediction results of each manufacturer's model are used as the input features of the secondary learner, and a meta-learner (such as Logistic regression, decision tree) is trained to learn how to combine these prediction results. The output of the meta-learner is the final prediction result.
[0219] Conduct confidence assessment on the predicted output of the cigarette mixture model, evaluate the generalization performance of the model on mixed cigarette sample data through cross-validation or Bootstrap method, and calculate confidence indicators (e.g., confidence interval, p-value);
[0220] According to business needs and model performance, set a confidence threshold. When the confidence of the model on a new mixed cigarette sample is lower than the threshold, trigger model retraining or fine-tuning;
[0221] Retraining can use new sample data to train the model from scratch, and fine-tuning can use new sample data to partially adjust the model parameters based on the original model. Both can improve the adaptability and robustness of the model.
[0222] The prediction results of the cigarette mixture model are associated with other characteristic information to achieve multi-dimensional comprehensive judgment;
[0223] Through the data acquisition and preprocessing module, characteristic data such as environmental conditions (including temperature and humidity), water content measurement values, and authenticity identification results are obtained;
[0224] Using data fusion or feature combination methods, the prediction results are aligned with these features according to timestamps or batch numbers to form a multi-dimensional sample feature vector;
[0225] A classification algorithm is used. The classification algorithm may be a decision tree, a support vector machine, or a neural network. A comprehensive discrimination model is trained to make a comprehensive judgment on the authenticity and quality grade of cigarettes based on the values of multiple feature dimensions.
[0226] During the training process, methods such as feature selection or feature importance analysis are used to identify key features that have a greater impact on the discrimination results. Based on expert knowledge and business rules, some abnormal conditions or filtering rules are set to verify and optimize the discrimination results and output the final identification report.
[0227] Furthermore, in this embodiment, in step S7, selecting the corresponding recognition technology includes the following steps:
[0228] If the mixing ratio information is printed on the label in text form, OCR technology is used to extract the mixing ratio data by preprocessing, segmenting, feature extraction and pattern matching the label image;
[0229] If the mixing ratio information is stored in the form of an RFID tag or an NFC tag, the mixing ratio is obtained by reading the data block in the tag using the corresponding radio frequency identification technology;
[0230] An example of step S7 is as follows:
[0231] The mixed labels of the tested cigarettes are captured by a high-definition camera, and the TesseractOCR engine is used to perform text recognition on the images, with a recognition accuracy of more than 95%;
[0232] The mixing ratio information is printed on the label in the format of "factory A 20%, factory B 30%, factory C 50%". The ratio data of each manufacturer is extracted through regular expressions to form a mixing ratio vector (0.2, 0.3, 0.5);
[0233] Use the Newton-Raphson method to perform Softmax normalization on the mixed ratio vector to obtain the weight coefficient vector (0.25, 0.32, 0.43), and then apply L1 regularization to sparse the weights to obtain the final weight coefficients (0.3, 0, 0.7);
[0234] According to the name of the cigarette manufacturer, the corresponding moisture content-odor feature regression prediction model is searched in the hash table, and the models of Factory A and Factory C are loaded;
[0235] The model of Plant A is based on SVM regression, with 8-dimensional odor features as input and moisture content prediction as output; the model of Plant C is based on decision tree regression, with 12-dimensional odor features as input and moisture content prediction as output. The prediction results of the two models are multiplied by weight coefficients 0.3 and 0.7 respectively, and then added together to obtain the preliminary prediction value of the hybrid model of 16.5%;
[0236] Combining the prior probability of 0.6 of the model of Factory A and the prior probability of 0.4 of the model of Factory C, the likelihood probability and the posterior probability were calculated, and the final prediction value of 16.2% based on the average of the Bayesian model was obtained as the output of the cigarette mixing model;
[0237] The mean square error and coefficient of determination of the model on mixed cigarette samples were calculated using 10-fold cross validation, and MSE=0.8, R_squared=0.85 were obtained;
[0238] Set the confidence threshold to 0.9 and the confidence of the current model to 0.8, triggering the model fine-tuning process;
[0239] 100 newly collected mixed cigarette samples were randomly selected, and the model parameters were fine-tuned using the Adam optimizer and L2 regularization. After 50 iterations, the MSE was reduced to 0.6 and the R_squared was increased to 0.92, meeting the threshold requirements.
[0240] The current workshop temperature of 26°C and humidity of 60% are obtained from the environmental monitoring system (the environmental monitoring system is used to collect temperature and humidity). Combined with the moisture content of 16.8% measured by the infrared spectroscopy of the cigarette online quality inspection system, a feature vector (16.2%, 26, 60%, 16.8%) is constructed and input into the comprehensive discriminant model. The model is trained with the XGBoost algorithm. According to feature importance analysis, the predicted moisture content and online moisture content measurement are the most critical features.
[0241] The authenticity probability of the model output is 0.95, which is higher than the authenticity threshold of 0.9. The quality grade is A, which is consistent with the manual identification result. The model performance indicators AUC=0.98, F1=0.95, meet the business requirements. The model performance has been stable for three consecutive months and no reconstruction rules have been triggered.
[0242] In the description of the present disclosure, it is necessary to understand that the directions or positional relationships indicated by directional words such as "front, back, up, down, left, right", "lateral, vertical, horizontal" and "top, bottom" are usually based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description. Unless otherwise specified, these directional words do not indicate or imply that the device or element referred to must have a specific orientation or be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the scope of protection of the present disclosure.
[0243] For those skilled in the art, various other corresponding changes and deformations can be made according to the technical solutions and concepts described above, and all of these changes and deformations should fall within the protection scope of the claims of the present disclosure.
Claims
1. A method for testing the authenticity of mixed cigarette samples, characterized in that: include: Step S1, obtaining cigarette samples produced by different manufacturers, measuring the moisture content of each of the cigarette samples, and monitoring and recording the environmental conditions during the measurement process in real time to establish a cigarette sample moisture content database; Step S2, extracting the odor characteristics of each of the cigarette samples, and classifying the extracted odor characteristic data to construct a cigarette odor characteristic data set of different manufacturers; Step S3, associating the cigarette sample moisture content database with the cigarette odor characteristic data set, analyzing the relationship between moisture content and odor characteristics in historical samples of cigarettes from different manufacturers, and establishing a moisture content-odor characteristic regression prediction model; Step S4, simulating the odor release and moisture content changes of the cigarette sample under different environmental conditions, dynamically adjusting the moisture content-odor characteristic regression prediction model, and generating moisture content allowable error values corresponding to different environmental conditions; Step S5, collecting the odor characteristics of the cigarette to be tested and inputting them into the moisture content-odor characteristic regression prediction model, combining the environmental condition data monitored in real time, adjusting the moisture content data output by the moisture content-odor characteristic regression prediction model, and obtaining an estimated value of the moisture content of the cigarette to be tested; Step S6, determining a threshold range of moisture content of the cigarette to be tested according to the moisture content estimation value of the cigarette to be tested and the moisture content allowable error value corresponding to the environmental condition data monitored in real time, and judging the authenticity of the cigarette to be tested by comparing the moisture content measurement data of the cigarette to be tested with the moisture content threshold range; Step S7: construct a cigarette mixing related regression prediction model based on the cigarette mixing label and the mixing ratio of cigarettes from different manufacturers in the cigarette mixing label, combined with the moisture content-odor characteristic regression prediction model corresponding to different manufacturers, to identify the cigarette to be tested.
2. The authenticity testing method for mixing multiple cigarette samples according to claim 1, characterized in that: The step S1 specifically includes: Obtaining the cigarette samples produced by multiple different manufacturers, collecting basic information of the cigarette samples, and entering the information into a database to establish a cigarette sample information table; Selecting the cigarette samples to be measured according to the cigarette sample information table, measuring the moisture content of each cigarette sample using a moisture content measuring instrument, and collecting ambient temperature and humidity data in real time during the measurement process using a temperature and humidity sensor; The collected cigarette sample moisture content measurement values, environmental temperature and humidity data and sample information are associated to generate a complete sample measurement record, and stored in the cigarette sample moisture content database.
3. The authenticity testing method for mixing multiple cigarette samples according to claim 1, characterized in that: The step S2 specifically includes: Obtaining the cigarette samples produced by multiple different manufacturers, collecting basic information of the cigarette samples, and entering the information into a database to establish a cigarette sample information table; Selecting a suitable odor sensor array combination according to the odor components and concentration range of the cigarette sample; Extracting odor characteristics of each cigarette sample according to the odor sensor array to obtain time-series odor signal data of the sample; Preprocess the raw time series data collected by the odor sensor; Using the normalization method, combined with the characteristics of cigarette odor data, the appropriate normalization range and scaling factor are selected; A deep learning model that processes time series data is used to perform feature extraction and representation learning on the preprocessed odor signal data; Design the specific structure of the deep learning model and obtain high-level feature representation of odor signals through training; Annotating the odor signal characteristic data according to the manufacturer information of the cigarette sample; The labeling process is quality controlled, the labeled odor characteristic data are divided according to manufacturer information, and the cigarette odor characteristic data sets of different manufacturers are constructed.
4. The authenticity testing method for mixing multiple cigarette samples according to claim 1, characterized in that: The step S3 specifically includes: Matching the sample information of the cigarette sample moisture content database with the sample information of the cigarette odor characteristic data set, and obtaining a comprehensive data set including sample moisture content and odor characteristics by inner joining or left joining the two data sets; Perform data cleaning and preprocessing on the comprehensive data set, and perform descriptive statistical analysis on the data set using the Apriori association rule mining algorithm; Evaluate the mined association rules in terms of statistical indicators and business significance, calculate the indicators of each rule, and select the rules with the highest association strength; The final moisture content-odor feature association rule set is obtained by combining rule filtering conditions with manual review; Using feature selection methods, a subset of key odor features with the highest correlation with water content and the strongest predictive ability is selected from the odor feature data; Based on the selected subset of key odor characteristics, a moisture content-odor characteristic regression prediction model is established.
5. The authenticity testing method for mixing multiple cigarette samples according to claim 1, characterized in that: The step S4 specifically includes: Extracting environmental condition information corresponding to each of the cigarette samples from the cigarette sample moisture content database, performing feature selection and dimension reduction on environmental condition parameters, and selecting a parameter subset with the highest correlation with cigarette moisture content and odor release; Clustering algorithms are used to cluster parameter subsets, and the optimal number of clusters is determined by the elbow method or silhouette coefficient method to obtain several typical environmental condition categories; Design a simulation experiment plan for each typical environmental condition category, simulate the odor release and moisture content change process of the cigarette sample under different environmental conditions, and collect odor data and moisture content data in real time; The odor data and moisture content data collected from the simulation experiment are combined with the original cigarette sample moisture content-odor characteristic data set; Use timestamp or batch number fields to link and synchronize data from different sources to obtain an enhanced dataset containing sample data under different environmental conditions; Based on the enhanced data set, the moisture content-odor feature regression prediction model is retrained, and the environmental condition parameters are introduced as additional input features; If there is an interactive effect between environmental conditions and odor characteristics, new composite features are constructed by combining or crossing features; Dynamically adjusting the parameters and structure of the moisture content-odor characteristic regression prediction model, and using cross-validation and Bootstrap methods to evaluate the prediction performance of the dynamically adjusted moisture content-odor characteristic regression prediction model under different environmental conditions, and calculating the prediction error distribution under various environmental condition categories; The allowable threshold and empirical rule of prediction error are set according to business needs. For each environmental condition category, the allowable error value of moisture content corresponding to different environmental conditions is generated according to its prediction error distribution and allowable threshold.
6. The authenticity testing method for mixing multiple cigarette samples according to claim 1, characterized in that: The step S5 specifically includes: Placing the cigarette to be tested in a simulated experimental environment, collecting odor characteristic data and environmental condition data of the cigarette to be tested in real time, selecting the data at the last time point as the representative odor characteristic of the cigarette to be tested, and obtaining a time series of the odor characteristic and the environmental condition of the cigarette to be tested; Preprocessing the collected time series of odor characteristics of the cigarette to be tested to obtain a standardized odor characteristic vector of the cigarette to be tested; Inputting the standardized odor feature vector of the cigarette to be tested into the trained moisture content-odor feature regression prediction model, and outputting the corresponding moisture content prediction value according to the input odor feature vector; Collecting real-time monitoring environmental condition data of the cigarette to be tested, standardizing the environmental condition data using a Z-score standardization method, converting the value of each environmental parameter into a Z value under a standard normal distribution, and obtaining a standardized environmental condition feature vector; Find the allowable moisture content prediction error range under the current environmental conditions in the three-dimensional mapping table, use the KNN algorithm to find the K historical environmental conditions that are most similar to the current environmental conditions, and take the intersection of the prediction error ranges under these K conditions as the current allowable prediction error range; By calculating the Mahalanobis distance between the current environmental condition feature vector and all environmental condition feature vectors in the training data, when the distance exceeds the preset quantile of the training data, the current environmental condition is marked as "abnormal environment"; According to the search result of the three-dimensional mapping table, the moisture content prediction value of the cigarette to be tested output by the moisture content-odor characteristic regression prediction model is dynamically calibrated to obtain a calibrated moisture content estimation value.
7. The authenticity testing method for mixing multiple cigarette samples according to claim 1, characterized in that: The step S6 specifically includes: Obtain the estimated value of the moisture content and the real-time temperature and humidity data of the cigarette to be tested, search the corresponding moisture content allowable error value interval in the environmental condition-moisture content error mapping table according to the real-time collected environmental parameter data, and use the piecewise linear interpolation method to perform first-order interpolation on the environmental parameter values and error values at the endpoints of the interval to obtain the allowable error value under the current environmental conditions; The interpolated allowable error value is added and subtracted from the estimated moisture content of the cigarette to be tested to obtain the upper and lower limits of the dynamic threshold of the moisture content of the cigarette to be tested, thereby forming the current moisture content threshold range of the cigarette to be tested.
8. The authenticity testing method for mixing multiple cigarette samples according to claim 7, characterized in that: In step S6, judging the authenticity of the cigarette to be tested includes the following steps: If the measured value of the moisture content of the cigarette to be tested is within the moisture content threshold range of the cigarette to be tested, it is judged to be a genuine cigarette; If the measured value of the moisture content of the cigarette to be tested is not within the moisture content threshold range of the cigarette to be tested, it is judged to be a fake cigarette.
9. The authenticity testing method for mixing multiple cigarette samples according to claim 1, characterized in that: The step S7 specifically includes: According to the obtained mixed label information of the cigarette to be tested and the characteristics of the cigarette packaging label, a corresponding recognition technology is selected, and a verification and error correction mechanism of the recognition result is established; According to the manufacturer information in the mixed tag, the moisture content-odor feature regression prediction model corresponding to each manufacturer is searched in the cigarette manufacturer-model mapping table, each manufacturer's model is loaded into the memory, the cigarette mixing related regression prediction model is constructed, and a model list is formed.
10. The authenticity testing method for mixing multiple cigarette samples according to claim 9, characterized in that: In step S7, selecting the corresponding recognition technology includes the following steps: If the mixing ratio information is printed on the label in text form, the OCR technology is used to extract the mixing ratio data by preprocessing, segmenting, feature extraction and pattern matching the label image; If the mixing ratio information is stored in the form of an RFID tag or an NFC tag, the mixing ratio is obtained by reading the data block in the tag using the corresponding radio frequency identification technology.
Citation Information
Patent Citations
Method for accurate characterization and evaluation of milky aroma characteristic in cigarette aroma
CN105092729A
Implementation method of intelligent cigarette authenticity identification system
CN116308410A
Quality control and standardisation of tobacco by means of NMR and pattern recognition
WO2002012872A1
