Hyperspectral imaging-based ginsenoside content detection method and device

Through hyperspectral imaging technology and grid-based section division, the detection error problem caused by the complexity and unevenness of sample processing in traditional methods is solved, and the lossless and accurate detection of ginseng saponin content is achieved.

CN120446013APending Publication Date: 2025-08-08泰州学院
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510477533.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

The existing detection methods for ginseng saponin content rely on traditional chemical analysis, which has the problem of complex sample processing, time-consuming and susceptible to sample inhomogeneity, resulting in inaccurate measurement results.

Method used

Using hyperspectral imaging technology, samples were divided by grid sections, combined with characteristic band analysis and outlier value removal, a saponin content prediction model was constructed to obtain the saponin content in each small area, and ensure data accuracy and stability.

Benefits of technology

It realizes lossless and accurate saponin content detection, avoids sample damage and measurement errors, and improves the efficiency and reliability of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120446013A_ABST
    Figure CN120446013A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a device for detecting the content of ginsenoside based on hyperspectral imaging. The method comprises the following steps: acquiring hyperspectral image data of a sample; performing spectral correction on the original hyperspectral image to obtain spectral data of the effective region of the sample; obtaining a characteristic wave band combination with high correlation with the saponin content; performing spatial texture analysis on the hyperspectral image of the selected characteristic wave band to obtain a saponin characteristic index; performing slice division according to gridding on the basis of the processed hyperspectral image, constructing a saponin content prediction model, and obtaining the content of ginsenoside in each grid image; and based on the ginsenoside content in each grid image, performing data concentration judgment to obtain a final value of the ginsenoside content. The method has the advantages that the saponin content of each small area can be accurately analyzed through gridding slice sample division and characteristic wave band analysis, the overall data deviation is avoided, and the result reliability is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a content detection technology, and in particular to a ginsenoside content detection method and device based on hyperspectral imaging. Background Art

[0002] Ginsenosides are the main active ingredients in ginseng, have multiple biological activities, and are widely used in health products and medicines. In order to ensure the quality and efficacy of ginseng and its products, accurate detection of the content of ginsenosides is crucial. At present, common detection methods mainly include high performance liquid chromatography (HPLC), gas chromatography (GC), ultraviolet-visible spectrophotometry, etc. Among them, high performance liquid chromatography (HPLC) has become the most commonly used method for ginsenoside content detection due to its high sensitivity, good separation effect and simple operation. The detection of ginsenosides not only helps in product quality control, but also provides a scientific basis for clinical research. With the development of science and technology, some new analytical methods, such as ultra-high performance liquid chromatography (UPLC) and mass spectrometry (MS), have also been applied to the detection of ginsenoside content in recent years to improve accuracy and detection efficiency.

[0003] Current methods for detecting ginsenoside content on the market generally rely on traditional chemical analysis techniques, such as high-performance liquid chromatography (HPLC) or ultraviolet spectrophotometry. Although these methods can provide relatively accurate results, they have some obvious limitations. First, these traditional methods usually require complex pre-treatment and separation steps for the samples, which are time-consuming and cumbersome to operate, and may lead to sample loss or contamination. Second, traditional methods often rely on the average value of the entire sample, ignoring the differences in local areas of the sample, and are therefore easily affected by sample heterogeneity, resulting in inaccurate or biased measurement results. Summary of the Invention

[0004] To improve existing methods for detecting ginsenoside content, a method and device for detecting ginsenoside content based on hyperspectral imaging is provided. This method divides the sample into grid-like sections, enabling precise analysis of the saponin content in each small area and avoiding overall data bias. Combined with characteristic band analysis and outlier removal, this method improves data accuracy and prediction stability, ensuring the reliability of the results.

[0005] In order to achieve the above objects, the technical solution adopted by the present invention is:

[0006] A method for detecting ginsenoside content based on hyperspectral imaging, comprising:

[0007] The ginseng samples were crushed into uniform powder and pressed into tablets, and hyperspectral image data of the samples were collected using a hyperspectral imaging system;

[0008] The original hyperspectral image is spectrally corrected through dark current correction and reflectance calibration, and a reference spectrum is obtained by referring to a whiteboard. The spectral data of the effective area of the sample is extracted using an image segmentation algorithm.

[0009] Based on the characteristic absorption peaks of ginsenosides, a continuous projection algorithm was used to screen the characteristic band combination with high correlation with saponin content from the full band;

[0010] Spatial texture analysis was performed on the hyperspectral images of the selected characteristic bands to obtain texture parameters of gray-level co-occurrence matrix energy, contrast, and correlation as saponin characteristic indicators;

[0011] The processed hyperspectral image is divided into slices according to the gridding method, and a saponin content prediction model is constructed based on the characteristic band spectral data and texture parameters of each slice to obtain the ginsenoside content in each grid image;

[0012] Based on the ginsenoside content in each grid image, the data set was judged to be neutral. If the ginsenoside content data in each grid image were not concentrated, the ginseng samples were judged to be unevenly mixed. If the data set was concentrated, the outliers were deleted and the mean was calculated to obtain the final value of the ginsenoside content.

[0013] Preferably, performing spectral correction on the original hyperspectral image by dark current correction and reflectance calibration, obtaining a reference spectrum with reference to a whiteboard, and extracting spectral data of the effective area of the sample by using an image segmentation algorithm specifically include:

[0014] Under completely dark conditions, multiple dark current images are taken using the same sensor parameters, and the average value is taken as the dark current reference image;

[0015] Perform pixel-by-pixel correction on the original hyperspectral image of each band to eliminate sensor dark current noise and environmental thermal noise;

[0016] Under the same light source and integration time, a standard white board is imaged to obtain a white board reference image. The dark current corrected image of each band is then converted to reflectivity to eliminate light source non-uniformity and ambient light interference.

[0017] Based on the processed image data, the near-infrared band grayscale image is extracted, and the optimal threshold is automatically calculated using the Otsu algorithm to generate a binary mask;

[0018] Based on the binary mask, spectral data registration is performed, and outliers are removed to obtain spectral data of the effective area of the sample.

[0019] Preferably, the method of screening characteristic band combinations with high correlation with saponin content from the entire band by a continuous projection algorithm based on the characteristic absorption peaks of ginsenosides specifically includes:

[0020] Through prior screening of characteristic absorption peaks, based on historical experimental data, the characteristic band range of saponins is obtained, and the characteristic band region of saponins is pre-selected from the full band as the candidate band subset, and irrelevant bands are removed;

[0021] Based on the successive projection algorithm, the optimal subset was constructed by iteratively selecting new bands with the minimum collinearity with the selected bands to obtain the characteristic band combination with high correlation with saponin content.

[0022] Preferably, the performing of spatial texture analysis on the hyperspectral image of the selected characteristic band to obtain texture parameters of gray-level co-occurrence matrix energy, contrast, and correlation as saponin characteristic indicators specifically includes:

[0023] Based on the acquired hyperspectral images of characteristic bands with high correlation with saponin content, the parameters of the gray-level co-occurrence matrix were set, including spatial direction and spatial distance;

[0024] For each characteristic band of the grayscale image, the texture parameters of contrast, energy and correlation are calculated respectively;

[0025] For each feature, its spatial direction is averaged and the mean of the four directions is calculated as the final value;

[0026] Four types of texture features are calculated for each characteristic band to form a spectrum + texture fusion feature vector.

[0027] Preferably, the processed hyperspectral image is sliced and divided into grids, and a saponin content prediction model is constructed based on the characteristic band spectral data and texture parameters of each slice. The ginsenoside content in each grid image is obtained specifically including:

[0028] Based on the processed hyperspectral image, it is sliced and divided into grids to obtain a number of gridded hyperspectral images;

[0029] Based on the acquired spectral + texture fusion feature vector, it is input into a deep learning model based on convolutional neural network, and combined with partial least squares regression to construct a quantitative prediction model for ginsenoside content;

[0030] Inputting several gridded hyperspectral images into a quantitative prediction model of ginsenoside content to obtain ginsenoside content data in each image;

[0031] According to the grid coordinates of each image, the predicted values were filled into the content distribution matrix to statistically form a ginsenoside content dataset.

[0032] Preferably, the data neutrality judgment is performed based on the ginsenoside content in each grid image. If the ginsenoside content data in each grid image are not centralized, it is judged that the ginseng sample is unevenly mixed. If the data is centralized, the outliers are deleted and the mean is calculated. Obtaining the final value of the ginsenoside content specifically includes:

[0033] Based on the obtained ginsenoside content data set, key statistics of the data set were calculated, including standard deviation, percentile, and interquartile range;

[0034] Based on the key statistical values obtained by calculation, a concentration threshold is set to determine the concentration of ginsenoside content data;

[0035] If the data are not concentrated, the ginseng sample is not mixed evenly, so crush and stir the ginseng sample again;

[0036] If the data set is judged to be centralized, the abnormal data values in the ginsenoside content data set are detected and deleted;

[0037] Based on the ginsenoside content dataset after removing outliers, the average value was calculated and used as the final value of ginsenoside content. The result was mapped to the hyperspectral image space using pseudo-color imaging technology to generate a ginsenoside content distribution heat map.

[0038] Furthermore, a ginsenoside content detection device based on hyperspectral imaging is proposed, comprising:

[0039] Hyperspectral imaging device: including a hyperspectral camera, a controllable light source, a loading platform and an image acquisition device;

[0040] Dark box calibration module: The dark box calibration module has a built-in electric lifting standard white board and a temperature control module to perform spectral correction on the original hyperspectral image;

[0041] Spectral correction unit: including dark current automatic subtraction algorithm processor and reflectivity real-time calibration chip;

[0042] Spatial texture analysis module: The spatial texture analysis module obtains texture parameters of gray-level co-occurrence matrix energy, contrast, and correlation as saponin characteristic indicators;

[0043] Saponin content prediction model module: The saponin content prediction model module is mainly used to construct a saponin content prediction model;

[0044] Grid division module: The grid division module is mainly used to divide the processed hyperspectral image into several grid images for subsequent saponin content measurement;

[0045] Saponin content calculation module: The saponin content calculation module obtains the final ginsenoside content by performing statistical analysis on the ginsenoside content data in each grid image;

[0046] Quality control terminal: Grid distribution analyzer: including touch screen display of saponin content heat map and automatic marking of outliers;

[0047] Processor: The processor is mainly used for the calculation process of each formula and the construction calculation process of each model.

[0048] Compared with the prior art, the advantages of the present invention are:

[0049] Hyperspectral imaging technology can non-destructively capture rich spectral information from samples, accurately reflecting the distribution of ginseng saponins, while avoiding the sample damage associated with traditional chemical analysis methods. Dark current correction and reflectance calibration ensure high data accuracy and reliability, minimizing interference from external factors. The combination of image segmentation and a continuous projection algorithm enables more precise screening of characteristic bands, effectively improving the correlation between saponin content and spectral data. Spatial texture analysis, using texture parameters such as energy, contrast, and correlation extracted from a gray-level co-occurrence matrix, provides more detailed metrics for saponin content prediction, further enhancing the model's prediction accuracy. Finally, gridded slicing and data neutrality assessment ensure sample uniformity, avoiding measurement errors caused by sample inhomogeneity and resulting in more stable and reliable results. This method, characterized by high efficiency, accuracy, non-destructiveness, and strong operability, represents an innovative solution for ginsenoside content detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A schematic diagram of the method proposed in the present invention;

[0051] Figure 2 This is a schematic diagram of obtaining effective spectral data proposed by the present invention;

[0052] Figure 3 This is a schematic diagram of obtaining the characteristic band combination proposed by the present invention;

[0053] Figure 4 This is a schematic diagram of obtaining characteristic indicators proposed by the present invention;

[0054] Figure 5 This is a schematic diagram of the grid division proposed by the present invention;

[0055] Figure 6 This is a statistical diagram of the ginsenoside content proposed in the present invention;

[0056] Figure 7 This is a diagram of the architecture of the electronic equipment in this solution;

[0057] Figure 8 This is a schematic diagram of the computer-readable storage medium structure in this solution. DETAILED DESCRIPTION

[0058] The following description is intended to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are merely examples, and those skilled in the art may conceive of other obvious variations.

[0059] A ginsenoside content detection device based on hyperspectral imaging, comprising:

[0060] Hyperspectral imaging device: including a hyperspectral camera, a controllable light source, a loading platform and an image acquisition device;

[0061] Dark box calibration module: The dark box calibration module has a built-in electric lifting standard white board and a temperature control module to perform spectral correction on the original hyperspectral image;

[0062] Spectral correction unit: including dark current automatic subtraction algorithm processor and reflectivity real-time calibration chip;

[0063] Spatial texture analysis module: The spatial texture analysis module obtains texture parameters of gray-level co-occurrence matrix energy, contrast, and correlation as saponin characteristic indicators;

[0064] Saponin content prediction model module: The saponin content prediction model module is mainly used to construct a saponin content prediction model;

[0065] Grid division module: The grid division module is mainly used to divide the processed hyperspectral image into several grid images for subsequent saponin content measurement;

[0066] Saponin content calculation module: The saponin content calculation module obtains the final ginsenoside content by performing statistical analysis on the ginsenoside content data in each grid image;

[0067] Quality control terminal: Grid distribution analyzer: including touch screen display of saponin content heat map and automatic marking of outliers;

[0068] Processor: The processor is mainly used for the calculation process of each formula and the construction calculation process of each model.

[0069] See Figure 1 As shown, a method for detecting ginsenoside content based on hyperspectral imaging comprises:

[0070] Step 1: Grind the ginseng sample into a uniform powder and press it into tablets, and use a hyperspectral imaging system to collect hyperspectral image data of the sample;

[0071] Step 2: Perform spectral correction on the original hyperspectral image through dark current correction and reflectance calibration, obtain a reference spectrum with reference to a whiteboard, and use an image segmentation algorithm to extract the spectral data of the effective area of the sample;

[0072] Step 3: Based on the characteristic absorption peaks of ginsenosides, a continuous projection algorithm is used to screen characteristic band combinations with high correlation with saponin content from the full band;

[0073] Step 4: Perform spatial texture analysis on the hyperspectral image of the selected characteristic band to obtain texture parameters of gray-level co-occurrence matrix energy, contrast, and correlation as saponin characteristic indicators;

[0074] Step 5: Divide the processed hyperspectral image into grids and construct a saponin content prediction model based on the characteristic band spectral data and texture parameters of each slice to obtain the ginsenoside content in each grid image;

[0075] Step 6: Based on the ginsenoside content in each grid image, the data set is judged to be neutral. If the ginsenoside content data in each grid image are not concentrated, it is judged that the ginseng sample is unevenly mixed. If the data is concentrated, the outliers are deleted and the mean is calculated to obtain the final value of the ginsenoside content.

[0076] See Figure 2 As shown in the figure, the original hyperspectral image is spectrally corrected by dark current correction and reflectance calibration, and the reference spectrum is obtained by referring to a whiteboard. The image segmentation algorithm is used to extract the spectral data of the effective area of the sample. Specifically, the following steps are performed:

[0077] Under completely dark conditions, multiple dark current images are taken using the same sensor parameters, and the average value is taken as the dark current reference image;

[0078] Perform pixel-by-pixel correction on the original hyperspectral image of each band to eliminate sensor dark current noise and environmental thermal noise;

[0079] Under the same light source and integration time, a standard white board is imaged to obtain a white board reference image. The dark current corrected image of each band is then converted to reflectivity to eliminate light source non-uniformity and ambient light interference.

[0080] Based on the processed image data, the near-infrared band grayscale image is extracted, and the optimal threshold is automatically calculated using the Otsu algorithm to generate a binary mask;

[0081] Based on the binary mask, spectral data registration is performed, and outliers are removed to obtain spectral data of the effective area of the sample.

[0082] Specifically, when collecting dark current images, turn off the light source, cover the lens with a cap or block out light, maintain the same integration time as the sample, and continuously collect 10-20 dark current image frames. The average value is used as the dark current reference image. Invalid data in the edge bands (e.g., below 400nm and above 1000nm) are eliminated, while retaining the characteristic bands of ginsenosides (e.g., 500-900nm).

[0083] When spectral data is registered, the mask M(x,y) is used to filter the valid pixels and extract the spectral data S(x,y) within the valid area. The formula is:

[0084] S(x,y)={I i (x,y)|M(x,y)=1}

[0085] Among them, I i (x,y) is the whiteboard reference image of band i. For outliers, statistical methods (such as standard deviation threshold) can be used to remove them. For example, those outliers whose spectral values are outside the range of ±3×σ of the mean are removed:

[0086] S'(x,y)={S(x,y)|S(x,y)-μ(S(x,y)|≤3σS(x,y))}

[0087] Where μ is the mean and σ is the standard deviation.

[0088] Align the segmentation mask with the hyperspectral cube to ensure one-to-one correspondence of spatial coordinates, and apply the mask to each band image.

[0089] See Figure 3 As shown in the figure, based on the characteristic absorption peaks of ginsenosides, the characteristic band combinations with high correlation with saponin content are screened from the full band through the continuous projection algorithm, including:

[0090] Through prior screening of characteristic absorption peaks, based on historical experimental data, the characteristic band range of saponins is obtained, and the characteristic band region of saponins is pre-selected from the full band as the candidate band subset, and irrelevant bands are removed;

[0091] Based on the successive projection algorithm, the optimal subset was constructed by iteratively selecting new bands with the minimum collinearity with the selected bands to obtain the characteristic band combination with high correlation with saponin content.

[0092] Specifically, according to literature and experimental data, ginsenosides have significant absorption in the following bands: 540-560nm (COC bond vibration absorption), 670-690nm (CH bond stretching vibration absorption), 930-950nm (OH bond second harmonic absorption), and these regions are preferentially pre-selected from the full band as candidate band subsets, for example, 3-5 adjacent bands are taken in each region. The continuous projection algorithm specifically includes the first band selection, iterative projection selection and determination of the optimal number of bands. SPA is repeated 10 times, and the bands with an occurrence frequency of >80% are selected as the final combination. In the iterative projection selection,

[0093] In each iteration, a new band is selected so that the collinearity between the band and the selected band is minimized. The principal components or linear correlations of the selected bands are calculated. For example, the correlation between the bands can be determined by calculating the Pearson correlation coefficient or covariance matrix between the bands. Let X S is the characteristic matrix of the selected band:

[0094] X S =[X1,X2,...,X m ]

[0095] Among them, m is the number of selected bands, X j is the observation data of the jth band.

[0096] Calculate new candidate band λ k Correlation with the selected band. Select the band λ that minimizes the correlation k :

[0097]

[0098] Among them, cor(X k ,X m ) is the new band X k With the selected band X m The correlation is usually calculated using the Pearson correlation coefficient.

[0099] See Figure 4 As shown in the figure, spatial texture analysis is performed on the hyperspectral image of the selected characteristic band to obtain the texture parameters of gray-level co-occurrence matrix energy, contrast, and correlation as saponin characteristic indicators, including:

[0100] Based on the acquired hyperspectral images of characteristic bands with high correlation with saponin content, the parameters of the gray-level co-occurrence matrix were set, including spatial direction and spatial distance;

[0101] For each characteristic band of the grayscale image, the texture parameters of contrast, energy and correlation are calculated respectively;

[0102] For each feature, its spatial direction is averaged and the mean of the four directions is calculated as the final value;

[0103] Four types of texture features are calculated for each characteristic band to form a spectrum + texture fusion feature vector.

[0104] Specifically, for each feature band of the grayscale image I, its grayscale co-occurrence matrix P(d,θ) is calculated, where d is the spatial distance and θ is the spatial direction (0°, 45°, 90°, 135°). The grayscale co-occurrence matrix P(d,θ) describes the joint distribution of gray levels in the image at a specified direction and distance.

[0105] P(d,θ)={p(i,j,d,θ)}

[0106] Where p(i, j, d, θ) represents the probability of co-occurrence of pixels with grayscale values i and j at distance d and direction θ. Contrast measures the intensity of grayscale changes in an image. The formula is as follows:

[0107] Contrast(P)=∑ i,j (ij) 2 p(i,j)

[0108] Energy reflects the consistency of image grayscale, usually the sum of squares of grayscale co-occurrence matrix elements:

[0109] Energy(P)=∑ i,j p(i,j) 2

[0110] Correlation measures the linear relationship between gray levels, and the formula is as follows:

[0111]

[0112] See Figure 5 As shown, the processed hyperspectral image is sliced and divided into grids, and a saponin content prediction model is constructed based on the characteristic band spectral data and texture parameters of each slice. The ginsenoside content in each grid image is obtained specifically including:

[0113] Based on the processed hyperspectral image, it is sliced and divided into grids to obtain a number of gridded hyperspectral images;

[0114] Based on the acquired spectral + texture fusion feature vector, it is input into a deep learning model based on convolutional neural network, and combined with partial least squares regression to construct a quantitative prediction model for ginsenoside content;

[0115] Inputting several gridded hyperspectral images into a quantitative prediction model of ginsenoside content to obtain ginsenoside content data in each image;

[0116] According to the grid coordinates of each image, the predicted values were filled into the content distribution matrix to statistically form a ginsenoside content dataset.

[0117] It is understood that the grid size should be appropriately designed based on the image resolution and the feature size of the object being studied. A grid that is too small may result in excessive noise, while a grid that is too large may lose detailed information. For overlapping data during the gridding process, weighted averaging or other appropriate algorithms can be used to reduce the impact of edge effects on the results. Furthermore, a sliding window method can be used to extract sub-blocks of the hyperspectral image, with each sub-block being input as a sample into the deep learning model.

[0118] See Figure 6 As shown, based on the ginsenoside content in each grid image, the data neutrality judgment is performed. If the ginsenoside content data in each grid image are not concentrated, it is judged that the ginseng sample is unevenly mixed. If the data is concentrated, the outliers are deleted and the mean is calculated. The final value of the ginsenoside content is obtained specifically including:

[0119] Based on the obtained ginsenoside content data set, key statistics of the data set were calculated, including standard deviation, percentile, and interquartile range;

[0120] Based on the key statistical values obtained by calculation, a concentration threshold is set to determine the concentration of ginsenoside content data;

[0121] If the data are not concentrated, the ginseng sample is not mixed evenly, so crush and stir the ginseng sample again;

[0122] If the data set is judged to be centralized, the abnormal data values in the ginsenoside content data set are detected and deleted;

[0123] Based on the ginsenoside content dataset after removing outliers, the average value was calculated and used as the final value of ginsenoside content. The result was mapped to the hyperspectral image space using pseudo-color imaging technology to generate a ginsenoside content distribution heat map.

[0124] Specifically, generally speaking, when the standard deviation is less than a certain value and the interquartile range is small, the data set can be considered to be more concentrated.

[0125] The IQR calculation formula is:

[0126] IQR=Q3-Q1

[0127] The outlier detection formula is:

[0128] Lower limit = Q1 - 1.5 × IQR

[0129] Lower limit=Q3+1.5×IQR

[0130] Any data below the lower limit or above the upper limit is considered an outlier and should be deleted. A large standard deviation or large IQR may indicate that the data is not concentrated. Set the threshold to ±1-2 times the standard deviation of the mean of the data set, or set a specific interquartile range. Outlier detection usually uses box plots or standard deviation-based methods to detect outliers. The upper and lower limits in the box plot are usually calculated based on 1.5 times the IQR, and data points outside this range can be considered outliers.

[0131] Furthermore, the method according to the embodiment of the present application can also be used with the aid of Figure 7 The electronic device architecture shown in FIG. Figure 7 As shown, the electronic device 500 may include a bus 501, one or more CPUs 502, a read-only memory (ROM) 503, a random access memory (RAM) 504, a communication port 505 connected to a network, an input / output component 506, a hard disk 507, etc. The storage device in the electronic device 500, such as the ROM 503 or the hard disk 507, may store a method and apparatus for detecting ginsenoside content based on hyperspectral imaging provided in this application. The electronic device 500 may also include a terminal interface 508. Of course, Figure 7 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different devices. Figure 7 One or more components of an electronic device are shown.

[0132] Figure 8 This is a schematic diagram of the computer-readable storage medium structure provided by an embodiment of the present application. Figure 8 As shown, a computer-readable storage medium 600 according to one embodiment of the present application is shown. Computer-readable instructions are stored on the computer-readable storage medium 600. When the computer-readable instructions are executed by the processor, a method and device for detecting ginsenoside content based on hyperspectral imaging according to an embodiment of the present application described with reference to the above figures can be executed. The storage medium 600 includes, but is not limited to, for example, volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and cache memory (cache). Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc.

[0133] It should be noted that the order in which the embodiments of the present invention are described above is for illustrative purposes only and does not necessarily represent the superiority or inferiority of the embodiments. Furthermore, the foregoing descriptions of specific embodiments of this specification are provided. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential sequence shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0134] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments.

[0135] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for detecting ginsenoside content based on hyperspectral imaging, characterized in that: include: The ginseng samples were crushed into uniform powder and pressed into tablets, and hyperspectral image data of the samples were collected using a hyperspectral imaging system; The original hyperspectral image is spectrally corrected through dark current correction and reflectance calibration, and a reference spectrum is obtained by referring to a whiteboard. The spectral data of the effective area of the sample is extracted using an image segmentation algorithm. Based on the characteristic absorption peaks of ginsenosides, a continuous projection algorithm was used to screen the characteristic band combination with high correlation with saponin content from the full band; Spatial texture analysis was performed on the hyperspectral images of the selected characteristic bands to obtain texture parameters of gray-level co-occurrence matrix energy, contrast, and correlation as saponin characteristic indicators; The processed hyperspectral image is divided into slices according to the gridding method, and a saponin content prediction model is constructed based on the characteristic band spectral data and texture parameters of each slice to obtain the ginsenoside content in each grid image; Based on the ginsenoside content in each grid image, the data set was judged to be neutral. If the ginsenoside content data in each grid image were not concentrated, the ginseng samples were judged to be unevenly mixed. If the data set was concentrated, the outliers were deleted and the mean was calculated to obtain the final value of the ginsenoside content.

2. The method for detecting ginsenoside content based on hyperspectral imaging according to claim 1, wherein: The spectral correction of the original hyperspectral image by dark current correction and reflectance calibration, obtaining a reference spectrum with reference to a whiteboard, and extracting spectral data of the effective area of the sample by using an image segmentation algorithm specifically include: Under completely dark conditions, multiple dark current images are taken using the same sensor parameters, and the average value is taken as the dark current reference image; Perform pixel-by-pixel correction on the original hyperspectral image of each band to eliminate sensor dark current noise and environmental thermal noise; Under the same light source and integration time, a standard white board is imaged to obtain a white board reference image. The dark current corrected image of each band is then converted to reflectivity to eliminate light source non-uniformity and ambient light interference. Based on the processed image data, the near-infrared band grayscale image is extracted, and the optimal threshold is automatically calculated using the Otsu algorithm to generate a binary mask; Based on the binary mask, spectral data registration is performed, and outliers are removed to obtain spectral data of the effective area of the sample.

3. The method for detecting ginsenoside content based on hyperspectral imaging according to claim 1, wherein: The method of screening characteristic band combinations with high correlation with saponin content from the full band based on the characteristic absorption peaks of ginsenosides by continuous projection algorithm specifically includes: Through prior screening of characteristic absorption peaks, based on historical experimental data, the characteristic band range of saponins is obtained, and the characteristic band region of saponins is pre-selected from the full band as the candidate band subset, and irrelevant bands are removed; Based on the successive projection algorithm, the optimal subset was constructed by iteratively selecting new bands with the minimum collinearity with the selected bands to obtain the characteristic band combination with high correlation with saponin content.

4. The method for detecting ginsenoside content based on hyperspectral imaging according to claim 1, wherein: The spatial texture analysis of the hyperspectral image of the selected characteristic band to obtain the texture parameters of gray-level co-occurrence matrix energy, contrast, and correlation as saponin characteristic indicators specifically includes: Based on the acquired hyperspectral images of characteristic bands with high correlation with saponin content, the parameters of the gray-level co-occurrence matrix were set, including spatial direction and spatial distance; For each characteristic band of the grayscale image, the texture parameters of contrast, energy and correlation are calculated respectively; For each feature, its spatial direction is averaged and the mean of the four directions is calculated as the final value; Four types of texture features are calculated for each characteristic band to form a spectrum + texture fusion feature vector.

5. The method for detecting ginsenoside content based on hyperspectral imaging according to claim 1, wherein: The processed hyperspectral image is divided into slices according to a gridding method, and a saponin content prediction model is constructed based on the characteristic band spectral data and texture parameters of each slice. The ginsenoside content in each grid image is obtained specifically including: Based on the processed hyperspectral image, it is sliced and divided into grids to obtain a number of gridded hyperspectral images; Based on the acquired spectral + texture fusion feature vector, it is input into a deep learning model based on convolutional neural network, and combined with partial least squares regression to construct a quantitative prediction model for ginsenoside content; Inputting several gridded hyperspectral images into a quantitative prediction model of ginsenoside content to obtain ginsenoside content data in each image; According to the grid coordinates of each image, the predicted values were filled into the content distribution matrix to statistically form a ginsenoside content dataset.

6. The method for detecting ginsenoside content based on hyperspectral imaging according to claim 1, wherein: The data neutrality judgment is performed based on the ginsenoside content in each grid image. If the ginsenoside content data in each grid image are not centralized, it is determined that the ginseng sample is unevenly mixed. If the data is centralized, the outliers are deleted and the mean is calculated to obtain the final value of the ginsenoside content. Specifically, the following steps are performed: Based on the obtained ginsenoside content data set, key statistics of the data set were calculated, including standard deviation, percentile, and interquartile range; Based on the key statistical values obtained by calculation, a concentration threshold is set to determine the concentration of ginsenoside content data; If the data are not concentrated, the ginseng sample is not mixed evenly, so crush and stir the ginseng sample again; If the data set is judged to be centralized, the abnormal data values in the ginsenoside content data set are detected and deleted; Based on the ginsenoside content dataset after removing outliers, the average value was calculated and used as the final value of ginsenoside content. The result was mapped to the hyperspectral image space using pseudo-color imaging technology to generate a ginsenoside content distribution heat map.

7. A method for detecting ginsenoside content based on hyperspectral imaging is combined to realize a device for detecting ginsenoside content based on hyperspectral imaging as claimed in any one of claims 1 to 6, characterized in that: include: Hyperspectral imaging device: including a hyperspectral camera, a controllable light source, a loading platform and an image acquisition device; Dark box calibration module: The dark box calibration module has a built-in electric lifting standard white board and a temperature control module to perform spectral correction on the original hyperspectral image; Spectral correction unit: including dark current automatic subtraction algorithm processor and reflectivity real-time calibration chip; Spatial texture analysis module: The spatial texture analysis module obtains texture parameters of gray-level co-occurrence matrix energy, contrast, and correlation as saponin characteristic indicators; Saponin content prediction model module: The saponin content prediction model module is mainly used to construct a saponin content prediction model; Grid division module: The grid division module is mainly used to divide the processed hyperspectral image into several grid images for subsequent saponin content measurement; Saponin content calculation module: The saponin content calculation module obtains the final ginsenoside content by performing statistical analysis on the ginsenoside content data in each grid image; Quality control terminal: Grid distribution analyzer: including touch screen display of saponin content heat map and automatic marking of outliers; Processor: The processor is mainly used for the calculation process of each formula and the construction calculation process of each model.

8. An electronic device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the ginsenoside content detection method based on hyperspectral imaging as described in any one of claims 1-6.

9. A computer-readable storage medium storing computer-readable instructions, characterized in that: When the computer-readable instructions are executed by a processor, a method for detecting ginsenoside content based on hyperspectral imaging according to any one of claims 1 to 6 is implemented.