Junjie
Chen
ab,
Xiaojian
Hao
*ab,
Biming
Mo
ab,
Shuaijun
Li
ab,
Junjie
Ma
ab,
Xiaodong
Liang
ab,
Zheng
Wang
ab and
Heng
Zhang
c
aScience and Technology on Electronic Test and Measurement Laboratory, North University of China, Taiyuan, Shanxi, China. E-mail: haoxiaojian@nuc.edu.cn
bState Key Laboratory of Dynamic Measurement Technology, North University of China, Taiyuan, Shanxi, China
cJincheng Research Institute of Opto-mechatronics Industry, Jincheng, Shanxi, China
First published on 9th August 2024
As a kind of plant with complex chemical composition, the different compositions of tobacco determine the quality of tobacco, which in turn determines the quality of its cigarette products, so high-precision and rapid identification of different brands of cigarettes is of great significance for combating the market of counterfeit and shoddy cigarettes and safeguarding people's life and health. Traditional cigarette detection methods are time-consuming and subjective, and the analysis results are not objective and precise enough, whereas this study proposes a combination of cavity-constrained laser-induced breakdown spectroscopy (LIBS) and gray wolf optimization algorithm optimized bidirectional long short-term memory (GWO-BiLSTM) networks for classifying and identifying cigarette samples of 10 different brands. The signal-to-noise ratio and enhancement factor of the spectral intensity signal, LIBS plasma temperature and density are compared for different sizes of cavity constraints, and an optimal spectral enhancement size of 5 mm in both cavity height and diameter is selected. Comparing four different spectral downscaling methods, namely, principal component analysis (PCA), robust principal component analysis (RPCA), linear discriminant analysis (LDA), and t-distribution-stochastic neighborhood embedding (t-SNE), the LDA downscaling model is selected to achieve effective downscaling of the LIBS spectral data. By comparing the classification performance of the three models, the long short-term memory (LSTM) network, bidirectional long short-term memory (BiLSTM) network, and GWO-BiLSTM network, the GWO-BiLSTM model can achieve a classification accuracy of up to 98.31% in the test set. The results show that the classification method for different brands of cigarettes proposed in this study can effectively solve the technical pain points of traditional tobacco detection methods and provide a technical means to prevent the circulation of counterfeit cigarettes.
In recent years, there have been some scholars who have conducted relevant studies on tobacco by using the LIBS technology. Silvestre et al.11 used LIBS to directly measure the elemental concentrations of Ba, Ca, K and Mn in tobacco and compared them with those determined by inductively coupled plasma emission spectrometry (ICP-OES) with a 95% confidence level. Ahmed et al.12 utilized LIBS to quantify the presence of trace elements in different brands of Pakistani tobacco by comparing the results with those measured by laser ablation time-of-flight mass spectrometry (LA-TOFMS) measurements, and the error in the determination of trace element concentration was within 2%. Gondal et al.13 used pulsed UV laser induced breakdown spectroscopy to determine the concentration of elemental fluorine in cigarettes and the limit of detection for elemental fluorine was 14 ppm using a LIBS spectrometer. All these studies show that the LIBS technique has a strong prospect for application in the quantitative analysis of internal elements in tobacco but to the best of our knowledge no research group has yet brought the technology to the forefront of quantitative analysis of internal elements in cigarettes. To our knowledge, no research group has yet combined the LIBS technique with tobacco for taxonomic identification.
There are also several research groups that have utilized LIBS techniques to classify and identify substances with the assistance of machine learning and have demonstrated strong substance identification capabilities. Stefas et al.14 utilized LIBS combined with different machine learning algorithms to classify 10 different honey samples, and the results showed that with the assistance of machine learning algorithms, the honey samples were all classified with greater than 95% accuracy. Zhang et al.15 used the LIBS technique combined with linear discriminant analysis (LDA) and a support vector machine (SVM) to classify and recognize ginkgo biloba leaves from eight different locations in Xi'an City, respectively, and the accuracy of origin recognition of ginkgo biloba leaves reached 97.50% and 96.25% for LDA and SVM, respectively, and the results show that the LIBS technique can track ginkgo biloba with the help of multivariate statistical methods for the geographic origin. Tang et al.16 used the unsupervised learning algorithm of laser-induced breakdown combined with a self-organizing map (SOM) and K-means to differentiate industrial polymers in open air, and the K-means clustering algorithm could achieve a classification accuracy of 99.2% for 20 polymers, which verified the feasibility of clustering industrial polymers using LIBS. Moros et al.17 used LIBS combined with a decision tree algorithm to classify 10 different refractory residues, and the experimental results showed that the classification accuracy was as high as 75%. Zhao et al.18 utilized LIBS combined with a convolutional neural network (CNN) to classify brands of iron ore, and the classification accuracy of 5-fold cross-validation reached 99.88%. These above studies show that the combination of LIBS technology and machine learning algorithms has a broad application prospect for classifying and recognizing product substances such as food, plants, polymers and ores.
Currently, there is still a lack of relevant research on the rapid detection of original tobacco and the real-time rapid classification of different brands of cigarettes; therefore, in order to address these issues, this paper constructs a cavity constraint-based LIBS system (CC-LIBS) and an intelligent qualitative analysis model based on the gray wolf algorithm optimization of bidirectional long short-term memory (GWO-BiLSTM) networks from the following aspects to provide a fast and reliable method for cigarette brand classification as well as tobacco authentication, providing a fast and reliable method to provide an efficient and accurate way for the current tobacco anti-counterfeiting detection technology.
• The enhancement factor, signal-to-noise ratio (SNR), plasma temperature, and plasma density of LIBS data for different aluminum cavity sizes were comprehensively compared to obtain the cigarette spectral data for the optimal cavity enhancement size.
• Efficient extraction of spectral features using linear discriminant analysis for efficient optimization of spectral data.
• An intelligent qualitative analysis model based on the gray wolf algorithm for optimizing bidirectional long- and short-term memory networks was designed independently to improve the performance of the qualitative analysis model.
Label | Brand of cigarette | Place of origin |
---|---|---|
JY001 | Fu rong wang | Changde City, Hunan Province |
JY002 | Hao mao | Baoji City, Shaanxi Province |
JY003 | Hong ta shan | Yuxi City, Yunnan Province |
JY004 | Huang jin ye | Zhengzhou City, Henan Province |
JY005 | Kuan zhai | Chengdu City, Sichuan Province |
JY006 | Tai shan | Jinan City, Shandong Province |
JY007 | Tian zi | Chongqing City |
JY008 | Xiao Xiong mao | Kunming City, Yunnan Province |
JY009 | Ying chun | Changchun City, Jilin Province |
JY010 | Zhong hua | Hengyang City, Hunan Province |
We set the experimental parameters: the laser energy was set to 200 mJ, the laser spot size was 75 μm, the repetition frequency was 2 Hz, and the acquisition delay time was 0.03 μs. In order to improve the representativeness of the cigarette samples, cigarette samples of each brand were produced from 9 batches of produced cigarettes, 10 pressed samples were produced from different batches of the same brand, and each pressed sample was sampled 9 times, respectively. In order to minimize the sample differences and to improve the reproducibility of the spectral data of the cigarette samples, 2 sets of laser pulses were first cleaned on the sample surface to remove the oxidized substances on the sample surface to ensure the uniformity of the surface of different cigarette press samples. In this study, the number of laser pulses was set to be cleaned 2 times and ablated 10 times, and the average value of each ablated point going for 10 times was taken as the spectral intensity value of the point, and a 3 × 3 square excitation region was formed using each sample press to obtain a total of 8100 spectral data.
The LSTM structure includes input gates It, forgetting gates Ft and output gates Ot, as well as temporary memory states t, current memory states Ct and final hidden layer states Ht. The computational eqn (1)–(6) describe the computational process in LSTM, which includes the computation of each gate and the updating formula of the state.
However, the classical LSTM neural network can only learn the dependencies from the front to the back data.22 In order to make the traditional LSTM neural network better capture the long-term dependencies in the sequences, the backward LSTM neural network is introduced. BiLSTM is composed of forward LSTM and reverse LSTM, and the input information is in the two directions of frontward and reverse, respectively. Calculations are performed on the information acquired in both the front and back directions, in order to be able to process the bi-directional correlation features of the sequence data in a more complete way and to provide a more accurate representation of the features.23Fig. 4 shows the structure of BiLSTM.
It = σ(XtWxi + Ht−1Whi + bi) | (1) |
Ft = σ(XtWxf + Ht−1Whf + bf) | (2) |
Ot = σ(XtWxo + Ht−1Who + bo) | (3) |
t = tanh(XtWxc + Ht−1Whc + bc) | (4) |
Ct = Ft × Ct−1 + It × t | (5) |
Ht = Ot × tanh(Ct) | (6) |
In the BiLSTM neural network, the last outputs of forward and reverse are spliced as inputs to the next layer.24 The spliced output includes the combined forward and reverse information, which can provide more accurate prediction conditions for the neural network, and eqn (7) describes the splicing process of the output:
(7) |
(8) |
(9) |
(10) |
(11) |
In the above equation, is the convergence factor, which decreases linearly from 2 to 0 during the iteration process and and are random vectors in [0,1]. When the gray wolf identifies the prey location, it guides the ω – rank wolf pack to surround the prey under the leadership of α, β and δ. The mathematical model of the ω – rank wolf pack to surround the prey location is as follows:
(12) |
(13) |
(14) |
Eqn (13) defines the step length and direction of the ω – rank wolves toward α, β and δ, respectively, and eqn (14) defines the final position of the ω – rank wolves. During the iterative optimization process, the value of decreases linearly from 2 to 0, corresponding to the value of varying in the interval [−a,a], and is a random vector between [0,2], which denotes the random weight of the impact of the location of the gray wolf on the prey.
The GWO algorithm is represented in Fig. 5 searching for prey in a two-dimensional space while updating the positions of α, β and δ. The final position of α, β and δ is a randomized circle defined by the positions of α, β and δ in the search space. We can observe that the final position is a random position within a circle defined by the positions of α, β and δ in the search space. In other words the α, β and δ ranked packs estimate the position of the prey while the ω ranked packs update their position randomly around the prey and finally attack the prey successfully.
Fig. 6 Plot of variation in the constraint enhancement factor for aluminum cavities of different sizes. |
In Fig. 6, we can see that with the increase in the height of the cylindrical aluminum cavity, the enhancement factor shows a tendency to increase and then decrease and reaches a maximum value at a height of 5 mm. This is because as the height of the cavity increases, the height of the plasma plume limited by the cavity also increases, which is more effective in reflecting the shock wave and compressing the plasma plume, but if the height of the cavity is too large, the cavity will block part of the light radiated by the plasma, and therefore the spectral intensity collected at a height of 6 mm is smaller than that at 5 mm. For aluminum cavities with different diameters of the same height, the enhancement factors are all maximal at a diameter of 5 mm and decrease at 6 mm. This is due to the fact that in a cavity with a diameter of 6 mm, the shock wave encounters the cavity wall reflecting back to the center for a longer period of time, and the intensity of the shock wave is weakened, which makes the spectral enhancement effect decrease, and finally we find that the enhancement factor is maximal at a height and a diameter of 5 mm, with a maximum value of 4.02.
In Fig. 7, we can see that with the increase in the cavity height, the signal-to-noise ratio also shows a trend of increasing and then decreasing, and at the same height, the signal-to-noise ratio of the aluminum cavity with a diameter of 5 mm is the maximum, and this trend is the same as that of the enhancement factor. The outgoing signal-to-noise ratio is 9.63 without cavity constraints, and reaches a maximum of 32.57 with an aluminum cavity of 5 mm in height and diameter, which is 3.38 times higher than the signal-to-noise ratio without cavity constraints.
Fig. 7 Plot of variation in the constrained signal-to-noise ratio for different sizes of aluminum cavities. |
The effect of cavity confinement of different sizes is further illustrated by calculating the plasma temperature and density. The plasma temperature is an important parameter describing the nature of the plasma, and a higher temperature indicates a higher excitation capacity.28 According to local thermodynamic equilibrium (LTE) conditions,29 the plasma temperature is calculated using the Boltzmann slope method. And eqn (15) is derived from the Saha–Boltzmann equation.
(15) |
The results show that the plasma temperature and density without cavity confinement are 5928 K and 2.75 × 1016/cm3, respectively, but for the plasma temperature for different sizes of cavity confinement, there is a significant difference, and its trend is roughly the same as that of the enhancement factor and the signal-to-noise ratio, and the plasma temperature is the highest when the height is 5 mm and the diameter is 5 mm, reaching 8891 K. From Fig. 9, we can observe that the variation of plasma density for different sizes is small, and it is difficult to find an obvious rule of change, but also the plasma density at a height of 5 mm and a diameter of 5 mm achieves a maximum value of 3.8 × 1016/cm3. The reason for these changes is that the plasma produced by laser induction is expanding outward in a hemispherical shape with the laser centerline. At the same time, the initial explosion generates an outward shock wave, the propagation speed of which is much larger than the expansion speed of the plasma, and when the shock wave encounters the inner wall of the cavity confinement, reflection occurs, which leads to further excitation of the plasma, and the excitation effect of the plasma and the number of particles are further increased, so that the temperature and density of the plasma are also increased.
In order to further improve the credibility of the cavity-enhanced LIBS spectroscopic signals in this article, this study is analyzed in comparison with the work related to cavity confinement enhancement by other research groups. Guo et al.30 used a hemispherical cavity to enhance the spectral signals of three low-concentration elements of vanadium, chromium and manganese in steel samples. The results showed that the hemispherical cavity with a diameter of 5 mm had the best enhancement effect, and the enhancement factors of the spectral emission intensities of three low-concentration elements of vanadium, chromium and manganese were 4.2, 3.1 and 2.87, respectively, which were the same as the optimal cavity diameter in this study. Moreover, the maximum enhancement factor of spectral emission intensity of the elements in this study is 4.02. Su et al.31 used brass samples to investigate the optimal enhancement size of the cylindrical cavity, and the results show that the plasma emission intensity and stability are best when the cavity diameter and height are 3 mm and 1 mm, respectively, and the plasma emission intensity shows a tendency to increase and then decrease with an increase in the cavity height, which is the same as the conclusions obtained in the present study. However, since the plasma volume and expansion depend on the LIBS experimental parameters, the optimal cylindrical spectral enhancement cavity size may vary for a specific cavity limited by the LIBS application.
(16) |
In order to validate the effect of cavity constraints on the reproducibility of the LIBS signals, in this study, the comparative analyses of the spectral data of the 10 brands of cigarettes were performed on Mg 280.270 nm, Ca 422.673 nm, H 656.271 nm, and O 777.194 nm characteristic spectral lines before and after the addition of cavity constraints. The relative standard deviation (RSD) of the characteristic spectral lines was analyzed in this study, which was calculated as eqn (16), in which the spectral intensity value of each LIBS dataset is the average of the spectral intensity values and n is the total amount of spectral data. Specifically, the RSD corresponds to the degree of variability of the spectral data and helps assess the reliability and consistency of the measurements. The RSD of the four characteristic spectral line elements was calculated based on 810 spectral datasets for each brand of cigarette, as shown in Fig. 10. It can be seen that the RSD values of the four characteristic spectral lines decreased substantially in all brand cigarette samples; for example, the RSD value of Ca 422.673 nm for the JY003 labeled sample decreased from 16.73% to 8.09%, the RSD value of H 656.271 nm for the JY004 labeled sample decreased from 13.17% to 3.15%, the RSD value of O 777.194 nm for the JY007 labeled sample decreased from 13.17% to 3.15%, and the RSD value of O 777.194 nm for the JY007 labeled sample decreased from 13.17% to 3.15%. The RSD value of O 777.194 nm for the JY007 labeled sample was reduced from 9.93% to 2.89%, which indicates that the spectral data of the cigarette samples became more stable and reproducible after the addition of cavity constraints, implying that the detection results are more representative.
Fig. 10 Comparison of RSD of each characteristic spectral line of 10 brands of cigarettes before and after adding cavity constraints. |
In order to avoid the existence of obvious order-of-magnitude differences between the input variables, these signals were subjected to a maximum–minimum normalization process, which is calculated as shown in eqn (17), where max{xj} is the maximum value of the sample data and min{xj}is the minimum value of the sample data. Max–min normalization is a linear transformation of the original data so that the resultant values are mapped between [0,1], eliminating the effects of the variables and the range of variability, while preserving the relationship between the data to the greatest extent possible.
(17) |
Each laser ablation point has a total of 12248 dimensions in the wavelength range of 180–950 nm, which leads to the problem of dimensionality catastrophe in LIBS spectral data, so it is necessary to choose a suitable dimensionality reduction algorithm to reduce the complexity of the data computation and to improve the computational speed. In this paper, four classical dimensionality reduction algorithms are selected, namely PCA, RPCA, LDA, and t-SNE. Fig. 12 and 13 show the visualized 2D and 3D plots of the four dimensionality reduction algorithms, respectively, in which we can find that there is a serious overlap in the LIBS spectral data of 10 different brands of cigarettes processed by the three dimensionality reduction algorithms of PCA, RPCA, and t-SNE. For the LDA dimensionality reduction algorithm, in its visualized 2D map, two brands of cigarette samples, JY001 and JY003, can be effectively distinguished, and in the 3D map, the four cigarette samples, JY001, JY003, JY004 and JY010, are further effectively distinguished, and the other six cigarette samples are still seriously overlapped. However, by comparing with the other three dimensionality reduction algorithms, the LDA dimensionality reduction algorithm improves the differentiation between different categories of cigarette samples on the basis of realizing data dimensionality reduction, which is more conducive to the subsequent classification task. Therefore, in this paper, the 3-dimensional feature spectral data processed by the LDA dimensionality reduction algorithm are used as input for the qualitative analysis algorithm later.
Fig. 12 Visualization of four dimensionality reduction algorithms, PCA, LDA, t-SNE, and RPCA, in 2D graphs. |
The grey wolf algorithm optimizes the parameters | Range of constraints |
---|---|
Number of hidden layer nodes | [10,30] |
Learning rate | [0.001,0.1] |
Regularization parameter | [0.0001,0.1] |
In order to further evaluate the classification performance of the GWO-BiLSTM model for 10 different brands of cigarettes, we analyzed the accuracy,34 recall,35 precision,36 F1 score,37 and specificity38 of the model for recognizing 10 different brands of cigarettes, where the accuracy is calculated as eqn (18), the recall using eqn (19), the precision using eqn (20), the F1 score using eqn (21), and specificity is calculated using eqn (22).
(18) |
(19) |
(20) |
(21) |
(22) |
In the above equation, TP is the number of samples where the real label is a positive case and the prediction result is also a positive case, FP is the number of samples where the real label is a negative case and the prediction result is a positive case, TN is the number of samples where the real label is a negative case and the prediction result is also a negative case, and FN is the number of samples where the real label is a positive case and the prediction result is a negative case. Precision is the proportion of correctly predicted positive case data to the data predicted as positive cases; the F1 score is the reconciled average of precision and recall, and the higher its value, the better the balance of the model in terms of checking accuracy and completeness; and specificity measures the model's ability to recognize negative cases.
The classification performance of the GWO-BiLSTM model for different cigarette brands is shown in Table 3, from which it can be found that the GWO-BiLSTM model achieves a 100% recognition rate for JY001, JY003, JY004, JY007, and JY010, and all of them have perfect recall, precision, F1-score, and specificity. The other five brands of cigarettes also have good recognition ability, with the lowest classification accuracy of 98.477%. The experimental results demonstrate the reliability and stability of the GWO-BiLSTM model, which has good recognition and generalization ability for 10 different brands of cigarettes.
Accuracy | Recall | Precision | F1-score | Specificity | |
---|---|---|---|---|---|
JY001 | 1 | 1 | 1 | 1 | 1 |
JY002 | 0.99877 | 1 | 0.98780 | 0.99387 | 0.99863 |
JY003 | 1 | 1 | 1 | 1 | 1 |
JY004 | 1 | 1 | 1 | 1 | 1 |
JY005 | 0.99959 | 0.99589 | 1 | 0.99794 | 1 |
JY006 | 0.99054 | 0.97119 | 0.93651 | 0.95354 | 0.99268 |
JY007 | 1 | 1 | 1 | 1 | 1 |
JY008 | 0.99259 | 1 | 0.93103 | 0.96429 | 0.99177 |
JY009 | 0.98477 | 0.86420 | 0.98131 | 0.91904 | 0.99817 |
JY010 | 1 | 1 | 1 | 1 | 1 |
Fig. 16 From left to right, the test set confusion matrices for LSTM, BiLSTM and GWO-BiLSTM are plotted. |
The LSTM model constructs a 3-layer network structure, in which 128-dimensional spectral data features are selected as inputs, a hidden layer consisting of 64 neurons is also set up, and the “softmax” function is selected for the output layer to perform the classification task, and the accuracy of the test set under the network structure can reach up to 90.86% through several experimental tests.
The BiLSTM model is better at capturing bi-directional spectral information than the LSTM model, and the information provided by the past features is taken into account while extracting the future features. The network structure of the BiLSTM model is 4-layer, in which 256-dimensional spectral features are selected as the inputs, the first hidden layer contains 128 neurons, the second hidden layer contains 64 neurons, and the output layer is still selected as the “softmax” function for the classification task, and the grid search model is used to find the optimal parameters with an accuracy of 93.66%.
As can be seen from the loss convergence curve comparison graphs of the training set and test set of the three models in Fig. 15, all three models have excellent prediction ability, and in terms of model loss, the loss of the LSTM model is higher than that of the BiLSTM model and the GWO-BiLSTM model, which may be due to the fact that the LSTM model extracts the spectral feature information only in one direction, whereas the BiLSTM model is able to extract feature information in both directions, so it shows higher classification accuracy, but the GWO-BiLSTM model can show the most superior classification effect because it not only captures feature information in both directions, but also intelligently optimizes the key parameters in the BiLSTM model through the GWO algorithm. As shown in Fig. 17, the classification accuracy of the three qualitative models gradually improves, which also represents that the network model based on the underlying structure of the LSTM model is continuously optimized and iterated, and the optimal qualitative analysis model is finally obtained.
Through the selection of the optimal size of the cavity constraint, the selection of the optimal cigarette spectral downscaling algorithm, and the comparison of the classification accuracies of the three model confusion matrices and the test set, we can clearly find that the GWO-BiLSTM model shows excellent performance in recognizing different kinds of cigarettes, and the method can achieve high-precision cigarette brand recognition, providing a good identification of counterfeit and shoddy cigarette products.
This journal is © The Royal Society of Chemistry 2024 |