Ginseng year identification method

Through spectral scanning technology combined with local search heuristic cross-model based on genetic algorithms, the ginseng samples were diagnosed without loss, which solved the problems of the existing methods being subjective, requiring samples to be damaged, cumbersome and low accuracy, and achieved efficient and accurate identification of ginseng years.

CN119785344APending Publication Date: 2025-04-08CHANGCHUN UNIV OF SCI & TECH +1

Patent Information

Application Number
CN202510265030.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The existing ginseng identification method has the problems of strong subjectivity, need to destroy samples, cumbersome and low accuracy. Especially the spectral technology is disturbed by ambient light and noise, and the data processing is complex and time-consuming.

Method used

Spectral scanning technology is used to obtain the spectral data of ginseng samples, and by constructing a local search heuristic cross-section model based on genetic algorithm, the spectral data is extracted and optimized to achieve lossless identification of ginseng years.

Benefits of technology

Non-destructive testing is realized, sample integrity is protected, identification accuracy and efficiency is improved, ginseng samples from different years are effectively distinguished, and it is suitable for large-scale and efficient testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119785344A_ABST
    Figure CN119785344A_ABST
Patent Text Reader

Abstract

A ginseng year identification method relates to the technical field of traditional Chinese medicinal material identification. The problems that an existing chemical or biological analysis method needs to damage a sample and is tedious, the nondestructive testing requirement cannot be met, and the accuracy rate cannot be guaranteed when a spectrum technology is adopted for detection and identification are solved. The method comprises the following steps: step 1, carrying out spectrum scanning on ginseng samples to obtain spectrum data of the ginseng samples in different years; 2, extracting the spectral data, and establishing a spectral data set; 3, constructing a local search heuristic cross model based on a genetic algorithm according to the spectral data set; and 4, performing ginseng year identification according to the local search heuristic cross model. According to the method, the limitation in the traditional method is overcome, higher identification precision and stronger analysis capability are brought, and the method is applied to the field of ginseng year identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of Chinese medicinal material identification, and in particular to a method for identifying the age of ginseng. Background Art

[0002] Ginseng is a traditional precious Chinese medicinal material, and age is an important factor in judging its quality. Traditional identification methods have many shortcomings, such as the identification methods that rely on experience are highly subjective, and the methods based on chemical or biological analysis require the destruction of samples and are cumbersome, which cannot meet the needs of non-destructive testing.

[0003] VIS-NIR spectroscopy can identify different samples by analyzing the sample spectral data, and it is feasible to identify the year of ginseng. However, if the data is collected only through spectroscopy technology, the collected spectral data will be interfered by various factors such as ambient light and instrument noise. At the same time, the spectral band contains a lot of information, but not all bands contribute significantly to the identification of ginseng years, which affects the accuracy of identification. In addition, due to the complex steps of spectral data collection and processing, each step requires the calculation of a large amount of spectral data, which consumes a lot of time. Summary of the invention

[0004] The present invention aims at the problem that the existing chemical or biological analysis methods need to destroy samples and are cumbersome, cannot meet the needs of non-destructive testing, and the accuracy of detection and identification using spectral technology cannot be guaranteed. A method for identifying the year of ginseng is proposed, and the method comprises: Step 1: Perform spectral scanning on ginseng samples to obtain spectral data of ginseng samples from different years; Step 2: Extract spectral data and establish spectral data set; Step 3: Construct a local search heuristic crossover model based on genetic algorithm according to the spectral dataset; Step 4: Identify ginseng vintage based on the local search heuristic crossover model.

[0005] Furthermore, a preferred method is proposed, wherein step 1 comprises: using a hyperspectral camera to perform spectral scanning on the ginseng sample to obtain spectral data within the range of 400-1000nm.

[0006] Furthermore, a preferred embodiment is proposed, wherein step 2 further comprises preprocessing the extracted spectral data: Calculate the average value of all spectral data to obtain the ideal spectrum; Univariate linear regression analysis was performed on the sample spectra and compared with the mean spectrum to determine the baseline correction parameters and bias values ​​for each sample by the least squares method; The spectrum is corrected by subtracting the baseline shift from the sample spectrum and dividing the resultant amount by the offset to obtain a corrected spectrum; The spectral data after multiplicative scattering correction were linearly normalized.

[0007] Furthermore, a preferred method is proposed, wherein step 3 comprises: Set the initial population size, chromosome length, number of iterations, selection rate, crossover rate, and mutation rate; Each bit of each chromosome is represented using binary coding; Calculate the fitness value of each chromosome; Calculate the sum of the squares of the Euclidean distance between each sample and the mean vector; The fitness function is calculated based on the sum of the squares of the Euclidean distances between each sample and the mean vector; In each generation, individuals are ranked from high to low according to their fitness values, and the top-ranked individuals are selected as parents for crossover operations according to the set selection rate; After the basic crossover operation, local search optimization is performed on the new individuals generated by the crossover, and a mutation operation is performed after the crossover; At the end of each generation, new offspring are generated based on selection, crossover, and mutation operations, and the new offspring replace the original population. The iterative operation is repeated until the specified number of iterations is reached, completing the construction of the local search heuristic crossover model of the genetic algorithm.

[0008] Furthermore, a preferred method is proposed, wherein the calculation of the sum of squares of the Euclidean distances between each sample and the mean vector comprises:

[0009] in, For sample i In the feature set S The eigenvalues ​​of is the mean vector of all samples under the feature set S, and n represents the number of spectral channels of the sample.

[0010] Furthermore, a preferred method is proposed, in which local search optimization is performed on new individuals generated by crossover, including: performing gene exchange on the parent individuals selected for crossover, obtaining new individuals generated by the gene exchange, and performing local search optimization on gene fragments near the crossover area of ​​the new individuals according to the guidance of the fitness function.

[0011] Furthermore, a preferred method is proposed, in which the selection rate is set to 0.4, the crossover rate is set to 0.7, and the mutation rate is set to 0.1.

[0012] Based on the same inventive concept, the present invention also proposes a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor runs the computer program stored in the memory, the processor executes a ginseng year identification method described in any one of the above items.

[0013] Based on the same inventive concept, the present invention also proposes a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a ginseng year identification method as described in any one of the above are executed.

[0014] The present invention is beneficial in that: Existing chemical or biological analysis methods often require the destruction of samples, which is not applicable in some cases, especially for the analysis of precious or rare samples. The ginseng year identification method proposed in the present invention adopts spectral scanning technology for detection, which can obtain the characteristic information of ginseng without destroying the sample. This non-destructive detection method protects the integrity of the sample and is suitable for large-scale and efficient detection.

[0015] The identification method based on traditional spectral technology is affected by factors such as noise and data complexity, resulting in low identification accuracy. The ginseng year identification method proposed in the present invention can automatically optimize the feature extraction process of spectral data by constructing a local search heuristic crossover model based on a genetic algorithm. The probability of misidentification is reduced by designing a local search heuristic crossover model based on a genetic algorithm. The model can effectively distinguish ginseng samples of different years, thereby improving the accuracy of identification.

[0016] Traditional spectral data processing methods lack effective feature extraction and analysis methods, and are easily disturbed by problems such as high data dimension and high noise. In the ginseng year identification method proposed in the present invention, spectral data extraction and construction of spectral data sets are used to fully process ginseng samples of different years. Combined with the optimization of genetic algorithms, key spectral features related to the year can be better extracted, data noise and redundant information can be reduced, and the robustness and generalization ability of the model in practical applications can be improved. Furthermore, the use of genetic algorithms combined with heuristic crossover models can effectively analyze and optimize a large amount of spectral data in a relatively short period of time. This method has a high degree of automation, can speed up the detection process, and can process large-scale sample data, improve analysis efficiency, and is particularly suitable for large-scale production detection.

[0017] Furthermore, the existing traditional spectral identification methods are optimized for specific samples or conditions, and lack adaptability to different conditions and samples. The ginseng year identification method proposed in the present invention has strong adaptability and flexibility through a local search heuristic crossover model based on a genetic algorithm. The genetic algorithm can adaptively adjust parameters during the search process, so that it can process ginseng samples of different types and years, avoid overfitting problems, and can cope with diverse sample characteristics.

[0018] Furthermore, traditional spectral analysis technology is usually limited to simple pattern recognition and is difficult to effectively deal with complex sample differentiation. The innovative point of the ginseng year identification method proposed in the present invention is that it combines the deep integration of spectral scanning and genetic algorithm, realizes efficient optimization of spectral data through heuristic crossover model, and improves the application performance of spectral technology in complex tasks. This innovative approach effectively overcomes the limitations of traditional methods and brings higher recognition accuracy and stronger analysis capabilities.

[0019] The present invention is applied to the field of ginseng year identification. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A flow chart of a method for identifying the age of ginseng according to implementation mode 1; Figure 2 The eight-year ginseng spectrum extraction area described in Implementation 11; Figure 3 The 10-year ginseng spectrum extraction area described in Implementation 11; Figure 4 The fifteen-year ginseng spectrum extraction area described in the eleventh embodiment Figure 5 The 20-year ginseng spectrum extraction area described in Implementation 11; Figure 6 The 24-year ginseng spectrum extraction area described in Implementation 11; Figure 7 Schematic diagram of visualization of two-dimensional feature data according to the eleventh embodiment, wherein PC1 and PC2 respectively represent principal component 1 and principal component 2 of spectral information obtained after PCA principal component analysis; Figure 8 This is the three-dimensional feature data visualization described in implementation mode eleven, wherein PC1, PC2 and PC3 respectively represent principal component 1, principal component 2 and principal component 3 of the spectral information obtained after PCA principal component analysis. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0022] Implementation method 1, see Figure 1 The present embodiment is described as follows. The present embodiment describes a method for identifying the age of ginseng, the method comprising: Step 1: Perform spectral scanning on ginseng samples to obtain spectral data of ginseng samples from different years; Step 2: Extract spectral data and establish spectral data set; Step 3: Construct a local search heuristic crossover model based on genetic algorithm according to the spectral dataset; Step 4: Identify ginseng vintage according to the local search heuristic crossover model based on genetic algorithm.

[0023] Existing chemical or biological analysis methods often require the destruction of samples, which is not applicable in some cases, especially for the analysis of precious or rare samples. This embodiment uses spectral scanning technology for detection, which can obtain the characteristic information of ginseng without destroying the sample. This non-destructive detection method protects the integrity of the sample and is suitable for large-scale and efficient detection.

[0024] The identification method based on traditional spectroscopy technology is affected by factors such as noise and data complexity, resulting in low identification accuracy. In this embodiment, by constructing a local search heuristic crossover model based on a genetic algorithm, the feature extraction process of spectral data can be automatically optimized. By designing a local search heuristic crossover model based on a genetic algorithm, the probability of misidentification is reduced. The model can effectively distinguish ginseng samples of different years, thereby improving the accuracy of identification.

[0025] Traditional spectral data processing methods lack effective feature extraction and analysis methods, and are easily disturbed by problems such as high data dimension and much noise. This embodiment extracts spectral data in step 2 and constructs spectral data sets to fully process data for ginseng samples of different years. Combined with the optimization of genetic algorithms, key spectral features related to years can be better extracted, data noise and redundant information can be reduced, and the robustness and generalization ability of the model in practical applications can be improved. Further, a large amount of spectral data can be effectively analyzed and optimized in a relatively short time by using genetic algorithms combined with heuristic crossover models. This method has a high degree of automation, can speed up the detection process, and can process large-scale sample data, improves analysis efficiency, and is particularly suitable for large-scale production detection.

[0026] Furthermore, the existing traditional spectral identification method is optimized for specific samples or conditions, and lacks adaptability to different conditions and samples. The method proposed in this embodiment has strong adaptability and flexibility through a local search heuristic crossover model based on a genetic algorithm. The genetic algorithm can adaptively adjust parameters during the search process, so that it can process ginseng samples of different types and years, avoid overfitting problems, and can cope with diverse sample characteristics.

[0027] Furthermore, traditional spectral analysis technology is usually limited to simple pattern recognition and is difficult to effectively deal with complex sample differentiation. The innovative point of the method proposed in this embodiment is that it combines the deep integration of spectral scanning and genetic algorithm, realizes efficient optimization of spectral data through heuristic crossover model, and improves the application performance of spectral technology in complex tasks. This innovative approach effectively overcomes the limitations of traditional methods and brings higher recognition accuracy and stronger analysis capabilities.

[0028] Implementation method 2: This implementation method further limits the ginseng year identification method described in implementation method 1, and step 1 includes: using a hyperspectral camera to perform spectral scanning on the ginseng sample to obtain spectral data within the range of 400-1000nm.

[0029] In this embodiment, hyperspectral imaging technology is used to collect spectral data at multiple wavelengths, so that more information can be captured on the details of different wavelengths. Compared with traditional naked eye observation or single wavelength spectral analysis, hyperspectral cameras can provide richer spectral information to help accurately identify the different years of ginseng and its quality differences. By analyzing the data in the 400-1000nm band, the physical and chemical characteristics of ginseng at different ages can be carefully distinguished, such as changes in water content and active ingredients, which are directly related to the year and growth environment of ginseng.

[0030] At the same time, spectral scanning using a hyperspectral camera is a non-destructive process, that is, no cutting or chemical treatment of the sample is required. This means that accurate data can be obtained without damaging the ginseng sample, thereby preserving the integrity of the sample and even performing measurements and analyses multiple times. This is a very important advantage for high-value ginseng.

[0031] Embodiment 3: This embodiment further limits the ginseng year identification method described in embodiment 1, and step 2 further includes preprocessing the extracted spectral data: Calculate the average value of all spectral data to obtain the ideal spectrum; Univariate linear regression analysis was performed on the sample spectra and compared with the mean spectrum to determine the baseline correction parameters and bias values ​​for each sample by the least squares method; The spectrum is corrected by subtracting the baseline shift from the sample spectrum and dividing the resultant amount by the offset to obtain a corrected spectrum; The spectral data after multiplicative scattering correction were linearly normalized.

[0032] In this embodiment, the ideal spectrum is obtained by calculating the average value of all spectral data, which can provide a stable benchmark for subsequent correction and analysis. This helps to eliminate the accidental fluctuations that may exist in a single sample, reduce experimental errors, and thus improve the reliability and consistency of the overall data. Univariate linear regression analysis and least squares method are used to perform baseline correction and determine the deviation value, which can effectively eliminate systematic errors and noise in spectral data. This method can accurately capture subtle changes in the spectrum and ensure that baseline changes during the analysis process are accurately corrected, thereby improving the accuracy and stability of the data.

[0033] Correcting the spectrum by subtracting the baseline shift and dividing it by the offset can further eliminate the possible offset and nonlinear deformation in the spectrum, ensuring that the final spectrum is closer to the ideal state. This process helps to improve the consistency between the sample spectrum and the ideal spectrum, making the subsequent analysis results more reliable. Multivariate scattering correction (MSC) can effectively eliminate scattering interference caused by factors such as sample surface structure, particle size or moisture. MSC corrects the spectrum, which helps to eliminate the light scattering effect in the sample spectrum, making the spectral data closer to the true characteristics of the substance, and improving the comparability and accuracy of the data. Linear normalization processing scales and converts the spectral data that has undergone multivariate scattering correction at a certain ratio to ensure that the spectra of different samples are compared on the same scale. This helps to reduce the spectral intensity fluctuations caused by differences between samples, improves the comparability of the data, and thus improves the accuracy of ginseng year identification.

[0034] Embodiment 4: This embodiment further limits the ginseng year identification method described in embodiment 1, and step 3 comprises: Set the initial population size, chromosome length, number of iterations, selection rate, crossover rate, and mutation rate; Each bit of each chromosome is represented using binary coding; Calculate the fitness value of each chromosome; Calculate the sum of the squares of the Euclidean distance between each sample and the mean vector; The fitness function is calculated based on the sum of the squares of the Euclidean distances between each sample and the mean vector; In each generation, individuals are ranked from high to low according to their fitness values, and the top-ranked individuals are selected as the parent crossover operation according to the set selection rate; After the basic crossover operation, local search optimization is performed on the new individuals generated by the crossover, and a mutation operation is performed after the crossover; At the end of each generation, new offspring are generated based on selection, crossover, and mutation operations, and the new offspring replace the original population. The iterative operation is repeated until the specified number of iterations is reached, completing the construction of the local search heuristic crossover model of the genetic algorithm.

[0035] The genetic algorithm used in this embodiment is an optimization method that simulates the natural selection process. Through selection, crossover and mutation operations, multiple potential solutions can be explored in a wide search space. This global search capability helps the method avoid falling into a local optimal solution, thereby improving the accuracy of ginseng year identification. After the crossover operation, a local search optimization strategy is adopted, which enables the algorithm to further refine and optimize the quality of the solution after finding a possible good solution, thereby improving the accuracy and robustness of the model. The fitness function is constructed by calculating the sum of squares of the Euclidean distance between the sample and the mean vector. The fitness function can effectively quantify the differences between samples and help the genetic algorithm select the most suitable individuals in each generation, thereby ensuring the accuracy of the identification results. By setting appropriate selection rate, crossover rate and mutation rate, the algorithm can balance the contradiction between exploring new solutions and utilizing current excellent solutions. The selection rate ensures that excellent individuals can be selected, the crossover rate generates new possible solutions through the "genetic" process, and the mutation rate provides enough diversity to prevent the diversity of solutions from being lost. Through the local search after mutation operation and crossover, the diversity of the population can be increased to prevent the algorithm from converging to the local optimal solution too early. This mechanism enables the population to explore different areas of the solution space in each generation, thereby increasing the possibility of the algorithm finding the global optimal solution. The introduction of mutation operations increases the diversity of individual genes, giving the search process better exploration capabilities. Since each chromosome bit is represented by binary coding, data processing becomes concise and efficient. Through repeated iterative processes, the model can be gradually optimized to ensure that the optimal solution can be gradually approached in several generations.

[0036] The model proposed in this embodiment uses the heuristic search of genetic algorithms, so it has strong robustness in the face of uncertainty, noise or complex patterns. Even if the data set contains a certain amount of noise or potential relationships that are not fully understood, the genetic algorithm can continuously adjust the model parameters through multiple iterations, thereby steadily improving the identification results.

[0037] In practical applications, for a given data set, the fitness value of the sample is first calculated, which can usually be determined based on the specific objective function of the ginseng year identification task. Then the genetic algorithm is initialized to generate a set of initial populations, in which each individual represents a possible combination of variables. Then the selection operation phase is entered to select individuals with higher fitness from the current population. Next is the crossover operation. In the process of partially exchanging genes of the selected individuals to generate new individuals, local search heuristic crossover is adopted. That is, after completing the basic gene exchange, local search optimization is performed near the crossover area for the newly generated individuals to improve the quality of the new individuals. Then the mutation operation is performed to randomly change some genes of some individuals to increase the diversity of the population. In the whole process, the fitness effect of individuals on ginseng year identification is continuously evaluated. After multiple generations of evolution, an individual with higher fitness is finally obtained, that is, a subset of variables that make an important contribution to the target variable. Finally, the data is projected into the subspace composed of the selected variables to obtain a reduced-dimensional data set, thereby realizing effective identification of ginseng years.

[0038] Embodiment 5: This embodiment further limits the ginseng year identification method described in Embodiment 4, wherein the calculation of the sum of squares of the Euclidean distances between each sample and the mean vector includes:

[0039] in, For sample i In the feature set S The eigenvalues ​​of is the mean vector of all samples under the feature set S, and n represents the number of spectral channels of the sample.

[0040] Implementation method six. This implementation method is a further limitation of the ginseng year identification method described in implementation method four, wherein local search optimization is performed on new individuals generated by crossover, including: performing gene exchange on the parent individuals selected for crossover, obtaining new individuals generated by the gene exchange, and performing local search optimization on gene fragments near the crossover region of the new individuals according to the guidance of the fitness function.

[0041] Crossover is a common method for generating new individuals in genetic algorithms, but sometimes simple gene exchange may result in the fitness of new individuals not being optimal, or not fully meeting the local optimal solution in the solution space. Local search optimization can improve the fitness of new individuals by further optimizing gene fragments near the crossover area, making them better adapted to the target task (such as identification of ginseng year). When performing local search on new individuals after crossover, the fitness function plays a guiding role, guiding the search to a better direction and avoiding falling into the local optimum. Local search can optimize specific areas of new individuals generated by crossover, avoiding indiscriminate search of the entire solution space, thus reducing the amount of calculation and improving the speed and efficiency of optimization.

[0042] In the specific task of identifying ginseng years, local search optimization can optimize the identification of ginseng of different years based on the slight adjustments in the gene fragments of the new individuals after gene crossover. Especially between years where some features may be similar, local search can help refine the features, ensure that the classifier accurately distinguishes the years, and improve the accuracy of identification.

[0043] Through local search optimization, gene mutations or unfit individuals caused by crossover can be reduced, thereby improving the stability of the entire genetic algorithm process. Local search allows new individuals to gradually improve under the constraints of the fitness function, avoiding the emergence of extremely unfit individuals in each generation and increasing the convergence and stability of the algorithm.

[0044] Implementation method seven: This implementation method further limits the ginseng year identification method described in implementation method four, wherein the selection rate is set to 0.4, the crossover rate is set to 0.7, and the mutation rate is set to 0.1.

[0045] In this implementation, the selection rate represents the proportion of individuals selected from the current population to enter the next generation. A selection rate of 0.4 means that 40% of the individuals are selected to generate the next generation. This setting ensures that the algorithm retains a certain proportion of high-quality individuals while avoiding over-reliance on the best individuals, reducing the risk of the algorithm falling into a local optimal solution. A moderate selection rate helps balance the process of exploration and development, maintaining the diversity of the population while retaining excellent solutions.

[0046] The crossover rate is set to 0.7, which means that 70% of the individuals will perform crossover operations, that is, most individuals will produce offspring. This helps to combine high-quality genes into the next generation, thereby improving the breadth and efficiency of the search. The crossover operation can promote the expansion of the population in the solution space and prevent the algorithm from falling into a local optimum.

[0047] Setting the mutation rate to 0.1 means that each individual has a 10% chance of mutation. This low mutation rate can prevent individuals in the population from changing too drastically, thereby avoiding excessive disturbance of existing excellent solutions. Mutation operations can help the algorithm escape from the local optimum and explore a wider solution space.

[0048] Embodiment 8: A computer device described in this embodiment includes a memory and a processor, wherein the memory stores a computer program. When the processor runs the computer program stored in the memory, the processor executes a ginseng year identification method described in any one of embodiments 1 to 7.

[0049] Embodiment 9: A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of a ginseng year identification method as described in any one of embodiments 1 to 7 are executed.

[0050] Implementation Method 10: See Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 6 , Figure 7 and Figure 8 This embodiment provides a specific example of the ginseng year identification method described in the first embodiment, and is also used to explain the second to seventh embodiments, specifically: In this embodiment, wild ginseng is used as the ginseng sample, and the years are divided into 8 years, 10 years, 15 years, 20 years, and 24 years. There are 5 samples in each year, for a total of 25 samples.

[0051] In this embodiment, the FS-23 portable imaging hyperspectral camera is used to perform spectral scanning on the ginseng sample, and the camera is operated according to the operating manual to ensure that accurate spectral data is collected. The camera is powered by a built-in battery, and the spectroscopic method is transmission grating spectroscopic, which can collect spectral data in the range of 400-1000nm, with a wavelength resolution better than 2.5nm, and has 1200 spectral channels.

[0052] The spectral data corresponding to 600 wavelengths were extracted, 5 groups were extracted from each ginseng plant, 25 groups were extracted from 5 plants in each year, and 125 groups were extracted from all years.

[0053] The average value of 125 sets of spectral data was calculated to obtain the ideal spectrum; Perform univariate linear regression analysis on the sample spectra, take a certain set of spectral data as an example, compare it with the average spectrum, and determine the baseline correction parameters and deviation values ​​of each sample by the least squares method; The spectral data is corrected by subtracting the baseline shift from the sample spectrum and dividing the resultant amount by the offset to obtain a corrected spectrum; Linear normalization is performed on the spectral data after multivariate scattering correction to scale the data proportionally to a certain range, improve the algorithm performance, speed up the convergence speed, prevent numerical problems, improve the generalization ability of the model, meet the input requirements of the model, and make the features comparable.

[0054] In this implementation, a local search heuristic crossover model based on a genetic algorithm is designed, specifically: For a data set containing 125 samples and 600 features, a genetic algorithm is used for processing. First, the parameters are set, the population size is set to 50, the length of each chromosome is 600, represented in binary form, each bit corresponds to a feature (1 means the feature is selected, 0 means it is not selected), and the number of iterations is set to 100.

[0055] Next, the fitness function is designed. For a feature set S represented by a chromosome, the mean vector of all samples under the feature set is calculated. , and then calculate the sum of the squares of the Euclidean distance between each sample and the mean vector , the fitness function is , the smaller the sum of squared distances is, the higher the individual fitness is.

[0056] The selection rate is set to 0.4, which means that the first 40% individuals with higher fitness are selected from the current population as parents for crossover operations. The crossover rate is set to 0.7, which means that 70% of the parent individuals have the opportunity to cross over and produce offspring. The mutation rate is set to 0.1, which means that each bit of each individual has a 10% probability of mutation.

[0057] After the selection operation, a crossover operation is performed, using local search heuristic crossover. Genes are exchanged for the parent individuals selected for crossover, and new individuals generated by gene exchange are obtained. Local search optimization is performed based on the guidance of the fitness function for gene fragments near the crossover region of the new individuals. For example, the effect of local gene changes on the sample mean vector and the sum of squared Euclidean distances under the feature set S is checked, and the gene value (0 or 1) is tried to be adjusted to improve the individual fitness.

[0058] By repeatedly selecting, this local search heuristic crossover and mutation operation until 100 iterations are reached, the feature set corresponding to the individual with the highest fitness is finally output, and the data set is projected into the subspace composed of these selected features to achieve the dimensionality reduction effect.

[0059] In order to verify the effect of the method proposed in this embodiment, the present application is compared with the existing identification method based on manual identification, chemical analysis method, and VIS-NIR spectroscopy technology: Traditional empirical identification method: Several experienced identification personnel conducted year identification on the same 100 ginseng samples. The results showed that the accuracy rate was only between 50% and 60%, and the accuracy rates varied greatly among different identification personnel, with a standard deviation of about 10%.

[0060] Chemical analysis method (taking liquid chromatography as an example): 100 ginseng samples were selected and the year was identified by liquid chromatography. Due to the errors in sample pretreatment and component analysis, as well as the complexity of the relationship between chemical composition and year, the accuracy rate is about 65%-75%, and the average time required to analyze a single sample is about 3-5 hours.

[0061] The existing identification method based on VIS-NIR spectroscopy technology (identification using partial least squares regression model) was experimented on 100 ginseng samples. The accuracy of this method was between 70% and 80%. The model training time was long. For larger data sets (such as more than 200 samples), the training time exceeded 1 hour.

[0062] The method proposed in this embodiment was tested using 100 ginseng samples (the same samples as the traditional empirical identification method). After multiple experimental verifications, the accuracy of the method of this application can reach 85%-95%. In terms of model training, for a data set of 125 samples, the training time is about 20-30 minutes.

[0063] In this implementation, stability analysis is also performed for the following methods: Traditional empirical identification method: Each identification personnel conducted three repeated identifications on the above 100 ginseng samples. The standard deviation of the multiple measurement results of different identification personnel was about 15% on average, indicating that its stability was poor.

[0064] Chemical analysis method (taking liquid chromatography as an example): 100 ginseng samples were measured three times. Due to slight differences in the operation process and factors such as instrument stability, the standard deviation of the results was about 8%-12%.

[0065] Existing identification method based on VIS-NIR spectroscopy technology (identification using partial least squares regression model): 80 ginseng samples were tested three times with a standard deviation between 5% and 8%.

[0066] The method proposed in this embodiment also carried out three repeated experiments on 100 ginseng samples, and the standard deviation could be controlled within 3%, showing high stability.

[0067] This implementation also compares the costs of these methods: Traditional empirical identification method: The main cost is the labor cost of the identification personnel. Each identification takes a long time and the accuracy is difficult to guarantee. In the long run, the labor cost is high.

[0068] Chemical analysis method (taking liquid chromatography as an example): the equipment procurement cost is high (the price of liquid chromatographs usually ranges from tens of thousands to hundreds of thousands of yuan), sample pretreatment requires a large amount of chemical reagents, the detection cost of a single sample is around several hundred yuan, and the equipment maintenance cost is also high.

[0069] Existing identification methods based on VIS-NIR spectroscopy technology (identification using partial least squares regression model): The price of spectral acquisition equipment is relatively low compared to chemical analysis equipment, but due to its lack of accuracy and stability, it may be necessary to repeat measurements multiple times or use other auxiliary means to improve the credibility of the identification results, which increases hidden costs.

[0070] The method proposed in this embodiment: the imaging hyperspectral camera used is moderately priced (such as the FS-23 portable imaging hyperspectral camera), and the method has high accuracy and good stability, reducing repeated measurements and other auxiliary costs. The sample pretreatment and detection process is relatively simple, and the cost of a single sample detection can be controlled at a low level (about tens of yuan), while saving a lot of time costs.

[0071] It should be understood by those skilled in the art that the embodiments of the present disclosure may be provided as methods, systems or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram and the combination of processes and / or blocks in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes. These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure rather than to limit its protection scope. Although the present disclosure has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that after reading the present disclosure, those skilled in the art can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the invention, but these changes, modifications or equivalent substitutions are all within the protection scope of the disclosed claims to be approved.

Claims

1. A method for identifying the age of ginseng, characterized in that: The method comprises: Step 1: Perform spectral scanning on ginseng samples to obtain spectral data of ginseng samples from different years; Step 2: Extract spectral data and establish spectral data set; Step 3: Construct a local search heuristic crossover model based on genetic algorithm according to the spectral dataset; Step 4: Identify ginseng vintage according to the local search heuristic crossover model based on genetic algorithm.

2. The method for identifying the age of ginseng according to claim 1, characterized in that: The step 1 comprises: using a hyperspectral camera to perform spectral scanning on the ginseng sample to obtain spectral data within the range of 400-1000nm.

3. The method for identifying the age of ginseng according to claim 1, characterized in that: The step 2 also includes preprocessing the extracted spectral data: Calculate the average value of all spectral data to obtain the ideal spectrum; Univariate linear regression analysis was performed on the sample spectra and compared with the mean spectrum to determine the baseline correction parameters and bias values ​​for each sample by the least squares method; The spectrum is corrected by subtracting the baseline shift from the sample spectrum and dividing the resultant amount by the offset to obtain a corrected spectrum; The spectral data after multiplicative scattering correction were linearly normalized.

4. The method for identifying the age of ginseng according to claim 1, characterized in that: The step 3 comprises: Set the initial population size, chromosome length, number of iterations, selection rate, crossover rate, and mutation rate; Each bit of each chromosome is represented using binary coding; Calculate the fitness value of each chromosome; Calculate the sum of the squares of the Euclidean distance between each sample and the mean vector; The fitness function is calculated based on the sum of the squares of the Euclidean distances between each sample and the mean vector; In each generation, individuals are ranked from high to low according to their fitness values, and the top-ranked individuals are selected as parents for crossover operations according to the set selection rate; After the basic crossover operation, local search optimization is performed on the new individuals generated by the crossover, and a mutation operation is performed after the crossover; At the end of each generation, new offspring are generated based on selection, crossover, and mutation operations, and the new offspring replace the original population. The iterative operation is repeated until the specified number of iterations is reached, completing the construction of the local search heuristic crossover model of the genetic algorithm.

5. The method for identifying the age of ginseng according to claim 4, characterized in that: The calculation of the sum of squares of the Euclidean distances between each sample and the mean vector includes: in, For sample i In the feature set S The eigenvalues ​​of is the mean vector of all samples under the feature set S, and n represents the number of spectral channels of the sample.

6. The method for identifying the age of ginseng according to claim 4, characterized in that: The local search optimization for the new individuals generated by the crossover includes: performing gene exchange on the parent individuals selected for the crossover, obtaining the new individuals generated by the gene exchange, and performing local search optimization on the gene fragments near the crossover area of ​​the new individuals according to the guidance of the fitness function.

7. The method for identifying the age of ginseng according to claim 4, characterized in that: The selection rate is set to 0.4, the crossover rate is set to 0.7, and the mutation rate is set to 0.

1.

8. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the processor runs the computer program stored in the memory, the processor executes a ginseng year identification method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of a ginseng year identification method as described in any one of claims 1-7 are executed.

Citation Information

Patent Citations

  • Biological age step-by-step predication method based on support vector machine

    CN104966106A

  • Year identification system and year identification method of wine spectrum kurtosis regression mode

    CN113158935A

  • Hyperspectral identification method and system for aging years of citrus chachiensis hortorum

    CN115909324A

Cited By

  • Medicinal material year identification method and system based on machine vision

    CN120411095A

  • A method and system for identifying the age of medicinal materials based on machine vision

    CN120411095B