Airing tobacco producing area identification method based on hyperspectral characteristic wave band and machine learning algorithm
By combining hyperspectral imaging systems and machine learning algorithms, the problems of strong subjectivity, low efficiency, and poor accuracy in the identification of the origin of sun-dried tobacco have been solved, achieving non-destructive and efficient origin identification and improving the accuracy and efficiency of identification.
Patent Information
- Application Number
- CN202510825342.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-11-14
AI Technical Summary
Existing technologies for identifying the origin of sun-cured tobacco suffer from problems such as high subjectivity, low efficiency, poor accuracy, and high destructiveness, making it difficult to effectively classify tobacco leaves of the same variety from different origins.
A hyperspectral imaging system was used to collect full-band spectral data of sun-dried tobacco samples in the visible and near-infrared bands. Combined with multivariate scattering correction, standard normal transformation, first derivative and second derivative processing, characteristic spectral band data were extracted, and linear discriminant analysis, support vector machine and ensemble learning models were constructed to identify the place of origin.
It achieves non-destructive and highly sensitive identification of the origin of sun-cured tobacco, improves accuracy, allows for sample reuse, reduces data processing and computation, and improves identification efficiency and accuracy.
Smart Images

Figure CN120951068A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of analytical testing technology, specifically to a method for identifying the origin of sun-dried tobacco based on hyperspectral characteristic bands and machine learning algorithms. Background Technology
[0002] Sichuan sun-cured tobacco is an important economic crop under China's tobacco monopoly management. Sun-cured tobacco from different producing areas varies greatly in quality, flavor, and even economic value due to their unique geographical environment and cultivation methods. Currently, there is no reliable method for identifying the origin of sun-cured tobacco; in practice, it mainly relies on human sensory evaluation and experience, which suffers from high subjectivity, low efficiency, and poor accuracy.
[0003] Existing technologies employ ion mobility spectrometry (IMS), a trace chemical substance analysis and detection technique capable of identifying the origin of tobacco leaves. However, it relies solely on drift tubes to separate compounds, resulting in poor separation efficiency and an inability to effectively classify and identify tobacco leaves of the same variety from different origins. Gas chromatography and gas chromatography-mass spectrometry (GC-MS) techniques are also used, but these existing technologies suffer from low sensitivity, poor accuracy, slow detection speed, destructive nature, and complex pretreatment processes. To overcome these limitations, it is essential to develop and validate non-destructive and highly sensitive methods. Summary of the Invention
[0004] To address the shortcomings of the existing technology, this invention provides a method for identifying the origin of sun-dried tobacco based on hyperspectral feature bands and machine learning algorithms.
[0005] This invention is achieved through the following technical solution:
[0006] A method for identifying the origin of sun-dried tobacco based on hyperspectral characteristic bands and machine learning algorithms, characterized by the following steps:
[0007] Step 1: Obtain sun-cured tobacco samples from different production areas and pre-process the sun-cured tobacco samples. The pre-processing includes re-moistening, grading and cutting the sun-cured tobacco samples. Then, the pre-processed sun-cured tobacco samples are divided into training samples and test samples, with training samples accounting for 68% and test samples accounting for 32%.
[0008] Step 2: Use a hyperspectral imaging system to acquire full-band spectral data of the training samples in the visible and near-infrared bands (385.31-1024.29 nm) to form the raw hyperspectral data D0; set the resolution to 2.13 nm for the band range of 385.31 to 744.04 nm and the resolution to 2.35 nm for the band range of 744.04 to 1024.29 nm.
[0009] Step 3: The original hyperspectral dataset from Step 2 is processed using multivariate scattering correction, standard normal variable transformation, first derivative, and second derivative to obtain four processed hyperspectral datasets, denoted as D1, D2, D3, and D4.
[0010] Step 4: Based on the original hyperspectral dataset in Step 2 and the 4 sets of hyperspectral datasets in Step 3, a total of 5 sets of hyperspectral datasets are generated. The spectral angle algorithm is used to extract 130 characteristic spectral band datasets from all bands in the 5 sets of hyperspectral datasets to reflect the differences in the origin of sun-dried tobacco.
[0011] Step 5: Combine the selected feature spectral band dataset with the 4 sets of hyperspectral datasets in Step 3 as the training set to build a machine learning classification model for training, and obtain the trained machine learning classification model; then, combine the 5 sets of hyperspectral data obtained in Steps 2-4 with the feature spectral band dataset in Step 4 as the test set and input them into the trained machine learning classification model for testing and verification.
[0012] Step 6: Repeat steps 2-4 for the sun-dried tobacco sample to be tested, input the processed hyperspectral data into the trained machine learning model, and output the origin identification result.
[0013] Furthermore, the origin of the sun-dried tobacco samples in step 1 includes Jiajiang County, Qianwei County, Xuzhou District of Yibin City, Deyang City, and Liangshan Yi Autonomous Prefecture.
[0014] Furthermore, in step 3, multivariate scattering correction is used to process the original hyperspectral dataset from step 2 to obtain the processed hyperspectral dataset, as follows:
[0015] First, calculate the average spectrum of the hyperspectral dataset to be corrected, using the following formula:
[0016]
[0017] Then, a linear regression is performed on the average spectrum, as shown in the following formula:
[0018]
[0019] For each spectrum in the set, multivariate scattering correction is performed using the following formula:
[0020]
[0021] In the formula: x i x represents the i-th spectrum (i = 1, 2, ..., n) of the hyperspectral dataset to be corrected; i (MSC) represents the i-th spectrum after multivariate scattering correction; n represents the number of spectra to be corrected; m i and bi Let represent the coefficients and intercepts of the i-th spectrum obtained using the least squares method, respectively.
[0022] Furthermore, in step 3, the original hyperspectral dataset from step 2 is processed using a standard normal variable transformation to obtain the processed hyperspectral dataset, as shown in the following formula:
[0023]
[0024] In the formula: x i,k This represents the reflectance value of the i-th spectrum at wavelength k, where k = 1, 2, ..., m; m represents the number of wavelength points; x i (SNV) represents the i-th spectrum after standard normal transformation; x i Represents the i-th spectrum, This represents the mean of all spectral curves.
[0025] Furthermore, in step 3, the original hyperspectral dataset from step 2 is processed using the first derivative to obtain the processed hyperspectral dataset, as shown in the following formula:
[0026]
[0027] In the above formula, x represents reflectivity, k is wavelength, g is the difference width, and x k,1st Let be the first derivative of the reflectivity at wavelength k.
[0028] Furthermore, in step 3, the original hyperspectral dataset from step 2 is processed using the second derivative to obtain the processed hyperspectral dataset, as shown in the following formula:
[0029]
[0030] In the above formula, x represents the original hyperspectral image, k is the wavelength, g is the difference width, and x k,2nd Let be the second derivative of the reflectivity at wavelength k.
[0031] Furthermore, in step 4, feature filtering is performed on a total of 5 hyperspectral datasets as follows:
[0032] All bands of the five hyperspectral datasets were merged to form a multidimensional dataset containing the original hyperspectral dataset and four processed hyperspectral datasets. Each row represents a sun-dried tobacco sample, each column represents a band, and the origin of the sun-dried tobacco is marked in each row.
[0033] For each band, the spectral angle of sun-cured tobacco samples from different origins in that band is calculated using the following formula:
[0034]
[0035] θ(X i ,X j X represents the spectral angles of hyperspectral data from two sun-dried tobacco samples from different origins. i ,X j The reflectance of sun-cured tobacco samples from two different origins in the same wavelength band;
[0036] All bands are sorted from largest to smallest spectral angle, and the top 130 bands are selected as characteristic spectral bands reflecting the differences in the production areas of sun-dried tobacco.
[0037] 130 characteristic wavelength bands reflecting regional differences in sun-cured tobacco production include: 576.3nm, 578.39nm, 580.48nm, 582.58nm, 584.67nm, 586.77nm, 588.86nm, 590.96nm, 593.06nm, 595.1nm, 597.25nm, 599.35nm, 601.45nm, 603.56nm, 605.66nm, 607.76nm, 609.86nm, 611.9nm, 614.08nm, 616.18nm, 618.29nm, 620.4nm, 622.51nm, 624.62nm, 626.73nm, and 628.84nm. nm, 630.95nm, 633.06nm, 635.18nm, 637.29nm, 639.41nm, 641.52nm, 643.6 4nm, 645.76nm, 647.87nm, 649.99nm, 652.11nm, 654.23nm, 656.36nm, 658. 48nm, 660.6nm, 662.73nm, 664.85nm, 666.98nm, 669.1nm, 671.23nm, 673.3 6nm, 675.49nm, 677.62nm, 679.75nm, 681.88nm, 684.01nm, 686.15nm, 688.2 8nm, 690.41nm, 692.55nm, 694.69nm, 696.82nm, 698.96nm, 701.1nm, 703.2 4nm, 705.38nm, 707.52nm, 709.66nm, 711.81nm, 713.95nm, 716.09nm, 718. 24nm, 720.38nm, 722.53nm, 724.68nm, 726.83nm, 728.98nm, 731.13nm, 733 .28nm, 735.43nm, 737.58nm, 739.74nm, 741.89nm, 744.04nm, 746.2nm, 748. 36nm, 750.51nm, 752.67nm, 754.83nm, 756.99nm, 759.15nm, 761.31nm, 763 .47nm, 765.64nm, 767.8nm, 769.97nm, 772.13nm, 774.3nm, 776.47nm, 778. 63nm, 780.8nm, 782.97nm, 785.14nm, 787.31nm, 789.48nm, 791.66nm, 793. 83nm, 965.86nm, 968.09nm, 970.33nm, 972.57nm, 974.81nm, 977.05nm, 979.29nm、981.53nm、983.78nm、986.02nm、988.27nm、990.51nm、992.76nm、995.01nm、997.25nm、999.5nm、1001.75nm、1 004nm, 1006.25nm, 1008.51nm, 1010.76nm, 1013.01nm, 1015.27nm, 1017.52nm, 1019.78nm, 1022.03nm, 1024.29nm. .
[0038] Furthermore, the machine learning classification model includes a linear discriminant analysis model, a support vector machine model, and an ensemble learning model. In step 5, at least one of the three machine learning classification models is constructed using the selected feature spectral band dataset, and the model is trained using the training set data.
[0039] Furthermore, in step 5, a linear discriminant analysis model is constructed using the selected characteristic spectral band dataset, and the linear discriminant analysis model is trained.
[0040] The objective of linear discriminant analysis is to find a projection direction w such that the projected points of samples of the same class are as close as possible, and the projected points of samples of different classes are as far apart as possible. Its objective function is:
[0041]
[0042] J(w) is the objective function, S b Let S be the inter-class scatter matrix. w Let w be the intra-class scatter matrix and w be the projection direction.
[0043] Furthermore, in step 5, a support vector machine model is constructed using the selected feature spectral band dataset, and the support vector machine model is trained.
[0044] The goal of support vector machines is to find a hyperplane w T x+b maximizes the minimum margin between the two classes of samples.
[0045]
[0046] The constraint is y i (w T x i +b)≥1-ξ i ,ξ i ≥0
[0047] Where: w∈R d ξ is the hyperplane normal vector; b∈R is the bias term; C is the penalty parameter; i For slack variables; (x)i ,y i ) are the training samples.
[0048] Furthermore, in step 5, an ensemble learning model is constructed using the selected feature spectral band dataset, and the ensemble learning model is trained.
[0049] Ensemble learning models improve the generalization ability of a model by combining the prediction results of multiple base learners. The prediction results are as follows:
[0050]
[0051] h i (x) represents the prediction result of the i-th base learner, α i Let be the weights of the i-th base learner.
[0052] The beneficial effects of this invention are as follows:
[0053] 1. The hyperspectral imaging system described in this invention operates in the wavelength range of 385.31-1024.29 nm. Through experiments, the resolution of the spectrum between 385.31 and 744.04 nm was set to 2.13 nm, and the resolution between 744.04 and 1024.29 nm was set to 2.35 nm. This combination of resolution settings can effectively improve the accuracy of sample identification.
[0054] 2. In step 5, the three machine learning models were trained using 68% of the dried tobacco samples. It was found that the support vector machine prediction model had the highest accuracy when using the feature bands in step 4 after processing the first derivative in step 3.
[0055] 3. Existing technologies require destructive sampling and identification of tobacco leaves, and the samples are damaged and cannot be used after identification. This invention only requires rehydration, grading and cutting of sun-dried tobacco samples, without crushing, which is less destructive and will not cause any damage to the sun-dried tobacco samples. The sun-dried tobacco samples can still be reused. Attached Figure Description
[0056] Figure 1 Hyperspectral images of sun-cured tobacco from different origins;
[0057] Figure 2 This is the hyperspectral image after multivariate scattering correction;
[0058] Figure 3 This is the hyperspectral image after standard normal transformation;
[0059] Figure 4 This is the hyperspectral image after processing with the first derivative;
[0060] Figure 5 The hyperspectral image is processed using the second derivative.
[0061] Figure 6 Spectral angle heatmaps plotted for screening characteristic bands;
[0062] Figure 7 The accuracy rates of the three machine learning models;
[0063] Figure 8 Confusion matrix diagram for support vector machine discrimination;
[0064] Figure 9 Heatmap showing how the accuracy of origin identification results varies with different combinations of spectral resolutions;
[0065] Figure 10 A graph showing how the accuracy of the identification results changes with the proportion of the training set partition;
[0066] Figure 11 Comparison of the accuracy of identification results for key bands and the entire band. Detailed Implementation
[0067] Example 1
[0068] A method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms includes the following steps:
[0069] Step 1: Obtain sun-cured tobacco samples from different origins and pre-process the samples. The pre-processing includes rehydrating, grading, and cutting the samples. Then, the pre-processed samples are divided into training samples and test samples, with training samples accounting for 68% and test samples accounting for 32%.
[0070] Step 2: Use a hyperspectral imaging system to acquire full-band spectral data of the training samples in the visible and near-infrared bands (385.31-1024.29 nm) to form the raw hyperspectral data D0; set the resolution to 2.13 nm for the band range of 385.31 to 744.04 nm and the resolution to 2.35 nm for the band range of 744.04 to 1024.29 nm.
[0071] Step 3: The original hyperspectral dataset from Step 2 is processed using multivariate scattering correction, standard normal variable transformation, first derivative, and second derivative to obtain four processed hyperspectral datasets, denoted as D1, D2, D3, and D4.
[0072] Step 4: Based on the original hyperspectral dataset in Step 2 and the 4 sets of hyperspectral datasets in Step 3, a total of 5 sets of hyperspectral datasets are generated. The spectral angle algorithm is used to extract 130 characteristic spectral band datasets from all bands in the 5 sets of hyperspectral datasets to reflect the differences in the origin of sun-dried tobacco.
[0073] Step 5: Combine the selected feature spectral band dataset with the 4 sets of hyperspectral datasets in Step 3 as the training set to build a machine learning classification model for training, and obtain the trained machine learning classification model; then, combine the 5 sets of hyperspectral data obtained in Steps 2-4 with the feature spectral band dataset in Step 4 as the test set and input them into the trained machine learning classification model for testing and verification.
[0074] Step 6: Repeat steps 2-4 for the sun-dried tobacco sample to be tested, input the processed hyperspectral data into the trained machine learning model, and output the origin identification result.
[0075] In step 1, the sun-dried tobacco samples are rehydrated to adjust their moisture content, avoiding differences in spectral scattering caused by drying and ensuring the stability of the optical properties of the sun-dried tobacco samples. Then, they are graded and cut to eliminate sample heterogeneity without damaging the structure of the sun-dried tobacco samples or causing spectral distortion.
[0076] In step 2, the visible light band (385.31 to 744.04 nm, with a resolution of 2.13 nm) and the near-infrared light band (744.04 to 1024.29 nm, with a resolution of 2.35 nm) are used to collect hyperspectral data. This avoids spectral scattering differences caused by the unstable state of the sun-dried tobacco samples, ensuring that the original hyperspectral data can truly reflect the intrinsic characteristics of sun-dried tobacco from different production areas, thus laying a reliable foundation for subsequent data processing and model building.
[0077] Visible light band (385.31-744.04 nm): Spectral information in this band is closely related to the absorption characteristics of pigments (such as chlorophyll and carotenoids) and proteins in sun-cured tobacco. Environmental factors such as sunlight and soil in different production areas can affect the content and structure of these components, thus showing differences in the visible light spectrum. Acquiring data in this band at a high resolution of 2.13 nm allows for precise capture of the spectral changes caused by these component differences, providing rich characteristic information for origin identification.
[0078] Near-infrared band (744.04-1024.29 nm): This band primarily reflects the molecular vibrational information of organic matter (such as cellulose, hemicellulose, and starch) in sun-cured tobacco. Climate and cultivation methods in different producing regions affect the composition and content of these organic substances in tobacco leaves, resulting in unique spectral characteristics in the near-infrared band. Setting a resolution of 2.35 nm effectively captures detailed information about these molecular vibrations, complementing the visible light data to form a comprehensive hyperspectral dataset reflecting regional differences. 385.31-744.04 nm band (2.13 nm high resolution): In the visible light region, the absorption spectra of substances are complex and detailed. High resolution can more accurately capture subtle spectral differences caused by different producing regions, such as variations in the position, intensity, and width of absorption peaks. This helps subsequent steps in step 3, such as multivariate scattering correction and derivative processing, to more accurately remove noise, highlight features, and improve the quality of the hyperspectral data. 744.04-1024.29nm, 2.35nm resolution: The near-infrared spectrum is relatively smooth with a wide molecular vibration absorption band. Appropriately reducing the resolution (2.35nm) ensures sufficient feature information is obtained while reducing data volume and improving data processing efficiency. This dual-resolution combination effectively reduces the computational load of feature band selection in step 4 and model training in step 5 without significantly reducing identification accuracy, thus improving the overall efficiency of the identification method. This combination of two resolution settings can effectively improve the identification accuracy of samples.
[0079] The raw hyperspectral data retains complete spectral information, reflecting the natural state of the sun-dried tobacco samples. The raw hyperspectral information corrected by multivariate scattering eliminates physical interferences such as scattering effects. The raw hyperspectral data transformed by standard normal variables corrects spectral baseline drift and highlights local features. The raw hyperspectral data processed by the first derivative enhances the changes in spectral slope and highlights compositional differences. The raw hyperspectral data processed by the second derivative further amplifies subtle spectral differences and suppresses low-frequency noise. Different preprocessing methods can extract different dimensional features from the hyperspectral data. Based on five sets of hyperspectral data, feature bands are selected to cover comprehensive information on regional differences, avoiding the limitations of a single preprocessing method.
[0080] In step 4, based on the original hyperspectral dataset from step 2 and the four processed hyperspectral datasets from step 3, a spectral angle algorithm is used to select characteristic spectral bands from all bands. Because the data collected in step 2 has a reasonable range and resolution, it contains a large amount of origin-related characteristic information, enabling the spectral angle algorithm to more accurately calculate the spectral differences of sun-dried tobacco samples from different origins in each band, thus selecting 130 characteristic bands that best reflect these origin differences. These characteristic bands not only contain key information from the visible and near-infrared bands but also remove a large number of redundant bands, reducing data dimensionality and improving the training efficiency and generalization ability of the machine learning model in the subsequent step 5.
[0081] Example 2
[0082] This embodiment further elaborates and supplements the implementation of the present invention based on Embodiment 1.
[0083] In step 3, multivariate scattering correction is used to process the original hyperspectral dataset from step 2 to obtain the processed hyperspectral dataset, as follows:
[0084] First, calculate the average spectrum of the hyperspectral dataset to be corrected, using the following formula:
[0085]
[0086] Then, a linear regression is performed on the average spectrum, as shown in the following formula:
[0087]
[0088] For each spectrum in the set, multivariate scattering correction is performed using the following formula:
[0089]
[0090] In the formula: x i x represents the i-th spectrum (i = 1, 2, ..., n) of the hyperspectral dataset to be corrected; i (MSC) represents the i-th spectrum after multivariate scattering correction; n represents the number of spectra to be corrected; m i and b i Let represent the coefficients and intercepts of the i-th spectrum obtained using the least squares method, respectively.
[0091] In step 3, the original hyperspectral dataset from step 2 is processed using a standard normal variable transformation to obtain the processed hyperspectral dataset, as shown in the following formula:
[0092]
[0093] In the formula: x i,kThis represents the reflectance value of the i-th spectrum at wavelength k, where k = 1, 2, ..., m; m represents the number of wavelength points; x i (SNV) represents the i-th spectrum after standard normal transformation; x i Represents the i-th spectrum, This represents the mean of all spectral curves.
[0094] In step 3, the first derivative is used to process the original hyperspectral dataset from step 2 to obtain the preprocessed hyperspectral dataset, as shown in the following formula:
[0095]
[0096] In the above formula, x represents reflectivity, k is wavelength, g is the difference width, and x k,1st Let be the first derivative of the reflectivity at wavelength k.
[0097] In step 3, the original hyperspectral dataset from step 2 is processed using the second derivative to obtain the processed hyperspectral dataset, as shown in the following formula:
[0098]
[0099] In the above formula, x represents the original hyperspectral image, k is the wavelength, g is the difference width, and x k,2nd Let be the second derivative of the reflectivity at wavelength k.
[0100] Example 3
[0101] This embodiment further elaborates and supplements the implementation of the present invention based on Embodiment 1 or Embodiment 2.
[0102] In step 4, feature selection is performed on a total of 5 hyperspectral datasets as follows:
[0103] All bands of the five hyperspectral datasets were merged to form a multidimensional dataset containing the original hyperspectral dataset and four processed hyperspectral datasets. Each row represents a sun-dried tobacco sample, each column represents a band, and the origin of the sun-dried tobacco is marked in each row.
[0104] For each band, the spectral angle of sun-cured tobacco samples from different origins in that band is calculated using the following formula:
[0105]
[0106] θ(X i ,X j X represents the spectral angles of hyperspectral data from two sun-dried tobacco samples from different origins. i ,X jThe reflectance of sun-cured tobacco samples from two different origins in the same wavelength band.
[0107] All bands are sorted from largest to smallest spectral angle, and the top 130 bands are selected as characteristic spectral bands reflecting the differences in the production areas of sun-dried tobacco.
[0108] 130 characteristic wavelength bands reflecting regional differences in sun-cured tobacco production include: 576.3nm, 578.39nm, 580.48nm, 582.58nm, 584.67nm, 586.77nm, 588.86nm, 590.96nm, 593.06nm, 595.1nm, 597.25nm, 599.35nm, 601.45nm, 603.56nm, 605.66nm, 607.76nm, 609.86nm, 611.9nm, 614.08nm, 616.18nm, 618.29nm, 620.4nm, 622.51nm, 624.62nm, 626.73nm, and 628.84nm. nm, 630.95nm, 633.06nm, 635.18nm, 637.29nm, 639.41nm, 641.52nm, 643.6 4nm, 645.76nm, 647.87nm, 649.99nm, 652.11nm, 654.23nm, 656.36nm, 658. 48nm, 660.6nm, 662.73nm, 664.85nm, 666.98nm, 669.1nm, 671.23nm, 673.3 6nm, 675.49nm, 677.62nm, 679.75nm, 681.88nm, 684.01nm, 686.15nm, 688.2 8nm, 690.41nm, 692.55nm, 694.69nm, 696.82nm, 698.96nm, 701.1nm, 703.2 4nm, 705.38nm, 707.52nm, 709.66nm, 711.81nm, 713.95nm, 716.09nm, 718. 24nm, 720.38nm, 722.53nm, 724.68nm, 726.83nm, 728.98nm, 731.13nm, 733 .28nm, 735.43nm, 737.58nm, 739.74nm, 741.89nm, 744.04nm, 746.2nm, 748. 36nm, 750.51nm, 752.67nm, 754.83nm, 756.99nm, 759.15nm, 761.31nm, 763 .47nm, 765.64nm, 767.8nm, 769.97nm, 772.13nm, 774.3nm, 776.47nm, 778. 63nm, 780.8nm, 782.97nm, 785.14nm, 787.31nm, 789.48nm, 791.66nm, 793. 83nm, 965.86nm, 968.09nm, 970.33nm, 972.57nm, 974.81nm, 977.05nm, 979.29nm、981.53nm、983.78nm、986.02nm、988.27nm、990.51nm、992.76nm、995.01nm、997.25nm、999.5nm、1001.75nm、1 004nm, 1006.25nm, 1008.51nm, 1010.76nm, 1013.01nm, 1015.27nm, 1017.52nm, 1019.78nm, 1022.03nm, 1024.29nm. .
[0109] The machine learning classification model includes a linear discriminant analysis model, a support vector machine model, and an ensemble learning model. In step 5, at least one of the three machine learning classification models is constructed using the selected feature spectral band dataset, and the model is trained using the training set data.
[0110] In step 5, a linear discriminant analysis model is constructed using the selected characteristic spectral band dataset, and the linear discriminant analysis model is trained.
[0111] The goal of linear discriminant analysis is to find a projection direction w such that the projected points of samples from the same class are as close as possible, and the projected points of samples from different classes are as far apart as possible. Its objective function is:
[0112]
[0113] J(w) is the objective function, S b Let S be the inter-class scatter matrix. w Let w be the intra-class scatter matrix and w be the projection direction.
[0114] In step 5, a support vector machine model is constructed using the selected feature spectral band dataset, and the support vector machine model is trained.
[0115] The goal of support vector machines is to find a hyperplane w T x+b maximizes the minimum margin between the two classes of samples.
[0116]
[0117] The constraint is y i (w T x i +b)≥1-ξ i ,ξ i ≥0
[0118] Where: w∈R d ξ is the hyperplane normal vector; b∈R is the bias term; C is the penalty parameter; i For slack variables; (x) i ,yi ) are the training samples.
[0119] In step 5, the selected feature spectral band dataset is used to construct an ensemble learning model and train the ensemble learning model.
[0120] Ensemble learning models improve the generalization ability of a model by combining the predictions of multiple base learners. Their prediction results are as follows:
[0121]
[0122] h i (x) represents the prediction result of the i-th base learner, α i Let be the weights of the i-th base learner.
[0123] The three machine learning classification models in this embodiment are all mature algorithm models in the prior art, and their training processes are also existing training processes.
[0124] Example 4
[0125] This embodiment further elaborates and supplements the implementation of the present invention based on Embodiment 3.
[0126] Step 1: Collect 250 sun-cured tobacco samples from five production areas: Jiajiang County, Qianwei County, Xuzhou District of Yibin City, Deyang City, and Liangshan Yi Autonomous Prefecture. Then, rehydrate, grade, and cut the 250 sun-cured tobacco samples. Finally, divide the 250 pre-treated sun-cured tobacco samples into training samples and test samples at a ratio of 68:32.
[0127] Step 2, as follows Figure 1 As shown, a hyperspectral imaging system was used to acquire full-band spectral data of training samples in the visible and near-infrared bands (385.31-1024.29 nm), forming the original hyperspectral data D0. The resolution was set to 2.13 nm for the band range between 385.31 and 744.04 nm, and 2.35 nm for the band range between 744.04 and 1024.29 nm. Each training sample was scanned 25 times using the hyperspectral imaging system, and the average value was taken. This average value is the statistical mean of the reflectance of each training sample in each band. Essentially, it eliminates random noise and improves the reliability of hyperspectral data through multiple measurements.
[0128] Step 3, as follows Figures 2-5 As shown, the original hyperspectral dataset in step 2 was processed by multivariate scattering correction, standard normal variable transformation, first derivative, and second derivative to obtain four processed hyperspectral datasets, denoted as D1, D2, D3, and D4.
[0129] Step 4: Based on the original hyperspectral dataset in Step 2 and the four sets of hyperspectral datasets in Step 3, a total of five sets of hyperspectral datasets are generated. All bands of the five sets of hyperspectral datasets are merged to form a multidimensional dataset containing the original hyperspectral dataset and four processed hyperspectral datasets. Each row represents a sun-dried tobacco sample, each column represents a band, and the origin of the sun-dried tobacco is marked in each row.
[0130] For each band, calculate the spectral angle of sun-cured tobacco samples from different origins in that band, such as... Figure 6 As shown, a spectral angle heatmap is plotted using the following formula:
[0131]
[0132] θ(X i ,X j X represents the spectral angles of hyperspectral data from two sun-dried tobacco samples from different origins. i ,X j The reflectance of sun-cured tobacco samples from two different origins in the same wavelength band.
[0133] All bands were sorted from largest to smallest spectral angle, and the top 130 bands were selected as characteristic spectral bands reflecting differences in the origin of sun-cured tobacco. These include: 576.3nm, 578.39nm, 580.48nm, 582.58nm, 584.67nm, 586.77nm, 588.86nm, 590.96nm, 593.06nm, 595.1nm, 597.25nm, 599.35nm, 601.45nm, 603.56nm, 605.66nm, 607.76nm, 609.86nm, 611.9nm, 614.08nm, 616.18nm, 618.29nm, 620.4nm, and 622.51nm. nm, 624.62nm, 626.73nm, 628.84nm, 630.95nm, 633.06nm, 635.18nm, 637.2 9nm, 639.41nm, 641.52nm, 643.64nm, 645.76nm, 647.87nm, 649.99nm, 652. 11nm, 654.23nm, 656.36nm, 658.48nm, 660.6nm, 662.73nm, 664.85nm, 666. 98nm, 669.1nm, 671.23nm, 673.36nm, 675.49nm, 677.62nm, 679.75nm, 681.8 8nm, 684.01nm, 686.15nm, 688.28nm, 690.41nm, 692.55nm, 694.69nm, 696. 82nm, 698.96nm, 701.1nm, 703.24nm, 705.38nm, 707.52nm, 709.66nm, 711. 81nm, 713.95nm, 716.09nm, 718.24nm, 720.38nm, 722.53nm, 724.68nm, 726 .83nm, 728.98nm, 731.13nm, 733.28nm, 735.43nm, 737.58nm, 739.74nm, 741 .89nm, 744.04nm, 746.2nm, 748.36nm, 750.51nm, 752.67nm, 754.83nm, 756 .99nm, 759.15nm, 761.31nm, 763.47nm, 765.64nm, 767.8nm, 769.97nm, 772 .13nm, 774.3nm, 776.47nm, 778.63nm, 780.8nm, 782.97nm, 785.14nm, 787. 31nm, 789.48nm, 791.66nm, 793.83nm, 965.86nm, 968.09nm, 970.33nm, 972.57nm, 974.81nm, 977.05nm, 979.29nm, 981.53nm, 983.78nm, 986.02nm, 988.27nm, 990.51nm, 992.76nm, 995.01nm, 997.25nm, 999.5 nm, 1001.75nm, 1004nm, 1006.25nm, 1008.51nm, 1010.76nm, 1013.01nm, 1015.27nm, 1017.52nm, 1019.78nm, 1022.03nm, 1024.29nm. .
[0134] Step 5: Combine the selected feature spectral band dataset with the 5 sets of hyperspectral datasets in Step 4. That is, combine the same 130 feature bands selected in Step 4 from each set of hyperspectral data to form 5 inputs. Input these 5 inputs into the linear discriminant analysis model, the support vector machine model, and the ensemble learning model for training, respectively.
[0135] The test samples were processed according to steps 2-4 to obtain 5 sets of hyperspectral data. Each set of hyperspectral data was combined with the same 130 feature bands selected in step 4 to form 5 inputs as test sets. These inputs were then fed into the trained machine learning classification model for testing and verification, followed by calculation of classification accuracy.
[0136]
[0137] In the formula: TP represents true positives, the number of samples correctly identified as originating from a given region; TN represents true negatives, the number of samples correctly excluded from that region; FP represents false positives, the number of samples incorrectly identified as originating from a given region; and FN represents false negatives, the number of samples incorrectly excluded from that region. The results are as follows: Figure 7 As shown, the original hyperspectral data, after being processed by the first derivative, was input into a support vector machine for validation, and the highest classification accuracy was obtained, as shown below. Figure 8 The figure shows the verification confusion matrix of the Support Vector Machine (SVM model).
[0138] like Figure 9 As shown, setting the resolution to 2.13 nm for the band range of 385.31 to 744.04 nm and the resolution to 2.35 nm for the band range of 744.04 to 1024.29 nm yields the highest accuracy of 97.1% with first-order derivative processing. Other resolution combinations, even when using first-order derivatives, achieve lower accuracy. This demonstrates that the wavelength spacing of hyperspectral data acquired at a specific resolution is optimally matched to the difference width of the first-order derivative.
[0139] like Figure 10As shown, when the training set ratio increases from 68% to 85%, the accuracy of the first derivative + 130 bands remains stable above 94%. Figure 11 As shown, the accuracy of the full-band input is less than 90%, indicating that the 130 feature bands, after first-derivative processing, have strong stability in their origin discrimination features and are not affected by fluctuations in the amount of training data. The optimal combination of hyperspectral data processed by first-derivative and 130 feature bands is a three-dimensional collaboration of spectral preprocessing, feature selection, and model adaptation. The first derivative, through slope enhancement and noise suppression, accurately amplifies the features of origin differences, while the 130 feature bands selected by the spectral angle algorithm precisely capture these origin differences features after first-derivative processing. Furthermore, the nonlinear mapping capability of the support vector machine to the first-derivative features maximizes the discriminative power.
Claims
1. A method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms, characterized in that: Includes the following steps: Step 1: Obtain sun-cured tobacco samples from different production areas and pre-process the sun-cured tobacco samples. The pre-processing includes re-moistening, grading and cutting the sun-cured tobacco samples. Then, the pre-processed sun-cured tobacco samples are divided into training samples and test samples, with training samples accounting for 68% and test samples accounting for 32%. Step 2: Use a hyperspectral imaging system to acquire full-band spectral data of the training samples in the visible and near-infrared bands (385.31-1024.29 nm) to form the raw hyperspectral data D0; set the resolution to 2.13 nm for the band range of 385.31 to 744.04 nm and the resolution to 2.35 nm for the band range of 744.04 to 1024.29 nm. Step 3: The original hyperspectral dataset from Step 2 is processed using multivariate scattering correction, standard normal variable transformation, first derivative, and second derivative to obtain four processed hyperspectral datasets, denoted as D1, D2, D3, and D4. Step 4: Based on the original hyperspectral dataset in Step 2 and the 4 sets of hyperspectral datasets in Step 3, a total of 5 sets of hyperspectral datasets are generated. The spectral angle algorithm is used to extract 130 characteristic spectral band datasets from all bands in the 5 sets of hyperspectral datasets to reflect the differences in the origin of sun-dried tobacco. Step 5: Combine the selected feature spectral band dataset with the 4 sets of hyperspectral datasets from Step 3 as the training set to build a machine learning classification model and train it to obtain the trained machine learning classification model. The test samples are obtained by following steps 2-4 to obtain 5 sets of hyperspectral data. Combined with the feature spectral band dataset in step 4, the test set is input into the trained machine learning classification model for testing and verification. Step 6: Repeat steps 2-4 for the sun-dried tobacco sample to be tested, input the processed hyperspectral data into the trained machine learning model, and output the origin identification result.
2. The method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 1, characterized in that: The origins of the sun-dried tobacco samples in step 1 include Jiajiang County, Qianwei County, Xuzhou District of Yibin City, Deyang City, and Liangshan Yi Autonomous Prefecture.
3. A method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 1 or 2, characterized in that: In step 3, multivariate scattering correction is used to process the original hyperspectral dataset from step 2 to obtain the processed hyperspectral dataset, as follows: First, calculate the average spectrum of the hyperspectral dataset to be corrected, using the following formula: Then, a linear regression is performed on the average spectrum, as shown in the following formula: For each spectrum in the set, multivariate scattering correction is performed using the following formula: In the formula: x i x represents the i-th spectrum (i = 1, 2, ..., n) of the hyperspectral dataset to be corrected; i (MSC) represents the i-th spectrum after multivariate scattering correction; n represents the number of spectra to be corrected; m i and b i Let represent the coefficients and intercepts of the i-th spectrum obtained using the least squares method, respectively.
4. A method for identifying the origin of sun-dried tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 1 or 2, characterized in that: In step 3, the original hyperspectral dataset from step 2 is processed using a standard normal variable transformation to obtain the processed hyperspectral dataset, as shown in the following formula: In the formula: x i,k Let represent the reflectance value of the i-th spectrum at wavelength k, where k = 1, 2, ..., m; m represents the number of wavelength points; x i (SNV) represents the i-th spectrum after standard normal transformation; x i Represents the i-th spectrum, This represents the mean of all spectral curves.
5. A method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 1 or 2, characterized in that: In step 3, the first derivative is used to process the original hyperspectral dataset from step 2 to obtain the processed hyperspectral dataset, as shown in the following formula: In the above formula, x represents reflectivity, k is wavelength, g is the difference width, and x k,1st Let be the first derivative of the reflectivity at wavelength k.
6. A method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 1 or 2, characterized in that: In step 3, the original hyperspectral dataset from step 2 is preprocessed using the second derivative to obtain the preprocessed hyperspectral dataset, as shown in the following formula: In the above formula, x represents the original hyperspectral image, k is the wavelength, g is the difference width, and x K,2nd Let be the second derivative of the reflectivity at wavelength k.
7. The method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 2, characterized in that: In step 4, feature selection is performed on a total of 5 hyperspectral datasets as follows: All bands of the five hyperspectral datasets were merged to form a multidimensional dataset containing the original hyperspectral dataset and four processed hyperspectral datasets. Each row represents a sun-dried tobacco sample, each column represents a band, and the origin of the sun-dried tobacco is marked in each row. For each band, the spectral angle of sun-cured tobacco samples from different origins in that band is calculated using the following formula: θ(X i ,X j X represents the spectral angles of hyperspectral data from two sun-dried tobacco samples from different origins. i ,X j The reflectance of sun-cured tobacco samples from two different origins in the same wavelength band; All bands are sorted from largest to smallest spectral angle, and the top 130 bands are selected as characteristic spectral bands reflecting the differences in the production areas of sun-dried tobacco. 130 characteristic wavelength bands reflecting regional differences in sun-cured tobacco production include: 576.3nm, 578.39nm, 580.48nm, 582.58nm, 584.67nm, 586.77nm, 588.86nm, 590.96nm, 593.06nm, 595.1nm, 597.25nm, 599.35nm, 601.45nm, 603.56nm, 605.66nm, 607.76nm, 609.86nm, 611.9nm, 614.08nm, 616.18nm, 618.29nm, 620.4nm, 622.51nm, 624.62nm, 626.73nm, and 628.84nm. nm, 630.95nm, 633.06nm, 635.18nm, 637.29nm, 639.41nm, 641.52nm, 643.6 4nm, 645.76nm, 647.87nm, 649.99nm, 652.11nm, 654.23nm, 656.36nm, 658. 48nm, 660.6nm, 662.73nm, 664.85nm, 666.98nm, 669.1nm, 671.23nm, 673.3 6nm, 675.49nm, 677.62nm, 679.75nm, 681.88nm, 684.01nm, 686.15nm, 688.2 8nm, 690.41nm, 692.55nm, 694.69nm, 696.82nm, 698.96nm, 701.1nm, 703.2 4nm, 705.38nm, 707.52nm, 709.66nm, 711.81nm, 713.95nm, 716.09nm, 718. 24nm, 720.38nm, 722.53nm, 724.68nm, 726.83nm, 728.98nm, 731.13nm, 733 .28nm, 735.43nm, 737.58nm, 739.74nm, 741.89nm, 744.04nm, 746.2nm, 748. 36nm, 750.51nm, 752.67nm, 754.83nm, 756.99nm, 759.15nm, 761.31nm, 763 .47nm, 765.64nm, 767.8nm, 769.97nm, 772.13nm, 774.3nm, 776.47nm, 778. 63nm, 780.8nm, 782.97nm, 785.14nm, 787.31nm, 789.48nm, 791.66nm, 793. 83nm, 965.86nm, 968.09nm, 970.33nm, 972.57nm, 974.81nm, 977.05nm, 979.29nm, 981.53nm, 983.78nm, 986.02nm, 988.27nm, 990.51nm, 992.76nm, 995.01nm, 997.25nm, 999.5nm, 1001.75nm, 1004nm, 1006.25nm, 1008.51nm, 1010.76nm, 1013.01nm, 1015.27nm, 1017.52nm, 1019.78nm, 1022.03nm, 1024.29nm.
8. The method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 1, characterized in that: The machine learning classification model includes a linear discriminant analysis model, a support vector machine model, and an ensemble learning model. In step 5, at least one of the three machine learning classification models is constructed using the selected feature spectral band dataset, and the model is trained using the training set.
9. The method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 8, characterized in that: In step 5, a linear discriminant analysis model is constructed using the selected characteristic spectral band dataset, and the linear discriminant analysis model is trained.
10. The method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 8, characterized in that: In step 5, a support vector machine model is constructed using the selected feature spectral band dataset, and the support vector machine model is trained.
11. The method for identifying the origin of sun-cured tobacco based on hyperspectral characteristic bands and machine learning algorithms as described in claim 8, characterized in that: In step 5, the selected feature spectral band dataset is used to construct an ensemble learning model and train the ensemble learning model.