LIBS (laser-induced breakdown spectroscopy) multi-distance mixed spectrum classification method based on deep CNN (convolutional neural network) and sample weight optimization
By assigning different weights to different detection distances of LIBS spectral samples in the depth CNN model, the feature confusion problem caused by the mixing of multiple distances of LIBS spectral is solved, which significantly improves the classification accuracy and is suitable for fields such as deep space exploration.
Patent Information
- Application Number
- CN202510266824.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-03-07
AI Technical Summary
In fields such as Mars exploration, the multi-distance mixing of LIBS spectra leads to confusion of feature information by the model, making it difficult to extract and learn real features, and affects the analytical effect of stoichiometric models.
The LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization is adopted. During the training process of the deep CNN model, different sample weights are assigned to spectral samples of different distances, and the training process is optimized to improve the classification effect.
It significantly improves the classification accuracy of LIBS multi-distance mixed spectrum, can effectively process multi-distance mixed spectrum data, and is suitable for special application scenarios such as deep space exploration and field exploration.
Smart Images

Figure CN119992219A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of laser spectral analysis technology, and more specifically to a LIBS multi-distance mixed spectrum classification method based on deep CNN and sample weight optimization. The method assigns corresponding different weights to LIBS spectrum samples collected at different detection distances, thereby optimizing the training process of the deep CNN model and realizing accurate and efficient LIBS multi-distance mixed spectrum classification. Background Art
[0002] Laser-induced breakdown spectroscopy (LIBS) is a chemical composition detection technology based on laser-induced plasma radiation. It has the advantages of fast response, micro-damage to samples, simultaneous analysis of multiple elements, and remote detection. Therefore, it is widely used in environmental monitoring, industrial detection, planetary exploration and other fields. In particular, the advantage of remote detection makes LIBS technology play an important role in the field of planetary exploration. At present, LIBS technology has been successfully applied to Mars exploration missions three times. NASA's "Curiosity" and "Perseverance", as well as my country's "Zhurong", all three Mars rovers are equipped with scientific payloads equipped with LIBS systems, namely the chemical camera ChemCam, the super camera SuperCam and the Mars surface composition detector MarSCoDe. Based on LIBS spectral data, people can use chemometric models to identify and classify soil, rocks and other materials on the surface of Mars and quantitatively detect the chemical composition.
[0003] The performance of the chemometric model depends on the model's ability to extract and learn the morphological features of the LIBS spectrum. For LIBS spectra, a key factor affecting the spectral morphological features is the detection distance. Even if the same device is used to detect the same sample, if the detection distance is different, the LIBS spectral morphology obtained will be significantly different, and the spectral morphology difference caused by different detection distances is much larger than the spectral morphology difference caused by pulse-to-pulse fluctuations. For details, see reference [1]. The reason why LIBS detection has a significant distance effect is that a series of factors such as the laser focal spot diameter, the spatial distribution of the spot intensity, the sampling geometry, the absorption / scattering degree of the laser, the absorption / scattering degree of the ambient medium on the plasma signal, the plasma temperature, and the electron number density will change with the change of the detection distance, thereby affecting the final LIBS spectral morphology.
[0004] In laboratory LIBS detection, it is relatively easy to keep the detection distance stable. However, in the in-situ detection of Mars, it is difficult to collect a large number of LIBS spectra at the same distance because the Mars rover often moves. For chemometric models, especially chemometric models based on machine learning or deep learning, the number of LIBS spectral data samples at the same distance is usually not enough to support the effective training of the model. In response to this challenge, one solution is to mix spectra collected at multiple distances to train the model, rather than using only a limited number of spectra collected at a specific distance. Although the number of samples of multi-distance mixed spectra can be significantly increased, the differences in spectral morphology caused by different detection distances may cause the model to confuse the feature information and fail to extract and learn the real features. Generally, when using a multi-distance mixed spectral dataset, whether the chemometric model analysis effect is better or worse than that of a single distance dataset depends on the similarity of spectral data at different distances and the learning ability of the model itself.
[0005] In order to improve the analysis effect of the chemometric model, one of the most common method systems is based on distance correction. By performing certain data preprocessing on the LIBS multi-distance mixed spectra, the morphological differences between the spectra collected at different detection distances are reduced. More than a decade ago, when processing LIBS multi-distance mixed spectra, the ChemCam team designed a correction function for spectral response and distance to perform distance correction [2]. The parameters that need to be calculated in the above distance correction function include photon spectral radiance, pixel size, stereoscopic viewing angle, unit integration time, and amplification conversion gain. Later, the ChemCam team proposed a scheme for distance correction based on a distance calibration curve [3]. The core of this scheme is to find the appropriate characteristic radiation line of the element to be analyzed, and use the line intensity of the same characteristic radiation line at different distances to construct a distance calibration curve, and then perform distance correction on the multi-distance mixed spectrum according to the distance calibration curve.
[0006] In addition to the above-mentioned distance correction-based method system, there is another method system that does not perform distance correction, but directly processes LIBS multi-distance mixed spectral data by constructing a deep learning chemometrics model with strong learning ability. Our team previously proposed a LIBS multi-distance mixed spectral classification method based on a deep convolutional neural network (CNN) algorithm model [4]. Without distance correction, the classification accuracy of the deep CNN model can be significantly higher than other conventional algorithm models such as support vector machines and back propagation neural networks.
[0007] The above three existing methods have the following disadvantages:
[0008] For the method based on the distance correction function in reference [2], it is necessary to fully consider the parameters that change with the detection distance, including photon spectral radiance, pixel size, stereoscopic field of view, unit integration time and amplification conversion gain, etc. If any of them are omitted, the effect of the distance correction function will be affected. The calculation process of the above parameters is not simple, so the calculation process of the entire distance correction function is very complicated and cumbersome.
[0009] For the distance calibration curve based method in reference [3], it is necessary for the element to be analyzed to have a sufficient number of characteristic radiation lines to construct the distance calibration curve. In fact, the process of finding suitable lines is relatively complicated, and not all elements can find a sufficient number of suitable lines. In addition, this method is suitable for the quantitative analysis of chemical composition, and the existing data results show that it can only achieve good results in the univariate regression task. For the spectral recognition and classification task, there is currently no relevant data to prove its effectiveness.
[0010] Although the method based on the deep CNN model in reference [4] has the advantage of not requiring distance correction, it adopts the conventional default method of equal weighting of all spectral samples in the training set during the training of the deep CNN model, which does not fully consider the differences in spectral characteristics caused by different detection distances. On the one hand, the spectral signal-to-noise ratio of close-range detection is relatively high, so it should receive more attention from the model, while the spectral signal-to-noise ratio of long-range detection is relatively low, so it should receive less attention. On the other hand, the relative position of the spectral samples in the training set and the spectral samples in the test set will also affect the classification effect. The spectral samples in the training set with a detection distance close to that corresponding to the test set should receive more attention from the model, while the spectral samples in the training set with a detection distance far different from that corresponding to the actual test set should receive less attention. Therefore, when training the deep CNN model, if the spectral samples in the training set with different detection distances are simply given equal weights, it will not be conducive to improving the classification accuracy of the model.
[0011] References
[0012] [1]Jie Feng, et al. Study to reduce laser-induced breakdownspectroscopy measurement uncertainty using plasma characteristic parameters. SpectrochimicaActa Part B: Atomic Spectroscopy65(2010)549–556.
[0013] [2]RCWiens, et al. Pre-flight calibration and initial data processing for the ChemCam laser-induced breakdown spectroscopy instrument on the MarsScience Laboratory rover. SpectrochimicaActa Part B: Atomic Spectroscopy82(2013)1–27.
[0014] [3]A.Mezzacappa, et al.Application of distance correction to ChemCamlaser-induced breakdown spectroscopy measurements.SpectrochimicaActa Part B:Atomic Spectroscopy120(2016)19–29.
[0015] [4] Fan Yang, et al. Laser-induced breakdown spectroscopy combined with aconvolutional neural network: A promising methodology for geochemical sample identification in Tianwen-1Mars mission. SpectrochimicaActa Part B: AtomicSpectroscopy192(2022)106417. Summary of the invention
[0016] In view of the above background and the shortcomings of the prior art, the present invention proposes a LIBS multi-distance mixed spectrum classification method based on deep CNN and sample weight optimization, which is suitable for analyzing LIBS spectrum mixed data collected at multiple different distances. The core innovation of the present invention is to assign different sample weights to spectral samples at different distances during the CNN training process. The present invention can significantly improve the classification accuracy of LIBS multi-distance mixed spectra, and provides important technical support and practical solutions for special LIBS application scenarios such as deep space exploration and field exploration.
[0017] The technical solution of the present invention is as follows:
[0018] A LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization is characterized in that different sample weights are assigned to spectral samples at different distances during the deep CNN training process, that is, the weight of each spectral sample is specially designed according to the absolute distance value of the spectral sample in the training set and the distance difference between the spectral sample in the training set and the spectral sample in the test set, so that the weights of spectral samples at different distances are optimized, thereby improving the classification effect of the deep CNN model.
[0019] The overall process of this technical solution can be divided into 9 steps, as shown in the attached manual. Figure 1 The details are as follows:
[0020] S1. Preliminary preparation: Prepare the detection samples for laser induced breakdown spectroscopy (LIBS), put them into sample bags after checking, and record the name and category information of each sample. After the sample preparation is completed, make a category table covering all samples (i.e., N samples), that is, list the categories to which all samples (i.e., N samples) belong and integrate them, and the categories of all training set and test set samples do not exceed the scope of this total table.
[0021] After the category table is completed, the category vector of each sample is determined in the form of one-hot encoding. One-hot encoding converts each category into a binary vector in which only one element is 1 and the rest are 0. Here, the application method of one-hot encoding is as follows: there are L different categories in the category table, so the category vector C of each sample in the form of one-hot encoding is a 1×L matrix, containing 1 number 1 and (L-1) numbers 0. If sample i belongs to the jth category, its category vector C i for
[0022] C i =[0,0, … 1,0,0…] (1)
[0023] The jth element in formula (1) is 1.
[0024] S2. Use the LIBS spectrum detection device to collect LIBS spectra of the detection sample at P different detection distances. When using the LIBS spectrum detection device for spectrum collection, the detection distance is defined as the straight-line distance between the external light outlet of the detection device laser and the geometric center of the detection sample surface. The detection distance can be changed by changing the position of the detection device or the detection sample; collect spectra at P different detection distances, and ensure that other experimental conditions remain unchanged except for the detection distance. The LIBS spectrum collected by the experiment is defined as the original spectrum data set.
[0025] S3. Preprocess the LIBS spectra in the original spectral data set. The preprocessing steps usually include dark background removal, background baseline removal, wavelength calibration, invalid pixel screening and channel splicing. Among them, the dark background removal operation refers to the use of the original LIBS spectrum to subtract the dark background spectrum to obtain a valid spectrum, and the dark background spectrum refers to the spectrum of the spectrometer response when there is no laser excitation; the background baseline removal operation refers to the use of an asymmetric least squares baseline correction method to remove the continuous baseline in the denoised spectrum; wavelength calibration refers to converting the spectrometer pixel number into a wavelength value by multivariate quadratic fitting; invalid pixel screening refers to removing the pixel response value of each band of the LIBS spectrum that exceeds the wavelength range; channel splicing refers to splicing the multiple bands of LIBS spectra that have been screened out of invalid pixels into a whole in wavelength order; the preprocessed LIBS spectrum is defined as a LIBS multi-distance mixed spectrum data set.
[0026] S4. According to P different detection distances, the LIBS multi-distance mixed spectral dataset in S3 is divided into P LIBS spectral datasets: the spectral dataset collected at the first distance is defined as d1; the spectral dataset collected at the second distance is defined as d2; and so on, the spectral dataset collected at the last distance, i.e., the Pth distance, is defined as d P Each detection distance corresponds to a training set-test set partitioning scheme of the LIBS multi-distance mixed spectral dataset: the partitioning scheme corresponding to the first distance is defined as Dataset1, which means that the spectral dataset d1 is used as the test set, and the remaining spectral datasets d2 to d P The partitioning scheme corresponding to the second distance is defined as Dataset2, which means that the spectral dataset d2 is used as the test set, and the remaining spectral datasets d1, d3 to d P As the training set; by analogy, the partitioning scheme corresponding to the Pth distance is defined as DatasetP, which represents the spectral dataset d P As the test set, the remaining spectral datasets d1 to d P-1 as a training set.
[0027] For each spectral dataset partitioning scheme, ensure that the test set and the training set have no intersection in the two dimensions of detection distance and detection samples: Taking the dataset partitioning scheme DatasetK as an example, the spectral dataset d K As the test set, d1…d K-1 ,d K+1 …d PThese spectral data sets at other distances are used as training sets, and the "leave one out" strategy is adopted during testing to test all N samples one by one; when testing the first sample, all spectral samples except the first sample in the spectral data sets at other distances are used as training sets; similarly, when testing the second sample, all spectral samples except the second sample in the spectral data sets at other distances are used as training sets; and so on, when testing the Nth sample, all spectral samples except the Nth sample in the spectral data sets at other distances are used as training sets.
[0028] S5. Construct a deep CNN model, whose structure is designed as follows: the first layer is a batch normalization layer; the second, fourth, sixth, seventh, and ninth layers are convolutional layers, and the activation function is the linear rectifier function ReLU; the third, fifth, and eighth layers are pooling layers, and the pooling method is the maximum pooling method; the tenth layer is a flattening layer; the eleventh layer is a fully connected layer, and the activation function is ReLU; the twelfth layer is a random dropout layer; the thirteenth layer is a fully connected layer, and the activation function is the sigmoid function. According to the above method, you can obtain the constructed initial deep CNN model.
[0029] S6. Design a training set spectral sample weight optimization scheme, calculate the weight of each spectral sample according to the detection distance of each spectral sample, and input the optimized training set spectral sample weight into the model during the deep CNN model training process;
[0030] The weight of the spectral samples in the training set is designed to be composed of the absolute distance weight w K1 and the relative distance weight w K2 It consists of two parts.
[0031] Spectral dataset d K The absolute distance weight w of the spectral sample in K1 Designed for
[0032]
[0033] In formula (2), r K represents the spectral dataset d K The corresponding detection distance.
[0034] When the spectral data set d Q When used as a test set, the spectral dataset d K The relative distance weight w of the spectral samples in K2 Designed for
[0035]
[0036] In formula (3), r K represents the spectral dataset d K The corresponding detection distance, r QDenotes the test set d Q The corresponding detection distance.
[0037] Considering the above two, the spectral dataset d K The total distance weight w of the spectral samples in K for
[0038]
[0039] In formula (4), r K represents the spectral dataset d K The corresponding detection distance, r Q Denotes the test set d Q The corresponding detection distance.
[0040] The total distance weight w K Normalized to a dimensionless value between 0 and 1, the spectral dataset d K The normalized total distance weight w of the spectral samples in K,norm for
[0041]
[0042] In formula (5), K = 1, 2, … Q-1, Q+1, … P.
[0043] During the deep CNN model training process, the calculated w K,norm As the spectral dataset d K The training set spectral sample weights are input into the model.
[0044] S7. Train the deep CNN model on the spectral data set partitioning scheme Dataset1 to DatasetP, and perform a model classification performance test. The deep CNN model is trained in batch training mode, and the training iterative optimizer uses the adaptive moment estimation Adam algorithm, and the loss function is the classification cross entropy; for the training process, the input is the LIBS spectral sample of the training set sample, the weight corresponding to each training set spectral sample, and the true label of the category vector corresponding to each training set spectral sample, and the output is the calculated value of the category vector of each training set spectral sample; for the testing process, the input is the LIBS spectral sample of the test set sample, and the output is the calculated value of the category vector of the test set spectral sample.
[0045] S8. Based on the number of correctly classified spectral samples (i.e., classification accuracy evaluation index), evaluate the execution effect of step S7 (i.e., evaluate the model classification performance) and optimize the relevant hyperparameters of the deep CNN model. Use the number of correctly classified spectral samples Ncorr as the classification accuracy evaluation index of the deep CNN model. Taking the data partitioning scheme DatasetK as an example, when the spectral dataset d KIn the process of testing all spectral samples in the dataset, the Ncorr value is equal to the number of spectral samples classified correctly in the test. The larger the Ncorr value, the better the classification performance of the deep CNN model.
[0046] According to the model classification performance, the relevant hyperparameters of the deep CNN model are optimized, including the batch size of training samples, the initial value of the learning rate, and the number of iterations. In the process of optimizing the hyperparameters, a trial value range is set for each hyperparameter. Within the specified value range of each hyperparameter, various hyperparameter combinations are tried to train the deep CNN model, and the Ncorr value that can be obtained for each solution in the test is calculated until all hyperparameter combinations are traversed. Finally, the hyperparameter combination that can maximize the Ncorr value is selected as the final solution, thereby completing the optimization of relevant hyperparameters.
[0047] S9. After completing the construction of the deep CNN model, the unknown spectral samples can be classified.
[0048] The working principle of the present invention is as follows:
[0049] For the training process of the deep CNN model, the default method is usually to give equal weights to all the training set spectral samples. The core innovation of the present invention is to give different sample weights to spectral samples of different distances during the training process of the deep CNN model. The design idea of the training set spectral sample weight optimization scheme is as follows: on the one hand, the spectral signal-to-noise ratio of close-range detection is relatively high, and it should be paid more attention by the model, and the spectral signal-to-noise ratio of long-range detection is relatively low, and it should be paid less attention. On the other hand, the relative distance between the training set spectral sample and the test set spectral sample will also affect the classification effect. The training set spectral samples with a detection distance close to that corresponding to the test set should be paid more attention by the model, while the training set spectral samples with a detection distance different from that corresponding to the actual test set should be paid less attention. If the training set spectral samples with different detection distances are simply given equal weights, and the deep CNN model is allowed to pay equal attention to all the training set spectral samples, it is obviously not conducive to improving the classification accuracy of the model in the actual test. Therefore, the training set spectral sample weight optimization scheme proposed by the present invention is helpful for the deep CNN model to extract and learn the truly important core feature information, thereby significantly improving the classification performance of the model in the actual test.
[0050] Beneficial Effects
[0051] Compared with the prior art, the advantages of the present invention are:
[0052] 1. Compared with the method based on the distance correction function, the present invention does not need to explore the law of how various experimental condition parameters change with the detection distance, and does not need to carry out calculations for the distance correction function, so it can significantly save computing time and computing resources.
[0053] Second, compared with the method based on distance calibration curve, the present invention does not need to find and select suitable characteristic radiation lines for each element to be analyzed, and does not need to design a distance calibration curve construction scheme, so it can significantly save computing time and computing resources. In addition, although the method of the present invention is designed for identification and classification tasks, its principle is also applicable to quantitative regression tasks, so it has a wider applicability.
[0054] 3. Compared with the existing distance-free correction method based on the deep CNN model, the present invention fully considers the differences in spectral characteristics brought about by different detection distances, including the difference in spectral signal-to-noise ratio and the difference in relative distance between the spectral samples of the training set and the spectral samples of the test set, and optimizes the weights of the spectral samples of the training set on this basis, thereby giving full play to the feature extraction and learning capabilities of the deep CNN model, so that the classification performance of the model is further improved while maintaining the advantage of distance-free correction.
[0055] 4. In summary, the present invention assigns different sample weights to spectral samples of different detection distances during the training process of the deep CNN model, so that the weights of spectral samples of different distances are optimized, thereby improving the classification effect of the deep CNN model. The present invention has the advantages of no need for distance correction, efficient training, and high accuracy. It can effectively classify LIBS multi-distance mixed spectra, and has important value in the field of laser spectral analysis technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is a schematic diagram of the overall flow of the technical solution of the present invention.
[0057] Figure 2 The distribution diagram of the training set spectral sample weights versus detection distance in each spectral data set partitioning scheme.
[0058] Figure 3 This is a comparison chart of the classification accuracy of the deep CNN model before and after the optimization of the spectral sample weights in the training set. DETAILED DESCRIPTION
[0059] The following is a specific experimental case to illustrate the application process of the method described in the summary of the invention:
[0060] A LIBS multi-distance hybrid spectral classification method based on deep CNN and sample weight optimization is proposed. Different sample weights are assigned to spectral samples of different distances during the deep CNN training process. That is, the weights of each spectral sample are specially designed according to the absolute distance value of the spectral sample of the training set and the distance difference between the spectral sample of the training set and the spectral sample of the test set, so that the weights of spectral samples of different distances are optimized, thereby improving the classification effect of the deep CNN model. The specific steps are as follows:
[0061] S1. Preliminary preparation: Prepare the detection samples for laser induced breakdown spectroscopy (LIBS), record the name and category information of each sample, make a category table covering all N samples, and determine the category vector of each sample;
[0062] In this example, there are 37 samples detected by LIBS experiment, namely N=37, all of which are national standard materials, marked as No. 1 to No. 37. The standard sample materials No. 1 to No. 37 are: 1) Clay 2) Soft Clay 3) Carbonate Rock 4) Kaolin 5) Basalt 6) Pegmatite 7) Dolomite 8) Andesite 9) Granite Gneiss 10) Siliceous Sandstone 11) Shale Type I 12) Quartz Sandstone 13) Mud Limestone 14) Polymetallic Ore 15) Stream Sediment Type I 16) Stream Sediment Type II 17) Floodplain Sediment 18) Yellow Red Soil 19) Brick Red Soil 20) Saline-alkali soil type I 21) Saline-alkali soil type II 22) Gray-calcium soil 23) Beach sediment 24) Granite 25) Shale type II 26) Nickel ore 27) Polymetallic poor ore 28) Copper-rich ore 29) Lead-zinc-rich ore 30) Lead ore type I 31) Lead ore type II 32) Molybdenum ore 33) Stream sediment type III 34) Stream sediment type IV 35) Stream sediment type V 36) Stream sediment type VI 37) Stream sediment type VII. These 37 detection samples can be divided into six categories, namely L=6, which are rock type I, rock type II, soil type I, soil type II, sediment and ore. These categories are numbered from 1 to 6, and a category summary table is made. When making the sample category table, the categories of all 37 samples are listed and then integrated. The categories of all training and test set samples do not exceed the scope of this table. When determining the category vector of each sample, the unique hot encoding method is used. There are 6 different categories in the category table. Table 1 lists the names of each category and the numbers of the detection samples it contains.
[0063] Table 1
[0064] category Detection sample number 1 rock type I 5,6,8,9,11,12,24,27,36 2 Rock Type II 3,7,13 3Soil Type I 4,10,19 4Soil Type II 1,2,18,20,21 5 Sediment 15,16,17,22,23,25,26,33,34,35,37 6 Ore 14,28,29,30,31,32
[0065] The category of each detection sample can be represented by a 1×6 vector, which contains 1 number 1 and 5 numbers 0. Taking sample No. 1 as an example, its category vector C1 can be expressed as
[0066] C1=[0,0,0,1,0,0]
[0067] C1 means that sample 1 belongs to category 4, i.e. soil type II.
[0068] S2. Collect LIBS spectrum data of each sample at P different distances using a LIBS spectrum detection device. When using a LIBS spectrum detection device for spectrum collection, the detection distance is defined as the straight-line distance between the external light outlet of the detection device laser and the geometric center of the detection sample surface. The detection distance can be changed by changing the position of the detection device or the detection sample; collect spectra at P different detection distances, and ensure that other experimental conditions remain unchanged except for the detection distance.
[0069] In this example, the detection device is a ground backup of the Mars Surface Composition Detector MarSCoDe payload, with a single laser pulse energy of about 9 mJ and a laser wavelength of 1064 nm. A total of 8 different detection distances are set, namely P = 8, which are 2.0m, 2.3m, 2.5m, 3.0m, 3.5m, 4.0m, 4.5m and 5.0m. At each detection distance, 60 valid LIBS spectra (excluding dark background spectra) are collected for each sample, totaling 17760 LIBS spectra, which constitute the original spectral data set.
[0070] S3. Preprocess the LIBS spectra in the original spectral data set, including dark background removal, background baseline removal, wavelength calibration, invalid pixel screening and channel splicing. The preprocessed LIBS spectra are defined as LIBS multi-distance mixed spectral data sets. The dark background removal operation refers to the subtraction of the dark background spectrum from the original LIBS spectrum to obtain a valid spectrum, wherein the dark background spectrum refers to the spectrum of the spectrometer response when there is no laser excitation; the background baseline removal operation refers to the removal of the continuous baseline in the denoised spectrum using the asymmetric least squares baseline correction method; wavelength calibration refers to the conversion of the spectrometer pixel number into a wavelength value by multivariate quadratic fitting; invalid pixel screening refers to the removal of the pixel response value of each band of the LIBS spectrum that exceeds the wavelength range; channel splicing refers to splicing the multiple bands of LIBS spectra that have been screened out of invalid pixels into a whole in wavelength order.
[0071] In this example, the LIBS spectral detection device includes three spectral channels, each channel has 1800 pixels, and a total of 5400 pixels; in the invalid pixel screening step, 298, 299 and 289 invalid pixel data points are screened out from the three channels respectively; after invalid pixel screening and channel splicing, each LIBS spectrum contains 4514 data points, which can be represented as a 4514×1 matrix.
[0072] S4. According to 8 different detection distances, the LIBS multi-distance mixed spectral dataset is divided into 8 LIBS spectral datasets under the same detection distance, among which the spectral dataset collected at a distance of 2.0m is defined as d1; the spectral dataset collected at a distance of 2.3m is defined as d2, the spectral dataset collected at a distance of 2.5m is defined as d3, the spectral dataset collected at a distance of 3.0m is defined as d4, the spectral dataset collected at a distance of 3.5m is defined as d5, the spectral dataset collected at a distance of 4.0m is defined as d6, the spectral dataset collected at a distance of 4.5m is defined as d7, and the spectral dataset collected at a distance of 5.0m is defined as d8.
[0073] Each detection distance corresponds to a training set-test set division scheme of the LIBS multi-distance mixed spectral dataset: the division scheme corresponding to 2.0m is defined as Dataset1, which means that the spectral dataset d1 is used as the test set, and the remaining spectral datasets d2 to d8 are used as training sets; the division scheme corresponding to 2.3m is defined as Dataset2, which means that the spectral dataset d2 is used as the test set, and the remaining spectral datasets d1, d3 to d8 are used as training sets; and so on, the division scheme corresponding to 5.0m is defined as Dataset8, which means that the spectral dataset d8 is used as the test set, and the remaining spectral datasets d1 to d7 are used as training sets;
[0074] For each spectral dataset partitioning scheme, the test set and the training set have no intersection in the two dimensions of detection distance and detection sample. Taking the dataset partitioning scheme Dataset1 as an example, the spectral dataset d1 is used as the test set, and the spectral datasets of other distances such as d2 to d8 are used as the training set. The "leave one out" strategy is adopted during the test, and all 37 samples are tested one by one; when testing the first sample, all spectral samples except the first sample in the spectral datasets of other distances are used as the training set; similarly, when testing the second sample, all spectral samples except the second sample in the spectral datasets of other distances are used as the training set; and so on, when testing the 37th sample, all spectral samples except the 37th sample in the spectral datasets of other distances are used as the training set. During the test process of each sample, the training set has 15,120 spectral data and the test set has 60 spectral data.
[0075] S5. Construct a deep convolutional neural network (CNN) model. In this example, the structure of the deep CNN model is as follows: the first layer is a batch normalization layer; the second, fourth, sixth, seventh, and ninth layers are convolutional layers, and the activation function is the linear rectification function ReLU; the third, fifth, and eighth layers are pooling layers, and the pooling method is the maximum pooling method; the tenth layer is a flattening layer; the eleventh layer is a fully connected layer, and the activation function is ReLU; the twelfth layer is a random dropout layer; the thirteenth layer is a fully connected layer, and the activation function is the sigmoid function. S6. Design a training set spectral sample weight optimization scheme, calculate the weight of each spectral sample according to the detection distance of each spectral sample, and input the optimized training set spectral sample weight into the model during the deep CNN model training process.
[0076] In this example, Python is used for programming and the deep learning framework Keras is used to build a deep CNN model. During the training process, the weights of the spectral samples in the training set are input into the deep CNN model through the sample_weight parameter. The weights of the spectral samples in the training set are designed to be composed of the absolute distance weight w K1 and the relative distance weight w K2 The following is an example of the weight calculation method using the spectral dataset partitioning scheme Dataset1. In the scheme Dataset1, the spectral dataset d1 is used as the test set, and the spectral datasets d2 to d8 are used as the training set.
[0077] The absolute distance weight w of the spectral samples in the spectral dataset d2 21 for
[0078]
[0079] Relative distance weight w 22 for
[0080]
[0081] The total distance weight w2 is
[0082] w2=w 21 +w 22 =0.44m -1 +3.33m -1 =3.77m -1
[0083] Where r1 represents the detection distance corresponding to the spectral dataset d1, and r2 represents the detection distance corresponding to the spectral dataset d2;
[0084] Similarly, the total weight of the other training set spectral data sets can be calculated: w3 is 2.40m -1 , w4 is 1.33m -1, w5 is 0.95m -1 , w6 is 0.75m -1 , w7 is 0.62m -1 , w8 is 0.53m -1 The above distance total weight is normalized, where the normalized distance total weight w 2,norm for
[0085]
[0086] Similarly, we can calculate: 3,norm is 0.23, w 4,norm is 0.13, w 5,norm is 0.09, w 6,norm is 0.07, w 7,norm is 0.06, w 8,norm is 0.05.
[0087] By analogy, the sample weights of the spectral data sets used for the training set in schemes Dataset2 to Dataset8 can be calculated. Table 2 lists the spectral sample weights of the training set at different detection distances for each spectral data set division scheme. Figure 2 It more intuitively shows the weights of the spectral samples in the training set at different detection distances for each spectral dataset partitioning scheme (Note: for each spectral dataset partitioning scheme, the detection distance corresponding to the test set does not exist in the training set, so the column area corresponding to the distance in the figure is marked with a red cross).
[0088] Table 2
[0089] Dataset 2.0m 2.3m 2.5m 3.0m 3.5m 4.0m 4.5m 5.0m Dataset1 / 0.36 0.23 0.13 0.09 0.07 0.06 0.05 Dataset2 0.27 / 0.38 0.12 0.08 0.06 0.05 0.04 Dataset3 0.18 0.39 / 0.17 0.09 0.07 0.05 0.04 Dataset4 0.14 0.17 0.22 / 0.21 0.11 0.08 0.06 Dataset5 0.11 0.12 0.13 0.22 / 0.21 0.12 0.08 Dataset6 0.10 0.10 0.11 0.13 0.23 / 0.22 0.12 Dataset7 0.10 0.09 0.10 0.11 0.14 0.24 / 0.23 Dataset8 0.11 0.10 0.10 0.11 0.12 0.16 0.29 /
[0090] S7. Train the deep CNN model on the spectral data set partitioning scheme Dataset1 to Dataset8, and perform a model classification performance test. In this example, the deep CNN model is trained in batch training mode, the training iterative optimizer uses the adaptive moment estimation Adam algorithm, and the loss function is set to categorical cross entropy CategoricalCrossentropy. For the training process, the input is the LIBS spectral samples of the training set samples, the weights corresponding to each training set spectral sample, and the true label of the category vector corresponding to each training set spectral sample, and the output is the calculated value of the category vector of each training set spectral sample; for the testing process, the input is the LIBS spectral samples of the test set samples, and the output is the calculated value of the category vector of the test set spectral sample.
[0091] S8. Use the number of correctly classified spectral samples Ncorr as the classification accuracy evaluation index of the deep CNN model to evaluate the training and prediction effects of the deep CNN model (i.e., evaluate the model classification performance), and optimize the relevant hyperparameters of the deep CNN model. In this example, taking the data partitioning scheme Dataset1 as an example, in the process of testing all spectral samples in the spectral dataset d1, the Ncorr value is equal to the number of spectral samples correctly classified in the test. The larger the Ncorr value, the better the classification performance of the deep CNN model. According to the model classification performance, optimize the relevant hyperparameters of the deep CNN model, including the batch training sample number batchsize, the initial value of the learning rate lr, and the number of iterations epochs. In the process of optimizing the hyperparameters, set a trial value range for each hyperparameter. Within the specified value range of each hyperparameter, try various hyperparameter combination schemes to train the deep CNN model, and calculate the Ncorr value that each scheme can obtain in the test, until all hyperparameter combination schemes are traversed, and finally select the hyperparameter combination scheme that can maximize the Ncorr value as the final scheme. In this example, the final hyperparameter combination scheme is batchsize=512,lr=2e -4 , epochs=601.
[0092] S9. After the deep CNN model is built, the unknown spectral samples can be classified. In this example, in order to reflect the improvement of the classification performance of the deep CNN model by optimizing the weight of the spectral samples in the training set, the experimental group (after weight optimization) and the control group (before weight optimization) are set according to whether the weight optimization of the spectral samples in the training set is performed. For each spectral data set division scheme, the Ncorr values of the two groups are calculated respectively. The results are shown in the attached manual. Figure 3 shown.
[0093] From the instruction manual Figure 3 It can be seen that in all 8 data set partitioning schemes, the Ncorr value of the correctly classified spectral samples of the deep CNN model after the training set spectral sample weight optimization is higher than that of the model without sample weight optimization, which can be explained that the optimization of the training set spectral sample weight can improve the classification performance of the deep CNN model. In summary, the present invention has the advantages of no need for distance correction, efficient training, and high accuracy. It can effectively classify LIBS multi-distance mixed spectra and has important value in the field of laser spectral analysis technology.
[0094] The above specific embodiments are only explanations of the present invention, and they are not limitations of the present invention. After reading this specification, those skilled in the art can make modifications to the embodiments without creative contribution as needed. However, as long as they are within the scope of the claims of the present invention, they are protected by the patent law.
Claims
1. A LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization, characterized in that: During the deep CNN training process, different sample weights are assigned to spectral samples at different distances. That is, the weight of each spectral sample is specially designed according to the absolute distance value of the spectral samples in the training set and the distance difference between the spectral samples in the training set and the spectral samples in the test set, so that the weights of spectral samples at different distances are optimized, thereby improving the classification effect of the deep CNN model.
2. A LIBS multi-distance hybrid spectral classification method based on deep CNN and sample weight optimization as claimed in claim 1, characterized in that The following steps are involved: S1. Preliminary preparation: Prepare the detection samples for laser induced breakdown spectroscopy (LIBS), record the name and category information of each sample, make a category table covering all N samples, and determine the category vector of each sample; S2, using a LIBS spectrum detection device to collect LIBS spectra of the detection sample at P different detection distances, and the LIBS spectra collected by the experiment are defined as the original spectrum data set; S3, preprocessing the LIBS spectra in the original spectral data set. Usually, the preprocessing steps include dark background removal, background baseline removal, wavelength calibration, invalid pixel screening and channel splicing. The preprocessed LIBS spectra are defined as LIBS multi-distance mixed spectral data set; S4. According to P different detection distances, the LIBS multi-distance mixed spectral dataset is divided into P LIBS spectral datasets: the spectral dataset collected at the first distance is defined as d1; the spectral dataset collected at the second distance is defined as d2; and so on, the spectral dataset collected at the last distance, i.e., the Pth distance, is defined as d P Each detection distance corresponds to a training set-test set partitioning scheme of the LIBS multi-distance mixed spectral dataset: the partitioning scheme corresponding to the first distance is defined as Dataset1, which means that the spectral dataset d1 is used as the test set, and the remaining spectral datasets d2 to d P The partitioning scheme corresponding to the second distance is defined as Dataset2, which means that the spectral dataset d2 is used as the test set, and the remaining spectral datasets d1, d3 to d P As the training set; by analogy, the partitioning scheme corresponding to the Pth distance is defined as DatasetP, which represents the spectral dataset d P As the test set, the remaining spectral datasets d1 to d P-1 As a training set; S5. Construct a deep convolutional neural network (CNN) model. The structure of the deep CNN model is designed as follows: the first layer is a batch normalization layer; the second, fourth, sixth, seventh, and ninth layers are convolutional layers, and the activation function is the linear rectification function (ReLU); the third, fifth, and eighth layers are pooling layers, and the pooling method is the maximum pooling method; the tenth layer is a flattening layer; the eleventh layer is a fully connected layer, and the activation function is ReLU; the twelfth layer is a random dropout layer; the thirteenth layer is a fully connected layer, and the activation function is the sigmoid function; S6. Design a training set spectral sample weight optimization scheme, calculate the weight of each spectral sample according to the detection distance of each spectral sample, and input the optimized training set spectral sample weight into the model during the deep CNN model training process; S7, training a deep CNN model on the spectral dataset partitioning scheme Dataset1 to DatasetP, and performing a model classification performance test; S8. Evaluate the model classification performance based on the classification accuracy evaluation index and optimize the relevant hyperparameters of the deep CNN model; S9. Complete the construction of the deep CNN model.
3. A LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization as claimed in claim 2, characterized in that: In step S1, when making a sample category table, the categories to which all N samples belong are listed, and then integrated. The categories of all training set and test set samples do not exceed the scope of this table. When determining the category vector of each sample, a unique hot encoding method is used. There are L different categories in the category table. The category vector C of each sample is a 1×L matrix, containing 1 number 1 and (L-1) numbers 0. If sample i belongs to the jth category, its category vector C i C i =[0,0,…1,0,0…] The jth element is 1.
4. A LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization as claimed in claim 2, characterized in that: In step S2, when the LIBS spectral detection device is used to collect spectra, the detection distance is defined as the straight-line distance between the external light outlet of the laser of the detection device and the geometric center of the surface of the detection sample. The detection distance is changed by changing the position of the detection device or the detection sample. Spectra are collected at P different detection distances, and it is ensured that the other experimental conditions except the detection distance remain unchanged.
5. A LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization as claimed in claim 2, characterized in that: In step S3, the dark background removal operation refers to subtracting the dark background spectrum from the original LIBS spectrum to obtain an effective spectrum, wherein the dark background spectrum refers to the spectrum that the spectrometer responds to when there is no laser excitation; The background baseline removal operation refers to the removal of the continuous baseline in the denoised spectrum using the asymmetric least squares baseline correction method; wavelength calibration refers to the conversion of the spectrometer pixel number into a wavelength value through a multivariate quadratic fitting method; invalid pixel screening refers to the removal of pixel response values that exceed the wavelength range in each band of the LIBS spectrum; channel splicing refers to splicing multiple bands of LIBS spectra that have been screened out of invalid pixels into a whole channel in wavelength order.
6. A LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization as claimed in claim 2, characterized in that: In step S4, for each spectral dataset partitioning scheme, ensure that the test set and the training set have no intersection in the two dimensions of detection distance and detection sample: Taking the dataset partitioning scheme DatasetK as an example, the spectral dataset d K As the test set, d1…d K-1 ,d K+1 …d P These spectral data sets at other distances are used as training sets, and the "leave one out" strategy is adopted during testing to test all N samples one by one; when testing the first sample, all spectral samples except the first sample in the spectral data sets at other distances are used as training sets; similarly, when testing the second sample, all spectral samples except the second sample in the spectral data sets at other distances are used as training sets; and so on, when testing the Nth sample, all spectral samples except the Nth sample in the spectral data sets at other distances are used as training sets.
7. The LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization as claimed in claim 2 is characterized in that: In step S6, the training set spectral sample weight is designed to be composed of the absolute distance weight w K1 and the relative distance weight w K2 It consists of two parts: spectral data set d K The absolute distance weight w of the spectral sample in K1 Designed for where r K represents the spectral dataset d K The corresponding detection distance; when the spectral data set d Q When used as a test set, the spectral dataset d K The relative distance weight w of the spectral samples in K2 Designed for where r Q Denotes the test set d Q The corresponding detection distance; spectral data set d K The total distance weight w of the spectral samples in K for The total distance weight w K Normalized to a dimensionless value between 0 and 1, the spectral dataset d K The normalized total distance weight w of the spectral samples in K,norm for Where K = 1, 2, ... Q-1, Q+1, ... P; in the process of deep CNN model training, the calculated w K,norm As the spectral dataset d K The weights of the spectral samples in the training set.
8. The LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization as claimed in claim 2 is characterized in that: In step S7, the training of the deep CNN model adopts a batch training mode, the training iterative optimizer adopts an adaptive moment estimation Adam algorithm, and the loss function is classification cross entropy; For the training process, the input is the LIBS spectrum samples of the training set samples, the weights corresponding to each training set spectrum sample, and the true label of the category vector corresponding to each training set spectrum sample. The output is the calculated value of the category vector of each training set spectrum sample. For the testing process, the input is the LIBS spectrum sample of the test set sample, and the output is the calculated value of the category vector of the test set spectrum sample.
9. The LIBS multi-distance hybrid spectral classification method based on deep CNN and sample weight optimization as claimed in claim 2, characterized in that: In step S8, the number of correctly classified spectral samples Ncorr is used as the classification accuracy evaluation index of the deep CNN model; taking the data partitioning scheme DatasetK as an example, in the spectral dataset d K In the process of testing all spectral samples in the dataset, the Ncorr value is equal to the number of spectral samples correctly classified in the test. The larger the Ncorr value, the better the classification performance of the deep CNN model. According to the classification performance of the model, the relevant hyperparameters of the deep CNN model are optimized, including the batch size of training samples, the initial value of the learning rate lr, and the number of iterations epochs. In the process of optimizing the hyperparameters, a trial value range is set for each hyperparameter. Within the specified value range of each hyperparameter, various hyperparameter combination schemes are tried to train the deep CNN model, and the Ncorr value that can be obtained for each scheme in the test is calculated, until all hyperparameter combination schemes are traversed, and finally the hyperparameter combination scheme that can make the Ncorr value the largest is selected as the final scheme, thereby completing the optimization of relevant hyperparameters.
10. The LIBS multi-distance mixed spectral classification method based on deep CNN and sample weight optimization as claimed in claim 2, characterized in that: In step S9, after the deep CNN model is built, the unknown spectral samples can be classified.
Citation Information
Patent Citations
Hyperspectral image noise label detection method based on super-pixel weight density
CN110046639A
Spectral sample weighting method and system
CN116843998A
Generative adversarial network spectral data enhancement method for continuous variable regression prediction
CN117197608A
Mars LIBS data analysis method based on deep CNN pre-training model transfer learning
CN118171103A
Unknown material determination system using spectrum data of material
JP2023066429A