Method and system for identifying and detecting age limit of ginseng based on laser-induced breakdown spectroscopy
By combining laser induced breakdown spectroscopy technology and neural network algorithm, an integrated classification model based on voting method was established, which solved the accuracy and operational complexity of traditional ginseng years identification methods, and achieved rapid, lossless and high-precision identification of ginseng years. .
Patent Information
- Application Number
- CN202411350261.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-02-14
AI Technical Summary
The traditional ginseng age identification method has problems such as strong subjectivity, low accuracy and complex operation, which is difficult to meet the needs of large-scale testing.
Using laser induced breakdown spectroscopy (LIBS) technology combined with neural network algorithm, an integrated classification model based on voting method is established through data preprocessing, feature selection and multiple classification algorithm models to achieve fast, lossless and high-precision identification of ginseng years. .
It realizes rapid, lossless and high-precision identification of ginseng years, avoids the need for complex pretreatment of traditional methods and high-precision detection instruments, and is suitable for ginseng quality identification and market supervision.
Smart Images

Figure CN119446340A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of traditional Chinese medicine identification, and in particular relates to a ginseng age identification detection method and system based on laser induced breakdown spectroscopy. Background Art
[0002] Ginseng is a polyphyllous herb of the genus Panax in the Araliaceae family. As a famous Chinese medicinal material, it is known as the "king of herbs". It contains a variety of effective ingredients, such as ginsenosides, polysaccharides, trace elements, etc. Ginseng has the effects of greatly replenishing vitality, strengthening the spleen and lungs, promoting fluid production and quenching thirst, calming the mind and improving intelligence. It is often used to treat symptoms such as qi deficiency and fatigue, loss of appetite, palpitations and insomnia. The growth age of ginseng is an important indicator for judging its quality and efficacy. The accumulation of effective ingredients of ginseng with different growth years is different, and the medicinal value and economic value vary greatly. Therefore, it is of great significance to use reliable technical methods to identify the growth age of ginseng. The traditional identification method is manual identification, which has detection defects such as strong subjectivity and low accuracy. Identification methods such as microscopic identification and effective component content detection require complex sample pretreatment and professional operation requirements, which are difficult to meet the large-scale detection needs of actual production.
[0003] Laser-induced breakdown spectroscopy (LIBS) technology has attracted widespread attention for its advantages such as rapidity, greenness, ease of operation, and low destructiveness to samples. The main detection principle of LIBS is that a multi-channel spectrometer captures the plasma generated by the high-energy laser focusing on the surface of the sample to be tested, and obtains qualitative and quantitative information of the sample by analyzing the element information of atoms, ions, and molecules in the plasma spectrum. Studies have shown that ginseng contains many inorganic elements, with the highest content of potassium, magnesium, calcium and other inorganic elements, followed by iron, sodium, manganese, barium and other elements. As the growth years of ginseng change, the content of inorganic elements in ginseng will also change accordingly. Therefore, it is possible to try to use laser-induced breakdown spectroscopy technology to quickly detect the intensity of element spectral lines in ginseng of different ages, and combine it with a neural network algorithm model to predict the age of ginseng. Summary of the invention
[0004] The present invention proposes a ginseng age identification and detection method and system based on laser induced breakdown spectroscopy, which has the advantages of being rapid, non-destructive and highly precise, and can be widely used in the fields of ginseng quality identification and market supervision.
[0005] In order to achieve the above object, the technical solution of the present invention is implemented as follows:
[0006] A method for identifying the age of ginseng based on laser induced breakdown spectroscopy, comprising:
[0007] S1. Collect ginseng of different ages as samples;
[0008] S2. Using a laser induced breakdown spectroscopy system to collect spectral data from different parts of ginseng of different ages, and establish original spectral data of the samples;
[0009] S3, dividing the raw spectral data into data sets and performing normalization preprocessing;
[0010] S4, using genetic algorithm GA to perform feature selection on the preprocessed spectral data;
[0011] S5, using different classification algorithms to process the feature selection data and establish classification algorithm models;
[0012] S6. For the prediction of the service life of each classification algorithm model, an integrated classification model based on the voting method is established;
[0013] S7. Obtain the feature selection data of the ginseng to be tested through steps S2, S3, and S4, input them into each classification algorithm model, and obtain the predicted years respectively; through the integrated classification model based on the voting method, obtain the year category with the highest probability as the final ginseng year prediction result.
[0014] Furthermore, the process of dividing the original spectral data into data sets in step S3 includes:
[0015] S301, initializing the original spectral data: setting M to represent the total number of ginseng samples and N to represent the number of training sets;
[0016] S302, standardizing the ginseng age corresponding to the original spectral data;
[0017] S303, setting a feature matrix D(M*M) to store the Euclidean distances between all original spectral data; setting a target value matrix Dy(M*M) to store the label differences between all sample pairs;
[0018] S304, normalizing the characteristic matrix D(M*M) and the target value matrix Dy(M*M) to the same scale, and then adding them to obtain a new distance matrix that takes into account both the characteristic distance of the original spectral data and the target value distance;
[0019] S305, establish a loop to gradually select samples of the training set; first select the two original spectral data with the largest distance in the distance matrix as the initial samples of the training set, and then select the unselected original spectral data with the largest distance to the selected samples as the subsequent training set samples; and select in a loop until the size of the training set reaches N;
[0020] S306: The unselected original spectral data is used as a test set.
[0021] Furthermore, the specific process of step S4 includes:
[0022] S401, create a FitnessMax class and an Individual class: FitnessMax represents the maximized fitness function, and Individual represents an individual;
[0023] S402, normalizing the original spectrum data and the corresponding ginseng age data;
[0024] S403, setting the crossover probability Pc, the mutation probability Pm and the variable selection threshold;
[0025] S404, registering a function for creating an individual and a function for creating a population;
[0026] S405, defining an evaluation function and calculating the fitness of the individual;
[0027] S406, creating a population, setting the iteration number, and performing iteration of the genetic algorithm;
[0028] S407. After the iteration is completed, select the individual with the best fitness, that is, the individual with the best feature selection.
[0029] Furthermore, step S5 includes: processing and modeling the feature selection data respectively through four algorithms: logistic regression LR, support vector machine SVM, random forest RF and multi-layer perceptron MLP.
[0030] Furthermore, in step S6, an integrated classification model based on voting method is established, including: taking the prediction results of each classification algorithm model on different years of ginseng, and taking the average value of the probability that all model prediction results are a certain year category according to the soft voting method as the standard, and the corresponding year category with the highest probability is the final ginseng year prediction result.
[0031] On the other hand, the present invention also proposes a ginseng age identification and detection system based on laser induced breakdown spectroscopy, comprising:
[0032] The sample module collects ginseng of different ages as samples;
[0033] The original spectrum data module uses the laser-induced breakdown spectroscopy system to collect spectrum data from different parts of ginseng of different years and establish the original spectrum data of the samples;
[0034] A data preprocessing module, which divides the raw spectral data into data sets and performs normalization preprocessing;
[0035] Feature selection module, using genetic algorithm GA to perform feature selection on preprocessed spectral data;
[0036] The classification algorithm model module uses different classification algorithms to process feature selection data and establish classification algorithm models;
[0037] The integrated model module establishes an integrated classification model based on the voting method for the life prediction of each classification algorithm model;
[0038] Prediction module: Through the original spectral data module, data preprocessing module and feature selection module, the feature selection data of the ginseng to be tested is obtained, and input into each single model module to obtain the predicted years respectively; through the integrated classification model based on the voting method of the single model module, the year category with the highest probability is obtained as the final ginseng year prediction result.
[0039] Furthermore, the data preprocessing module includes:
[0040] Initialization unit: initializing the original spectral data, setting M to represent the total number of ginseng samples and N to represent the number of training sets;
[0041] Standardization unit: taking the ginseng age corresponding to the original spectral data as the variable y for standardization;
[0042] Matrix setting unit: set the feature matrix D(M*M) to store the Euclidean distance between all original spectral data; set the target value matrix Dy(M*M) to store the label differences between all sample pairs;
[0043] Distance matrix unit: normalize the feature matrix D(M*M) and the target value matrix Dy(M*M) to the same scale, and then add them together to obtain a new distance matrix that takes into account both the feature distance of the original spectral data and the target value distance;
[0044] A loop selection unit: establishes a loop to gradually select samples of the training set; firstly, two original spectral data with the largest distance in the distance matrix are selected as initial samples of the training set, and then unselected original spectral data with the largest distance to the selected samples are selected as subsequent training set samples; and the loop selection is performed until the size of the training set reaches N;
[0045] Test set unit: unselected raw spectral data as the test set.
[0046] Furthermore, the feature selection module includes:
[0047] Create unit: Create FitnessMax class and Individual class: FitnessMax represents the maximized fitness function, and Individual represents the individual;
[0048] Normalization unit: normalize the original spectrum data and the corresponding ginseng age data;
[0049] Setting unit: setting the crossover probability Pc, mutation probability Pm and variable selection threshold;
[0050] Registration unit: registers the function of creating individuals and the function of creating populations;
[0051] Evaluation function unit: defines the evaluation function and calculates the fitness of the individual;
[0052] Iteration unit: creates a population, sets the iteration number, and iterates the genetic algorithm;
[0053] Selection unit: After the iteration is completed, select the individual with the best fitness, that is, the individual with the best feature selection.
[0054] Furthermore, the classification algorithm model module includes: processing and modeling the feature selection data respectively through four algorithms: logistic regression LR, support vector machine SVM, random forest RF and multi-layer perceptron MLP.
[0055] Furthermore, the integrated model module includes: taking the prediction results of each classification algorithm model on different years of ginseng, and taking the average value of the probability that all model prediction results are a certain year category as the standard according to the soft voting method, and the corresponding year category with the highest probability is the final ginseng year prediction result.
[0056] Compared with the prior art, the present invention has the following beneficial effects:
[0057] 1. The present invention realizes the identification of ginseng of different ages based on laser induced breakdown spectroscopy detection technology. Through data preprocessing, feature selection and multiple classification algorithm models, an integrated classification model based on voting method is established, which accurately realizes the identification and classification of ginseng of different ages. It has the advantages of fast, non-destructive and high precision, and can be widely used in the fields of ginseng quality identification and market supervision.
[0058] 2. The present invention can avoid the complex pre-processing, large-scale precision detection instruments, long time consumption and other detection defects required by the current detection methods such as manual identification, microscopic identification and determination of effective component content for ginseng age identification, and realize efficient and non-destructive identification of ginseng age. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 1 is a schematic diagram of a ginseng age detection method based on LIBS according to an embodiment of the present invention;
[0060] Figure 2 is a schematic diagram of ginseng samples of different ages according to an embodiment of the present invention;
[0061] Figure 3LIBS spectrum elemental schematic diagram of ginseng sample according to an embodiment of the present invention;
[0062] Figure 4 It is a framework diagram of an integrated classification model based on voting method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0063] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0064] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0065] This embodiment provides a method and system for identifying and detecting ginseng of different ages based on laser induced breakdown spectroscopy detection technology.
[0066] It should be noted that the device used in the embodiment of the present invention mainly includes: a high-energy pulsed laser; a reflector and a lens; a three-dimensional mobile workbench for placing ginseng samples; a signal acquisition probe; a spectrometer and a computer. Among them, the laser can be a YAG pulsed laser (Nano SG150-10., Li tron lasers Ltd., UK); the three-dimensional mobile workbench can be a three-dimensional (XYZ) motion platform (Ocean Optics, USA); the signal acquisition probe can be a linear charge coupled device (CCD) detector (Sony IL511B, Ocean Opt i cs, USA); the spectrometer can be a multi-channel spectrometer (MX2500+, Ocean Opt ics, USA); the computer is a computer equipped with MaxLIBS software (version 1.6.7, Ocean Optics) to control the hardware and obtain LIBS data, and perform the ginseng age identification detection method based on laser induced breakdown spectroscopy.
[0067] like Figure 1 As shown, the ginseng age identification and detection method based on laser induced breakdown spectroscopy in this embodiment includes the following main steps:
[0068] 1. Collect samples to be tested:
[0069] In this example, 2-year-old, 3-year-old, 4-year-old and 5-year-old sun-dried ginseng of different ages were collected from a certain county, with 80 ginseng roots of each age, for a total of 320 samples. Figure 2 shown.
[0070] 2. Collect sample spectral data:
[0071] Before starting the acquisition, the parameters of the laser induced breakdown spectroscopy instrument were optimized, where the laser wavelength of the laser was 1064nm and the spectral band was 180-1100nm. After the conditions were optimized, a laser energy of 100mJ, a delay time of 2us, and a pulse repetition frequency of 10Hz were used for laser excitation and subsequent spectral signal acquisition. During the acquisition, a total of 100 spectra were collected at different positions for each ginseng sample using the laser induced breakdown spectroscopy system, and the average value of the 100 spectral data was calculated as the original spectral data of the ginseng sample. The LIBS spectrum of the ginseng sample is shown in Figure 2. Figure 3 As shown, the elements with higher spectral intensity are sodium, magnesium, calcium, iron and other elements.
[0072] 3. Data preprocessing:
[0073] First, divide the data set and divide the 320 sample data collected. The specific steps are as follows:
[0074] (1) Initialization parameters: Set M to represent the total number of ginseng samples, N to represent the sample size of the target training set, and set "test_size" to 0.3 to retain 70% of the data as the training set. In addition, set an array from 0 to M-1 for subsequent indexing of samples.
[0075] (2) Standardizing the target variable: In this step, the ginseng age corresponding to the original spectral data is standardized by subtracting the mean and then dividing by the standard deviation, so that the subsequent distance calculation will not be affected by different dimensions.
[0076] (3) Calculate the distance matrix: set the feature matrix D(M*M) to store the Euclidean distances between all original spectral data; set the target value matrix Dy(M*M) to store the label differences between all sample pairs;
[0077] (4) Normalized distance matrix: normalize the feature matrix D(M*M) and the target value matrix Dy(M*M) to the same scale, and then add them together to obtain a new distance matrix that takes into account both the feature distance of the original spectral data and the target value distance;
[0078] (5) Select training set samples: Through a loop, the samples of the training set are gradually selected. First, the two samples with the largest distance are selected as the initial samples of the training set. Then, for each subsequent selected training set sample, the unselected sample with the largest distance to the selected sample is selected. This process continues until the size of the training set reaches N.
[0079] (6) Obtain test set samples: Set the complement of the training set sample index (i.e., all sample indexes not included in the training set) as m_complement. Use these indexes to extract the test set from the data. The final ratio of the training set to the prediction set is 7:3, with a total of 224 samples in the training set and 96 samples in the prediction set. The original spectral data is then preprocessed using a normalization algorithm, limiting the data to between [0,1] to achieve spectral standardization.
[0080] 4. Feature Selection
[0081] The GA algorithm is used to process the normalized spectral data to achieve spectral data dimension reduction.
[0082] The specific process is:
[0083] (1) Create FitnessMax class and Individual class: FitnessMax represents the maximized fitness function, and Individual represents the individual.
[0084] (2) Data normalization: Normalize the input feature matrix X and target variable Y data. The feature matrix X is the spectral data matrix, and the target variable Y is the age (label) of the ginseng sample corresponding to the spectral data.
[0085] (3) Basic parameter setting: set the crossover probability Pc to 0.5, the mutation probability Pm to 0.1, and the variable selection threshold to 0.5.
[0086] (4) Register the function for creating individuals and the function for creating populations.
[0087] (5) Define the evaluation function and calculate the fitness of the individual: First, convert the individual (the individual is a combination of feature variables randomly selected from the spectral data of the sample) into a binary array. Second, select the feature variables greater than the threshold according to the set variable selection threshold. Select the optimal number of principal components through 5-fold cross validation, and use partial least squares regression modeling to calculate the R of the cross-validation prediction. 2 Finally, the maximum R 2 The value is returned as the fitness.
[0088] (6) Create a population, set the number of iterations, and iterate the genetic algorithm: Specifically, in each generation, crossover and mutation operations are performed according to the set crossover probability and mutation probability. Then, the fitness values of the individuals in the population are calculated, the individuals of the next generation are selected, and statistical information such as the minimum fitness value and the maximum fitness value of each generation is output. The fitness is the R obtained in step (5). 2The fitness values of all individuals are sorted, and individuals are selected for reproduction according to the fitness values. Individuals with higher fitness values have a higher probability of being selected. The selected individuals are paired in pairs, and new individuals are generated through crossover operations. The crossover operation simulates the gene recombination process in biological evolution.
[0089] (7) Selection of feature variables: After the iteration is completed, the individual with the best fitness is selected, that is, the individual with the best feature selection.
[0090] 5. Classification algorithm model establishment
[0091] The feature selection data is input into four different classifiers: logistic regression (LR), support vector machine (SVM), random forest (RF) and multi-layer perceptron (MLP) to establish a classification algorithm model.
[0092] Logistic regression (LR) is a statistical method widely used for classification problems, especially binary classification problems. It is based on linear regression and uses a logistic function (such as the sigmoid function) to map the output of linear regression to between 0 and 1 to predict the probability. Specifically, in the process of building the LR classification model, the sigmoid function is used. As the activation function, the model formula is P(Y=1|X)=σ(β0+β1X1+β2X2+…+β n X n ), where P(Y=1|X) is the conditional probability that Y=1 given X. z=β0+β1X1+β2X2+…+β n X n ; X1, X2, …, X n is the input feature data; β0 is the intercept term, β1, β2, …, β n is the feature weight. Then the maximum likelihood estimation is used to estimate the model parameters, and the gradient descent method is used to minimize the loss function, and finally the classification accuracy is used to achieve model evaluation.
[0093] Support vector machine (SVM) is a supervised learning algorithm based on the maximum margin principle, used for classification and regression analysis. It finds a hyperplane that can separate data points of different categories. In the process of establishing its classification model, the establishment of the hyperplane mainly involves the establishment and solution of the objective function. In the process of model training, the sequence minimization algorithm or quadratic programming solver is used to find the optimal solution, and finally the hyperplane is obtained, the classification decision function is determined, and the model evaluation is realized based on model indicators such as accuracy and recall.
[0094] Random Forest RF is an ensemble learning method that improves the accuracy and stability of predictions by building multiple decision trees and voting. Its modeling process mainly consists of the following steps: First, randomly extract samples with replacement from the original data set to form multiple sub-data sets. Secondly, build a decision tree for each sub-data set. Randomly select feature subsets at each node and find the optimal split point. Finally, build multiple decision trees by repeating the above process, and synthesize their prediction results. Use indicators such as out-of-bag error rate (OOB error) and accuracy to evaluate the model.
[0095] The multi-layer perceptron MLP is a feed-forward artificial neural network that contains at least three layers: input layer, hidden layer, and output layer. Its architecture is that the number of nodes in the input layer is equal to the number of features, and the number of nodes in the output layer depends on the type of classification problem (usually 1 for binary classification). The activation function (such as Relu or Sigmoid) is required in the process of model building. The back propagation algorithm and gradient descent method are used to optimize the weights and biases during model training. Finally, the model is evaluated using indicators such as classification accuracy and loss function value.
[0096] The specific results are shown in Table 1:
[0097] Model Preprocessing Feature Selection Classification accuracy LR Normalization GA 90.3% SVM Normalization GA 91.9% RF Normalization GA 88.1% MLP Normalization GA 92.5%
[0098] Table 1: Results of ginseng age identification model based on single model
[0099] 6. Ensemble classification model based on voting method:
[0100] The characteristic spectral data are input into four different classifiers for training and modeling, and the prediction results of each classification algorithm model on different years of ginseng are obtained. According to the soft voting method, the average value of the probability of all models predicting samples as a certain category is used as the standard, and the type with the highest probability is the final ginseng age prediction result. Specifically: the data-processed spectral data of the ginseng sample to be tested are input into four different single models respectively. Since the ginseng years included in the training set samples are 2 years, 3 years, 4 years and 5 years respectively. Therefore, the four models will give a prediction result of 2 years, 3 years, 4 years or 5 years for each sample in the sample to be tested. Assume that the probabilities of the four classification models LR, SVM, RF, and MLP for identifying a sample as 2, 3, 4, and 5 years of ginseng are (LR2, LR3, LR4, LR5), (SVM2, SVM3, SVM4, SVM5), (RF2, RF3, RF4, RF5), and (MLP2, MLP3, MLP4, MLP5) respectively (if the model identifies the sample as a certain year, the probability of identifying the year in the model prediction result is the largest). Then the prediction results of the integrated model based on the voting method for each year are (LR2+SVM2+RF2+MLP2) / 4, (LR3+SVM3+RF3+MLP3) / 4, (LR4+SVM4+RF4+MLP4) / 4, and (LR5+SVM5+RF5+MLP5) / 4 respectively. If (LR2+SVM2+RF2+MLP2) / 4>(LR3+SVM3+RF3+MLP3) / 4>(LR4+SVM4+RF4+MLP4) / 4>(LR5+SVM5+RF5+MLP5) / 4, the integrated model finally determines that the identification age of the sample ginseng is 2 years. In this way, the prediction of all samples and the calculation of the final age classification accuracy are completed. The modeling prediction results are shown in Table 2:
[0101] Model Preprocessing Feature Selection Classification accuracy LR-SVM-RF-MLP Normalization GA 95.8%
[0102] Table 2: Results of the ensemble classification model of ginseng age based on voting method
[0103] Among them, the above-mentioned spectral data preprocessing, feature selection, single model establishment and integrated classification model establishment were all operated on Python3.9.6 software.
[0104] In summary, the embodiments of the present invention can avoid the shortcomings of the existing methods for ginseng age detection, such as low precision, long sample pretreatment time, and complex experiments, through the above steps, and achieve rapid, large-scale, and easy-to-operate detection of ginseng age.
[0105] Unless otherwise specified, the models of the components in the embodiments of the present invention are not limited, and any device that can perform the above functions may be used.
[0106] The above embodiments are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for identifying the age of ginseng based on laser induced breakdown spectroscopy, characterized in that: include: S1. Collect ginseng of different ages as samples; S2. Using a laser induced breakdown spectroscopy system to collect spectral data from different parts of ginseng of different ages, and establish original spectral data of the samples; S3, dividing the raw spectral data into data sets and performing normalization preprocessing; S4, using genetic algorithm GA to perform feature selection on the preprocessed spectral data; S5, using different classification algorithms to process the feature selection data and establish classification algorithm models; S6. For the prediction of the service life of each classification algorithm model, an integrated classification model based on the voting method is established; S7. Obtain the feature selection data of the ginseng to be tested through steps S2, S3, and S4, input them into each classification algorithm model, and obtain the predicted years respectively; through the integrated classification model based on the voting method, obtain the year category with the highest probability as the final ginseng year prediction result.
2. The ginseng age identification and detection method based on laser induced breakdown spectroscopy according to claim 1 is characterized in that: The process of dividing the original spectral data into data sets in step S3 includes: S301, initializing the original spectral data: setting M to represent the total number of ginseng samples and N to represent the number of training sets; S302, standardizing the ginseng age corresponding to the original spectral data; S303, setting a feature matrix D(M*M) to store the Euclidean distances between all original spectral data; setting a target value matrix Dy(M*M) to store the label differences between all sample pairs; S304, normalizing the characteristic matrix D(M*M) and the target value matrix Dy(M*M) to the same scale, and then adding them to obtain a new distance matrix that takes into account both the characteristic distance of the original spectral data and the target value distance; S305, establish a loop to gradually select samples of the training set; first select the two original spectral data with the largest distance in the distance matrix as the initial samples of the training set, and then select the unselected original spectral data with the largest distance to the selected samples as the subsequent training set samples; and select in a loop until the size of the training set reaches N; S306: The unselected original spectral data is used as a test set.
3. The ginseng age identification and detection method based on laser induced breakdown spectroscopy according to claim 1 is characterized in that: The specific process of step S4 includes: S401, create a FitnessMax class and an Individual class: FitnessMax represents the maximized fitness function, and Individual represents an individual; S402, normalizing the original spectrum data and the corresponding ginseng age data; S403, setting the crossover probability Pc, the mutation probability Pm and the variable selection threshold; S404, registering a function for creating an individual and a function for creating a population; S405, defining an evaluation function and calculating the fitness of the individual; S406, creating a population, setting the iteration number, and performing iteration of the genetic algorithm; S407. After the iteration is completed, select the individual with the best fitness, that is, the individual with the best feature selection.
4. The ginseng age identification and detection method based on laser induced breakdown spectroscopy according to claim 1 is characterized in that: Step S5 includes: processing and modeling the feature selection data respectively through four algorithms: logistic regression LR, support vector machine SVM, random forest RF and multi-layer perceptron MLP.
5. The ginseng age identification and detection method based on laser induced breakdown spectroscopy according to claim 1 is characterized in that: Establishing an integrated classification model based on voting method in step S6 includes: taking the prediction results of each classification algorithm model on different years of ginseng, and taking the average value of the probability that all model prediction results are a certain year category as the standard according to the soft voting method, and the corresponding year category with the highest probability is the final ginseng year prediction result.
6. A ginseng age identification and detection system based on laser induced breakdown spectroscopy, characterized in that: include: The sample module collects ginseng of different ages as samples; The original spectrum data module uses the laser-induced breakdown spectroscopy system to collect spectrum data from different parts of ginseng of different years and establish the original spectrum data of the samples; A data preprocessing module, which divides the raw spectral data into data sets and performs normalization preprocessing; Feature selection module, using genetic algorithm GA to perform feature selection on preprocessed spectral data; The classification algorithm model module uses different classification algorithms to process feature selection data and establish classification algorithm models; The integrated model module establishes an integrated classification model based on the voting method for the life prediction of each classification algorithm model; Prediction module: Through the original spectral data module, data preprocessing module and feature selection module, the feature selection data of the ginseng to be tested is obtained, and input into each single model module to obtain the predicted years respectively; through the integrated classification model based on the voting method of the single model module, the year category with the highest probability is obtained as the final ginseng year prediction result.
7. The ginseng age identification and detection system based on laser induced breakdown spectroscopy according to claim 6 is characterized in that: The data preprocessing module comprises: Initialization unit: initializing the original spectral data, setting M to represent the total number of ginseng samples and N to represent the number of training sets; Standardization unit: taking the ginseng age corresponding to the original spectral data as the variable y for standardization; Matrix setting unit: set the feature matrix D(M*M) to store the Euclidean distance between all original spectral data; set the target value matrix Dy(M*M) to store the label differences between all sample pairs; Distance matrix unit: normalize the feature matrix D(M*M) and the target value matrix Dy(M*M) to the same scale, and then add them together to obtain a new distance matrix that takes into account both the feature distance of the original spectral data and the target value distance; A loop selection unit: establishes a loop to gradually select samples of the training set; firstly, two original spectral data with the largest distance in the distance matrix are selected as initial samples of the training set, and then unselected original spectral data with the largest distance to the selected samples are selected as subsequent training set samples; and the loop selection is performed until the size of the training set reaches N; Test set unit: unselected raw spectral data as the test set.
8. The ginseng age identification and detection system based on laser induced breakdown spectroscopy according to claim 6 is characterized in that: The feature selection module includes: Create unit: Create FitnessMax class and Individual class: FitnessMax represents the maximized fitness function, and Individual represents the individual; Normalization unit: normalize the original spectrum data and the corresponding ginseng age data; Setting unit: setting the crossover probability Pc, mutation probability Pm and variable selection threshold; Registration unit: registers the function of creating individuals and the function of creating populations; Evaluation function unit: defines the evaluation function and calculates the fitness of the individual; Iteration unit: creates a population, sets the iteration number, and iterates the genetic algorithm; Selection unit: After the iteration is completed, select the individual with the best fitness, that is, the individual with the best feature selection.
9. The ginseng age identification and detection system based on laser induced breakdown spectroscopy according to claim 6, characterized in that: The classification algorithm model module includes: processing and modeling the feature selection data respectively through four algorithms: logistic regression LR, support vector machine SVM, random forest RF and multi-layer perceptron MLP.
10. The ginseng age identification and detection system based on laser induced breakdown spectroscopy according to claim 6, characterized in that: The integrated model module includes: taking the prediction results of each classification algorithm model on different years of ginseng, and taking the average value of the probability that all model prediction results are a certain age category as the standard according to the soft voting method, and the age category corresponding to the highest probability is the final ginseng age prediction result.
Citation Information
Cited By
Natural medicine year identification method based on simulated annealing algorithm
CN120412805A
Method for improving prediction precision of plant phenotype classification model based on hyperspectral detection
CN121392443A
Ginseng age lossless classification model construction method and ginseng age lossless classification system
CN121982414A
A ginseng age nondestructive classification model construction method and a ginseng age nondestructive classification system
CN121982414B