Method for identifying traditional Chinese medicinal materials by combining infrared spectroscopy with clustering analysis
By combining infrared spectroscopy with cluster analysis, the problem of relying on professional experience and being time-consuming and labor-intensive for the identification of Chinese medicinal materials has been solved, and accurate and efficient identification of the quality grade of Chinese medicinal materials has been achieved.
Patent Information
- Application Number
- CN202511002744.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-10-28
AI Technical Summary
Existing methods for identifying Chinese medicinal materials rely on professional experience and are time-consuming and labor-intensive. Chemical analysis methods are complex and highly destructive, and DNA barcoding technology has limited applicability to processed medicinal materials.
The method of infrared spectroscopy combined with cluster analysis is adopted. The raw infrared spectral data of Chinese medicinal materials are collected, preprocessed and standardized to construct sample maps and wavelength maps. Low-dimensional feature vectors are extracted using graph neural networks, and cluster analysis is performed through dynamic cluster diffusion module to determine the quality grade of Chinese medicinal materials.
This approach reduces interference, extracts key features, accurately determines the quality grade of Chinese medicinal materials, and minimizes sample damage and time costs.
Smart Images

Figure CN120852824A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of pharmaceutical information technology, specifically to a method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis. Background Technology
[0002] Accurate identification of Chinese medicinal materials is a crucial step in ensuring the safety and quality control of clinical medication. Currently, methods for identifying Chinese medicinal materials mainly include morphological identification and microscopic identification based on physical characteristics, as well as analytical methods such as high-performance liquid chromatography (HPLC) and gas chromatography (GC) relying on chemical separation techniques. These methods have accumulated rich experience through long-term practice, but they also face technical bottlenecks: traditional morphological methods are highly dependent on the professional experience of the identifyers and struggle to distinguish closely related species with similar appearances; while chemical analysis methods can achieve qualitative and quantitative analysis of components, their pretreatment processes are complex, time-consuming, and require large amounts of chemical reagents, which can be destructive to the samples. In recent years, DNA barcoding technology has provided a new direction for the identification of Chinese medicinal materials, but its applicability to materials that have undergone processing, extraction, or other treatments is limited. Summary of the Invention
[0003] The present invention aims to at least partially solve the technical problems in the above-mentioned technologies.
[0004] Therefore, this invention discloses a method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis, comprising the following steps:
[0005] S1: Collect the raw infrared spectral data of root and rhizome Chinese medicinal materials, and average the raw infrared spectral data to obtain the raw spectral data of a single sample;
[0006] S2: Preprocess the original spectral data of the single sample to obtain standardized spectral features;
[0007] S3: Construct sample maps and wavelength maps based on the standardized spectral features, and fuse the sample maps and wavelength maps to obtain fused map data;
[0008] S4: Input the fused graph data into a pre-trained graph neural network model, and extract the low-dimensional feature vector of the target sample through forward propagation;
[0009] S5: Input the low-dimensional feature vector into the pre-trained dynamic cluster diffusion module to obtain cluster labels and distance data;
[0010] S6: Determine and output the quality grade of the root and rhizome medicinal material samples based on the clustering labels and distance data.
[0011] The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis disclosed in this invention can effectively reduce interference and extract key features. By combining graph neural networks to extract correlation features from fused graph data and using cluster analysis with a dynamic cluster diffusion module, the quality grade of Chinese medicinal materials can be accurately determined.
[0012] In addition, the method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis disclosed in this invention may also have the following additional technical features:
[0013] In one embodiment of the present invention, in step S1, the raw infrared spectral data is acquired by a Fourier transform infrared spectrometer.
[0014] In one embodiment of the present invention, step S2 involves preprocessing the raw spectral data of the single sample, including the following steps:
[0015] Baseline correction is performed on the original spectral data of the single sample to obtain baseline-corrected spectral data;
[0016] The baseline-corrected spectral data is subjected to noise suppression to obtain noise-reduced spectral data;
[0017] Based on the key wavelength index, the response value of the corresponding wavelength is extracted from the denoised spectral data to obtain the characteristic wavelength spectral data;
[0018] The characteristic wavelength spectral data is standardized to obtain the standardized spectral features.
[0019] In one embodiment of the present invention, the smoothing window for baseline correction of the single-sample original spectral data is 15, the number of iterations is 50, the number of decomposition layers for noise suppression of the baseline-corrected spectral data is 3, and the threshold coefficient is 0.02.
[0020] In one embodiment of the present invention, step S3, constructing a sample map based on the standardized spectral features, includes the following steps:
[0021] Calculate the cosine similarity between the standardized spectral features and the samples in the training set feature library, and select the Top 10 nearest neighbor samples;
[0022] The target sample and its 10 nearest neighbor samples are used as nodes, and the similarity between samples is used as the edge weight to construct the sample graph.
[0023] The wavelength map is a wavelength correlation matrix in a pre-trained graph neural network model. The wavelength correlation matrix has a dimension of N×N, where N is the number of key wavelengths.
[0024] In one embodiment of the present invention, step S3, fusing the sample image and the wavelength image, includes the following steps:
[0025] The node features of the sample image and the node features of the wavelength image are concatenated to obtain the fused image data;
[0026] The node features of the sample graph are retained in N dimensions, the node features of the wavelength graph are mapped to 11 dimensions, and the fused graph data includes a node feature matrix and an adjacency matrix. The node feature matrix has a dimension of 11×(N+11), and the adjacency matrix has a dimension of 11×11.
[0027] In one embodiment of the present invention, in step S4, the pre-trained graph neural network model includes a graph convolutional layer and an attention layer, wherein the graph convolutional layer is a 2-layer ChebNet graph convolutional layer and the attention layer is a node attention layer;
[0028] The forward propagation process includes the following steps:
[0029] The local-global spectral correlation features of the fused graph data are extracted through the graph convolutional layer, and the node features are weighted through the attention layer.
[0030] In one embodiment of the present invention, in step S5, the pre-trained dynamic cluster diffusion module includes preset cluster center parameters, which include super-centers, first-level centers and second-level centers, all of which are 1×128-dimensional vectors.
[0031] Obtaining cluster labels involves the following steps:
[0032] Calculate the Euclidean distance between the low-dimensional feature vector and the parameters of each cluster center, and determine the cluster label based on the principle of minimum distance.
[0033] In one embodiment of the present invention, in step S6, determining and outputting the quality grade of the rhizome-type Chinese medicinal material sample based on the clustering labels and distance data includes the following steps:
[0034] Calculate the ratio of the minimum distance to the second minimum distance in the distance data. If the ratio is > 0.8, the root and rhizome medicinal material sample is marked as a sample to be retested; if the ratio is ≤ 0.8, the root and rhizome medicinal material sample is marked as a normal sample.
[0035] For the normal samples, the clustering labels are mapped to quality levels using a preset dictionary; for the samples to be re-inspected, a second detection is triggered, and the second detection repeats steps S1 to S5.
[0036] In one embodiment of the present invention, when the number of rhizome-type medicinal material samples to be identified is ≥20, the method further includes a batch processing step, specifically:
[0037] Step S2 is executed in parallel to generate batch standardized spectral features; a full sample map is constructed and fused with the wavelength map; the fused batch map data is input into a pre-trained graph neural network model and a dynamic cluster diffusion module to output the quality level of each sample in batches.
[0038] Additional features and advantages of this invention will be set forth in the description which follows, or may be learned by practicing the invention. Attached Figure Description
[0039] The technical solution and beneficial effects of the present invention will become apparent and readily understood from the following description in conjunction with the accompanying drawings, wherein:
[0040] Figure 1 This is a flowchart illustrating the method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis according to the present invention.
[0041] Figure 2 This is another flowchart of the method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis according to the present invention;
[0042] Figure 3 This is another flowchart of the method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis according to the present invention;
[0043] Figure 4 This is another flowchart of the method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis according to the present invention;
[0044] Figure 5 This is another flowchart of the method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis according to the present invention;
[0045] Figure 6 This is another flowchart of the method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis according to the present invention;
[0046] Figure 7 This is another flowchart of the method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis according to the present invention. Detailed Implementation
[0047] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0048] The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis, as disclosed in this invention, will now be described with reference to the accompanying drawings:
[0049] like Figure 1 As shown, a method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis includes the following steps:
[0050] S1: Collect raw infrared spectral data of root and rhizome Chinese medicinal materials, and average the raw infrared spectral data to obtain raw spectral data of a single sample;
[0051] S2: Preprocess the raw spectral data of a single sample to obtain standardized spectral features;
[0052] S3: Construct sample maps and wavelength maps based on standardized spectral features, and fuse the sample maps and wavelength maps to obtain fused map data;
[0053] S4: Input the fused graph data into a pre-trained graph neural network model and extract the low-dimensional feature vector of the target sample through forward propagation;
[0054] S5: Input the low-dimensional feature vector into the pre-trained dynamic cluster diffusion module to obtain cluster labels and distance data;
[0055] S6: Determine and output the quality grade of root and rhizome medicinal material samples based on cluster labels and distance data.
[0056] In step S1, the raw infrared spectral data is acquired by a Fourier transform infrared spectrometer.
[0057] like Figure 2 As shown, in step S2, the raw spectral data of a single sample is preprocessed, including the following steps:
[0058] Baseline correction is performed on the raw spectral data of a single sample to obtain baseline-corrected spectral data.
[0059] Noise suppression is performed on the baseline-corrected spectral data to obtain the noise-reduced spectral data;
[0060] Based on the key wavelength index, the response values of the corresponding wavelengths are extracted from the denoised spectral data to obtain the characteristic wavelength spectral data;
[0061] The characteristic wavelength spectral data are standardized to obtain standardized spectral features.
[0062] The smoothing window for baseline correction of the original spectral data of a single sample is 15, the number of iterations is 50, the number of decomposition layers for noise suppression of the baseline-corrected spectral data is 3, and the threshold coefficient is 0.02.
[0063] like Figure 3 As shown, in step S3, a sample map is constructed based on standardized spectral features, including the following steps:
[0064] Calculate the cosine similarity between the standardized spectral features and the samples in the training set feature library, and select the Top 10 nearest neighbor samples;
[0065] A sample graph is constructed using the target sample and its 10 nearest neighbor samples as nodes, and the similarity between samples as the edge weights.
[0066] The wavelength map is the wavelength correlation matrix in the pre-trained graph neural network model. The wavelength correlation matrix has a dimension of N×N, where N is the number of key wavelengths.
[0067] In step S3, the sample image and wavelength image are fused, including the following steps:
[0068] The node features of the sample image and the node features of the wavelength image are concatenated to obtain the fused image data;
[0069] The node features of the sample graph are preserved in N dimensions, while the node features of the wavelength graph are mapped to 11 dimensions. The fused graph data includes a node feature matrix and an adjacency matrix. The node feature matrix has a dimension of 11×(N+11), and the adjacency matrix has a dimension of 11×11.
[0070] like Figure 4 As shown, in step S4, the pre-trained graph neural network model includes graph convolutional layers and attention layers. The graph convolutional layers are two-layer ChebNet graph convolutional layers, and the attention layers are node attention layers.
[0071] The forward propagation process includes the following steps:
[0072] Local-global spectral correlation features of the fused graph data are extracted through graph convolutional layers, and node features are weighted through attention layers.
[0073] like Figure 5 As shown, in step S5, the pre-trained dynamic cluster diffusion module includes preset cluster center parameters, which include super-centers, first-level centers, and second-level centers, all of which are 1×128-dimensional vectors.
[0074] Obtaining cluster labels involves the following steps:
[0075] Calculate the Euclidean distance between the low-dimensional feature vector and the parameters of each cluster center, and determine the cluster label based on the principle of minimum distance.
[0076] like Figure 6 As shown, in step S6, the quality grade of rhizome medicinal material samples is determined and output based on cluster labels and distance data, including the following steps:
[0077] Calculate the ratio of the minimum distance to the second minimum distance in the distance data. If the ratio is >0.8, mark the root and rhizome medicinal material samples as samples to be retested; if the ratio is ≤0.8, mark the root and rhizome medicinal material samples as normal samples.
[0078] For normal samples, cluster labels are mapped to quality levels using a preset dictionary; for samples to be retested, a second test is triggered, and steps S1 to S5 are repeated for the second test.
[0079] like Figure 7 As shown, when the number of rhizome-type medicinal material samples to be identified is ≥20, the method also includes a batch processing step, specifically:
[0080] Step S2 is executed in parallel to generate batch standardized spectral features; a full sample map is constructed and fused with the wavelength map; the fused batch map data is input into a pre-trained graph neural network model and a dynamic cluster diffusion module to output the quality level of each sample in batches.
[0081] Specifically, in order to enable those skilled in the art to accurately understand and repeat the technical solution of the present invention, the present invention will be described in detail below with reference to root and rhizome Chinese medicinal materials (taking ginseng as a specific example), including sample preparation, specific operation of each step, basis for parameter selection and verification of actual effects;
[0082] Sample preparation and basic parameter settings:
[0083] This embodiment uses ginseng as the research object, covering three quality grades (premium, grade one, and grade two), totaling 600 samples (200 premium, 200 grade one, and 200 grade two). Of these, 450 samples were used for model pre-training (training has been completed), and 150 samples were used as samples to be identified (including 30 interference samples with mixed impurities) to verify the actual effect of this method.
[0084] Sample pretreatment followed a unified standard. Fresh ginseng rhizomes were cleaned of fibrous roots and impurities, rinsed three times with deionized water, dried in a 45℃ oven to constant weight (moisture content ≤8%), pulverized and passed through an 80-mesh sieve (particle diameter ≤180μm), and stored in sealed bags away from light (at 25℃ and 40% relative humidity, storage time not exceeding 72 hours) to avoid interference with spectral acquisition due to changes in composition caused by moisture and light.
[0085] Specific steps for acquiring raw infrared spectral data:
[0086] For instrument and parameter settings, this embodiment uses a Fourier transform infrared spectrometer with an attenuated total reflectance (ATR) accessory (diamond crystal, reflectivity ≥95%), with air as the background, and the acquisition parameters are set to a wavelength range of 4000~400cm. -1(Covering the characteristic absorption ranges of the main chemical components of Chinese medicinal materials, such as the vibrational absorption of functional groups like hydroxyl, carbonyl, and glycosidic bonds), resolution 4cm. -1 (Balancing feature peak recognition accuracy and acquisition efficiency), 32 scans (single scan time 1.2 seconds, 32 cumulative scans can reduce random noise and improve the signal-to-noise ratio to over 5000:1).
[0087] For spectral acquisition, take 0.2g of ginseng powder sample and spread it evenly on the crystal surface of the ATR attachment. Apply 50N pressure using the tablet press (ensuring close contact between the sample and the crystal to avoid light reflection loss due to air gaps). After the instrument baseline stabilizes (approximately 30 seconds), start acquisition. Acquire each sample three times consecutively (re-spread the sample before each acquisition to reduce the impact of uneven sample distribution), generating three sets of raw spectral data (each set contains response values at 2048 wavelength points, corresponding to 4000-400cm). -1 (continuous wavelengths);
[0088] For data preprocessing, the arithmetic mean of the three sets of raw spectral data at wavelength points is taken to obtain the raw spectrum of a single sample (a 1×2048-dimensional array). This operation can eliminate random errors from a single acquisition (such as local spectral fluctuations caused by slight differences in sample particle size), making the spectrum closer to the true chemical characteristics of the sample. For example, the raw spectrum of a premium ginseng sample is at 1050 cm⁻¹. -1 (Characteristic peak of glycosidic bond in ginsenosides), 3300 cm⁻¹ -1 The response value at (hydroxyl stretching vibration) is significantly higher than that of the secondary sample, and this difference can be preserved by mean processing;
[0089] Specific preprocessing steps:
[0090] Baseline drift is mainly caused by physical factors such as uneven sample particle size and ATR crystal surface contamination, which manifests as an overall tilt or fluctuation in the spectrum and can mask characteristic peaks with low response values (such as the absorption peak of polysaccharides in ginseng at 1150 cm⁻¹).
[0091] This embodiment uses the airPLS (Adaptive Iterative Penalized Least Squares) algorithm for baseline correction, with parameters set to a smoothing window of 15 (corresponding to 15 wavelength points, approximately 60cm). -1 (Adapting to the local smoothing characteristics of infrared spectrum), with 50 iterations (the baseline error can be controlled within 0.001 absorption through 50 iterations).
[0092] The specific operation involves inputting the original spectrum of a single sample into the algorithm, iteratively calculating and separating the "signal" (absorption of effective components) and "baseline" (background interference) in the spectrum, and outputting the baseline-corrected spectrum. Through this step, the spectrum of a premium ginseng sample at 3300 cm⁻¹ is obtained. -1The baseline fluctuation at the point decreased from ±0.02 absorbance to ±0.003 absorbance, and the characteristic peak profile became clearer;
[0093] The noise in infrared spectroscopy mainly comes from the thermal noise of the instrument's electronic components, manifesting as high-frequency fluctuations in the spectrum (especially at 2000 cm⁻¹). -1 In the following low-response region, this embodiment uses the db4 wavelet denoising algorithm with the following parameters: 3 decomposition layers (the first layer decomposes and removes high-frequency noise, the second layer retains mid- and low-frequency features, and the third layer extracts the baseline trend), and a threshold coefficient of 0.02 (determined based on the statistical noise level of the training set, which can filter out more than 90% of random noise).
[0094] The specific operation involves performing a three-level wavelet decomposition on the baseline-corrected spectrum to obtain wavelet coefficients at different frequencies. High-frequency coefficients (dominated by noise) are truncated at a threshold of 0.02, while low-frequency coefficients (dominated by signal) are retained. The denoised spectrum is then obtained through wavelet reconstruction. The processed ginseng sample is visualized at 1640 cm⁻¹. -1 The noise fluctuation near (moisture bending vibration) decreased from ±0.005 absorption to ±0.001 absorption, which did not affect the identification of the characteristic peaks of the active ingredients;
[0095] The full-wavelength spectrum (2048 wavelength points) contains a large amount of redundant information (such as wavelength ranges without characteristic absorption), which increases the computational cost of subsequent graph structure construction. This embodiment extracts feature wavelengths directly related to quality based on the key wavelength index fixed in the pre-trained model (68 wavelength points obtained through sensitization optimization). These key wavelengths include:
[0096] 3300-3400cm -1 (Hydroxy stretching vibrations reflect the hydroxyl content of polysaccharides and saponins);
[0097] 2920cm -1 (CH stretching vibration, reflecting the content of fat-soluble components);
[0098] 1640cm -1 (Water bending vibration helps determine the moisture content of the sample).
[0099] 1050-1150cm -1 (Glycosidic bond stretching vibration, the core characteristic peak of ginsenosides);
[0100] The specific operation process involves indexing the key wavelength (e.g., 1050cm). -1 1150cm -1(Etc. the array subscripts corresponding to the 68 wavelengths), extract the response values of the corresponding wavelengths from the denoised spectrum to obtain the characteristic wavelength spectrum (1×68-dimensional array). This step can reduce the data dimension from 2048 to 68, improve the computational efficiency by 30 times, and retain more than 95% of the quality-related features.
[0101] The spectral response values of different samples may have an overall shift due to slight differences in the amount of sample laid and the crystal contact degree (such as the response values of samples of the same level differing by ±0.1 absorption). This systematic error needs to be eliminated by standardization. In this embodiment, Z-score standardization (based on the mean μ and standard deviation σ of the training set) is used.
[0102] Specific operations for graph structure construction and fusion:
[0103] The sample image is used to capture the similarity between the target sample and samples of known quality (e.g., a top-quality sample should be more similar to other top-quality samples). The specific operation is as follows:
[0104] Input: Normalized spectral characteristics of ginseng samples (1×68 dimensions);
[0105] Similarity calculation: Cosine similarity (which measures the consistency of the directions of two vectors and is suitable for high-dimensional spectral data) is used to calculate the similarity between the target sample and all samples in the training set feature library (450 samples) (the value ranges from 0 to 1, and the higher the value, the more similar the spectra).
[0106] Nearest neighbor selection: Select the 10 samples with the highest similarity (Top 10 nearest neighbors). If the target sample is premium ginseng, usually 8-9 of the nearest neighbors are premium samples and 1-2 are first-level samples (which conforms to the actual quality distribution).
[0107] Construct a sample graph: The target sample and its 10 nearest neighbors are used as nodes (11 nodes in total). The node features are their respective standardized spectral features (68 dimensions).
[0108] Using the cosine similarity between samples as the edge weight (e.g., the edge weight between the target sample and its top-level nearest neighbor is ≥0.8, and the edge weight between the target sample and its second-level nearest neighbor is ≤0.5), an 11×11 adjacency matrix is formed (the diagonal is 1, and the off-diagonal is the similarity value).
[0109] Fusing sample images and wavelength images can simultaneously preserve both "sampling similarity" and "wavelength correlation," as follows:
[0110] Sample graph node feature processing: retain the original features (68 dimensions) of 11 nodes to reflect the spectral features of each sample;
[0111] Wavelength map node feature mapping: The mean of the 68×68 wavelength association matrix is taken by row to obtain the "mean of association strength" (1×68 dimension) of 68 wavelengths. Then, it is mapped to an 11-dimensional vector (matching the number of sample map nodes) through a fully connected layer (pre-trained parameters) so that the wavelength features can be concatenated with the sample map features.
[0112] Feature concatenation: The sample features (68-dimensional) of each node are concatenated with the mapped wavelength features (11-dimensional) to obtain a node feature matrix of 11×(68+11)=11×79;
[0113] Adjacency matrix preserved: The 11×11 adjacency matrix of the sample graph is used (edge weights reflect the similarity between samples).
[0114] The final output fusion graph data (11×79 node feature matrix + 11×11 adjacency matrix) contains information at both the sample level and the wavelength level.
[0115] The specific reasoning process for GNN feature extraction:
[0116] The model consists of two graph convolutional layers (ChebNet) and one node attention layer, and the parameters of each layer have been optimized using the training set.
[0117] Input layer: Receives the node feature matrix (11×79) and adjacency matrix (11×11) of the fused graph.
[0118] The first layer of graph convolution uses ChebNet graph convolution (based on Chebyshev multinomial approximation) with a kernel size of 79×32 (reducing the 79-dimensional features to 32-dimensional features) to extract local features (such as the similarity features between a single nearest neighbor sample and the target sample).
[0119] The second layer of graph convolution: The kernel size is 32×16, which further extracts global features (such as the influence of the overall distribution of the 10 nearest neighbor samples on the target sample).
[0120] Node attention layer: Assign attention weights to 11 nodes (the weights sum to 1). For example, the nearest neighbor nodes of top-level samples have higher weights (≥0.15), while the nearest neighbor nodes of second-level samples have lower weights (≤0.05), thus enhancing the contribution of effective information.
[0121] After inputting the fused graph data, the model completes feature extraction through a single forward propagation (no backpropagation, time ≤ 0.1 seconds):
[0122] The first layer of graph convolution: Convolution operation is performed on the adjacency matrix and node feature matrix of the fused graph, outputting 32-dimensional local features (11×32). At this point, the top-grade ginseng sample is at 1050cm. -1 The corresponding feature dimension response values are significantly improved;
[0123] The second layer of graph convolution further convolves the local features and outputs 16-dimensional global features (11×16). After fusing the features of the nearest neighbor samples, the feature difference between the top-level and second-level samples is increased by 3 times.
[0124] Attention weighting: The 16-dimensional features of the 11 nodes are weighted and summed by the attention layer (the weights are based on pre-trained parameters) to obtain the 16-dimensional intermediate features of the target sample;
[0125] Output layer: The 16-dimensional features are mapped to a 128-dimensional low-dimensional feature vector (1×128) through a fully connected layer. This vector condenses the core features related to quality (such as saponin content, impurity ratio and other comprehensive information).
[0126] The specific reasoning process for DCD clustering assignment:
[0127] The DCD module assigns low-dimensional feature vectors to clusters of corresponding quality levels based on pre-trained cluster center parameters and through distance calculation.
[0128] For the three quality grades of ginseng, the pre-trained model stores three cluster center vectors (1×128 dimensions):
[0129] The top-tier center was obtained by taking the mean value of the low-dimensional feature vectors of 200 top-tier samples. The dimension (32-45) related to saponins in the vector had the highest value.
[0130] Primary center: calculated based on 200 primary samples, with corresponding dimensional values between the top-tier and secondary-tier centers;
[0131] Secondary center: Calculated based on 200 secondary samples, with the lowest corresponding dimensional value.
[0132] After inputting the 128-dimensional feature vector of the target sample, the DCD module performs the following operations:
[0133] Calculate the Euclidean distance: Calculate the Euclidean distance between the feature vector and the top center, first-level center, and second-level center respectively (the smaller the distance, the more similar the features), and obtain d1, d2, and d3 (for example, for top-level samples, d1 ≤ 0.3, d2 ≥ 0.5, and d3 ≥ 0.8).
[0134] Assign cluster labels: Select the cluster with the smallest distance as the label (if d1 is the smallest, the label is 0, corresponding to the first level; if d2 is the smallest, the label is 1, corresponding to the first level; if d3 is the smallest, the label is 2, corresponding to the second level).
[0135] Output results: cluster labels (0 / 1 / 2) and distance data (d1, d2, d3). For example, the top-level sample outputs label 0 and d1=0.25, d2=0.6, d3=0.9.
[0136] Specific procedures for determining and outputting quality grades:
[0137] First, regarding the identification of abnormal samples:
[0138] Calculate the ratio of the "minimum distance" to the "second smallest distance" in the distance data (e.g., d1 / d2, where d1 is the minimum distance and d2 is the second smallest distance):
[0139] If the ratio is ≤0.8, it indicates that the sample characteristics clearly belong to a certain level (e.g., for a top-level sample, d1=0.25, d2=0.6, and the ratio = 0.42≤0.8), and it is marked as a "normal sample".
[0140] If the ratio is greater than 0.8, it indicates that the sample characteristics are ambiguous (e.g., after a primary sample is mixed with impurities, d2=0.4, d1=0.38, the ratio=0.95>0.8), and it is marked as "sample to be re-inspected".
[0141] Secondly, regarding level mapping and re-inspection:
[0142] Normal samples: The labels are directly mapped to quality levels through a preset dictionary ({0: top grade, 1: first grade, 2: second grade}), and the level and confidence score are output (1 - minimum distance / maximum distance, such as the confidence score of top grade samples = 1 - 0.25 / 0.9 ≈ 0.72).
[0143] Samples to be retested: Trigger a second test (repeat steps S1~S5, change the sample collection point and increase the number of scans to 64). If the second test still shows fuzzy features, output "Suggested physicochemical verification" (e.g., final confirmation by determining the content of ginsenoside Rg1 through HPLC).
[0144] For example, after a sample to be retested undergoes two tests, d2=0.35, d1=0.5, the ratio=0.7≤0.8, and it is finally mapped to level one with a confidence level of 0.65.
[0145] In summary, the method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis disclosed in this invention can effectively reduce interference and extract key features. By combining graph neural networks to extract correlation features from fused graph data and using cluster analysis with a dynamic cluster diffusion module, the quality grade of Chinese medicinal materials can be accurately determined.
[0146] Although the embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis, characterized in that, Includes the following steps: S1: Collect the raw infrared spectral data of root and rhizome Chinese medicinal materials, and average the raw infrared spectral data to obtain the raw spectral data of a single sample; S2: Preprocess the original spectral data of the single sample to obtain standardized spectral features; S3: Construct sample maps and wavelength maps based on the standardized spectral features, and fuse the sample maps and wavelength maps to obtain fused map data; S4: Input the fused graph data into a pre-trained graph neural network model, and extract the low-dimensional feature vector of the target sample through forward propagation; S5: Input the low-dimensional feature vector into the pre-trained dynamic cluster diffusion module to obtain cluster labels and distance data; S6: Determine and output the quality grade of the root and rhizome medicinal material samples based on the clustering labels and distance data.
2. The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis as described in claim 1, characterized in that, In step S1, the raw infrared spectral data is acquired by a Fourier transform infrared spectrometer.
3. The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis as described in claim 1, characterized in that, In step S2, the raw spectral data of the single sample is preprocessed, including the following steps: Baseline correction is performed on the original spectral data of the single sample to obtain baseline-corrected spectral data; The baseline-corrected spectral data is subjected to noise suppression to obtain noise-reduced spectral data; Based on the key wavelength index, the response value of the corresponding wavelength is extracted from the denoised spectral data to obtain the characteristic wavelength spectral data; The characteristic wavelength spectral data is standardized to obtain the standardized spectral features.
4. The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis as described in claim 3, characterized in that, The smoothing window for baseline correction of the single-sample original spectral data is 15, the number of iterations is 50, the number of decomposition layers for noise suppression of the baseline-corrected spectral data is 3, and the threshold coefficient is 0.
02.
5. The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis as described in claim 1, characterized in that, In step S3, constructing a sample map based on the standardized spectral features includes the following steps: Calculate the cosine similarity between the standardized spectral features and the samples in the training set feature library, and select the Top 10 nearest neighbor samples; The target sample and its 10 nearest neighbor samples are used as nodes, and the similarity between samples is used as the edge weight to construct the sample graph. The wavelength map is a wavelength correlation matrix in a pre-trained graph neural network model. The wavelength correlation matrix has a dimension of N×N, where N is the number of key wavelengths.
6. The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis as described in claim 5, characterized in that, In step S3, the sample image and wavelength image are fused, including the following steps: The node features of the sample image and the node features of the wavelength image are concatenated to obtain the fused image data; The node features of the sample graph are retained in N dimensions, the node features of the wavelength graph are mapped to 11 dimensions, and the fused graph data includes a node feature matrix and an adjacency matrix. The node feature matrix has a dimension of 11×(N+11), and the adjacency matrix has a dimension of 11×11.
7. The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis as described in claim 1, characterized in that, In step S4, the pre-trained graph neural network model includes a graph convolutional layer and an attention layer. The graph convolutional layer is a two-layer ChebNet graph convolutional layer, and the attention layer is a node attention layer. The forward propagation process includes the following steps: The local-global spectral correlation features of the fused graph data are extracted through the graph convolutional layer, and the node features are weighted through the attention layer.
8. The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis as described in claim 1, characterized in that, In step S5, the pre-trained dynamic cluster diffusion module includes preset cluster center parameters, which include supercenters, first-level centers, and second-level centers, all of which are 1×128-dimensional vectors. Obtaining cluster labels involves the following steps: Calculate the Euclidean distance between the low-dimensional feature vector and the parameters of each cluster center, and determine the cluster label based on the principle of minimum distance.
9. The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis as described in claim 1, characterized in that, In step S6, the quality grade of the rhizome-type Chinese medicinal material samples is determined and output based on the clustering labels and distance data, including the following steps: Calculate the ratio of the minimum distance to the second minimum distance in the distance data. If the ratio is > 0.8, the root and rhizome medicinal material sample is marked as a sample to be retested; if the ratio is ≤ 0.8, the root and rhizome medicinal material sample is marked as a normal sample. For the normal samples, the clustering labels are mapped to quality levels using a preset dictionary; for the samples to be re-inspected, a second detection is triggered, and the second detection repeats steps S1 to S5.
10. The method for identifying Chinese medicinal materials using infrared spectroscopy combined with cluster analysis as described in claim 1, characterized in that, When the number of root and rhizome medicinal material samples to be identified is ≥20, the method further includes a batch processing step, specifically: Step S2 is executed in parallel to generate batch standardized spectral features; a full sample map is constructed and fused with the wavelength map; the fused batch map data is input into a pre-trained graph neural network model and a dynamic cluster diffusion module to output the quality level of each sample in batches.
Citation Information
Cited By
Food-based production process control system and method
CN121635174A
A food-based production process control system and method
CN121635174B