A traditional Chinese medicinal material origin identification method and system, an electronic device, and a storage medium

CN122946980APending Publication Date: 2026-10-20JIANGXI COLLEGE OF APPLIED TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611334755.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

然而,中药材不同产地之间的光谱差异通常较为微弱,且往往表现为多个波数点或波长点之间的联合差异、耦合差异和谱段关联差异

Benefits of technology

本发明,首先通过对原始一维红外光谱进行平滑和标准正态变量变换等预处理,有效抑制了随机噪声与样本散射差异;在此基础上,并非直接使用该一维序列进行分类,而是将其构建为能够显式表征不同波数点或波长点之间谱段关联关系的二维谱关联构象,从而将难以捕捉的微弱联合差异转化为深度网络易于学习的二维空间结构模式;进一步,本发明将该二维构象输入专为谱关联特征设计的注意力U形分类网络,该网络利用编码器-瓶颈层-解码器结构与跳跃连接,在不同尺度上融合谱段关联特征,并借助谱关联注意力模块,根据深层语义特征自适应地增强与产地类别判别强相关的谱段关联区域,同时抑制与产地无关的噪声及干扰区域;从而通过上述“一维转二维显式关联建模-注意力U形网络加权聚焦”的整体技术路径,本发明能够从预处理后的光谱中稳定、精准地提取出对产地识别最具贡献的谱段关联特征,从而在高相似产地样本、存在光谱扰动等复杂场景下,显著提升产地识别的准确性、鲁棒性与可解释性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This invention belongs to the field of intelligent detection technology for traditional Chinese medicinal materials, specifically relating to a method, system, electronic device, and storage medium for identifying the origin of traditional Chinese medicinal materials. The method includes: acquiring a one-dimensional infrared spectral sequence of the sample to be identified; performing one or more spectral preprocessing steps on the one-dimensional infrared spectral sequence, including baseline correction, detrending, smoothing, standard normal variable transformation, wavenumber axis alignment, and resampling, to obtain a standardized spectral sequence; constructing a two-dimensional spectral association conformation based on the standardized spectral sequence; inputting the two-dimensional spectral association conformation into a trained spectral association attention U-shaped classification network, and obtaining spectral segment association features for distinguishing the origin of traditional Chinese medicinal materials through residual coding, deep spectral semantic extraction at the bottleneck layer, skip connection feature fusion, and spectral association attention weighting, thereby obtaining the origin category of the sample and acquiring the classification probability and confidence score. This invention can improve the accuracy, robustness, and interpretability of traditional Chinese medicinal material origin identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent detection technology for Chinese medicinal materials, specifically relating to a method, system, electronic device, and storage medium for identifying the origin of Chinese medicinal materials. Background Technology

[0002] Differences in the origin of Chinese medicinal herbs can lead to variations in the proportions of their internal chemical components, material basis, and quality characteristics. Infrared spectroscopy can rapidly acquire spectral information related to the chemical composition and molecular structure of a sample without damaging it, and is therefore widely used in scenarios such as quality evaluation, authenticity identification, and origin identification of Chinese medicinal herbs.

[0003] Existing methods for identifying the origin of Chinese medicinal herbs based on infrared spectroscopy typically involve first obtaining a one-dimensional infrared spectral sequence of the sample to be identified, and then directly using this sequence as model input for classification via traditional machine learning models or one-dimensional convolutional neural networks. However, the spectral differences between different origins of Chinese medicinal herbs are usually quite weak, often manifesting as joint differences, coupling differences, and spectral band correlation differences among multiple wavenumber or wavelength points. Modeling using only a one-dimensional spectral sequence makes it difficult to explicitly express the correlation structure between different spectral bands, and it is easily affected by noise, baseline drift, instrument differences, and batch-specific variations, thus impacting the accuracy and stability of the origin identification results.

[0004] Therefore, there is an urgent need for a method to identify the origin of Chinese medicinal materials in order to improve the accuracy, robustness and interpretability of identification in scenarios with highly similar origin samples. Summary of the Invention

[0005] To address the problems existing in the prior art, the present invention aims to provide a method, system, electronic device, and storage medium for identifying the origin of Chinese medicinal materials. By constructing a two-dimensional spectral correlation conformation from a one-dimensional infrared spectrum and using a spectral correlation attention U-shaped classification network to extract spectral segment correlation features related to origin discrimination, the accuracy, robustness, and interpretability of identifying the origin of Chinese medicinal materials are improved.

[0006] The technical solution of this invention is: A method for identifying the origin of Chinese medicinal materials includes the following steps: The one-dimensional infrared spectrum sequence of the Chinese medicinal material sample to be identified is obtained, and the spectrum is preprocessed into a standardized spectral sequence; a two-dimensional spectral correlation conformation is constructed based on the standardized spectral sequence to characterize the spectral band correlation relationship between different wavenumber points or wavelength points; The two-dimensional spectral association conformation is input into the trained spectral association attention U-shaped classification network to obtain spectral segment association features for distinguishing the origin of Chinese medicinal materials; the origin category of the Chinese medicinal material sample is determined based on the spectral segment association features. The trained spectral association attention U-shaped classification network includes an encoder for progressively convolutionally encoding the two-dimensional spectral association conformation to output multiple encoded spectral association features at different scales; a bottleneck feature layer for selecting the deepest encoded spectral association feature from the multiple encoded spectral association features at different scales as the highest-level encoded feature, performing semantic compression and feature aggregation to obtain bottleneck spectral semantic features; a decoder connected to the encoder through the skip connection structure to progressively upsample the bottleneck spectral semantic features and fuse them with the encoded spectral association features at the corresponding scale to form corresponding-scale decoded features; and a spectral association attention module for adjusting the weights of the encoded spectral association features at different scales based on the bottleneck spectral semantic features and the corresponding-scale decoded features to obtain spectral association features used to distinguish the origins of Chinese medicinal materials.

[0007] Preferably, the spectral preprocessing includes one or more of the following: baseline correction, detrending processing, outlier removal processing, wavenumber axis alignment processing, and resampling processing; wherein, the baseline correction is used to remove background drift components in the one-dimensional infrared spectral sequence, the detrending processing is used to weaken the overall trend term caused by instrument response or sample state, the outlier removal processing is used to remove outlier bands in the one-dimensional infrared spectral sequence, the wavenumber axis alignment is used to ensure that the spectral peaks in the one-dimensional infrared spectral sequences of different samples are at a uniform wavenumber or wavelength coordinate, and the resampling is used to ensure that the one-dimensional infrared spectral sequences of different samples have the same length.

[0008] Preferably, the two-dimensional spectral correlation image is a multi-channel two-dimensional spectral correlation map, which includes at least a first channel constructed based on a normalized spectral sequence, a second channel constructed based on the first derivative spectrum, and / or a third channel constructed based on the second derivative spectrum. The first channel is used to characterize the overall intensity correlation of the normalized spectrum between different wavenumber points or wavelength points, the second channel is used to characterize the trend correlation of the first derivative spectrum between different wavenumber points or wavelength points, and the third channel is used to characterize the correlation of spectral curvature and subtle signal differences of the second derivative spectrum between different wavenumber points or wavelength points.

[0009] Preferably, the first, second, and third channels of the multi-channel two-dimensional spectral correlation diagram are determined according to the following formula: In the formula, This indicates the standardized spectral correlation channel, i.e., the first channel; This indicates the first derivative spectrum correlation channel, i.e., the second channel; This indicates the second derivative spectrum correlation channel, i.e., the third channel; and These represent the normalized spectral sequence at the th... The and the first spectral values ​​at each sampling point; Represents the spectrum of the first derivative; This represents the spectrum of the second derivative.

[0010] Preferably, the spectral association attention module is used to adjust the weights of the corresponding scale encoded spectral association features transmitted through the skip connection structure according to the bottleneck spectral semantic features or the corresponding scale decoding features, so as to enhance the spectral segment association regions related to the place of origin and suppress irrelevant regions, thereby obtaining the enhanced spectral segment association features; the spectral association attention U-shaped classification network further includes a classification output head, which is used to generate classification output values ​​for each place of origin based on the enhanced spectral segment association features, and determine the place of origin of the Chinese medicinal material sample.

[0011] Preferably, the method for determining the origin category of the Chinese medicinal material sample by the classification output head includes the following steps: The classification output values ​​are converted into classification probabilities for each origin category using the Softmax function. The origin category with the highest classification probability is determined as the origin category of the Chinese medicinal material sample. The maximum classification probability, or the calibration probability corresponding to the determined origin category calculated by dividing each classification output value by the temperature parameter and then using the Softmax function, is determined as a confidence score. The accuracy of the origin category is calibrated by comparing the confidence score with a preset threshold. When the confidence score is lower than the preset threshold, manual verification or resampling is performed. When the confidence score is greater than or equal to the preset threshold, the origin category is output. The temperature calibration for classifying probability values ​​is determined according to the following formula: In the formula, Indicates the first Calibration probability for each origin category Indicates the first The classification output value corresponding to each origin category Indicates temperature parameter, This indicates the total number of origin categories.

[0012] Preferably, the method further includes training the spectral association attention U-shaped classification network, the training steps of which include: Obtain infrared spectral training samples of Chinese medicinal materials with place of origin labels; Perform the same spectral preprocessing as in step S2 on the infrared spectral training samples; Construct a two-dimensional spectral correlation conformation of the same form as in step S3; The two-dimensional spectral association conformation is input into the spectral association attention U-shaped classification network for training, and the trained spectral association attention U-shaped classification network is obtained to determine the spectral association features used to distinguish the origin of Chinese medicinal materials. In the training process of the spectral association attention U-shaped classification network, one of the following is used as the classification loss function: cross-entropy loss function, labeled smooth cross-entropy loss function, or focus loss function.

[0013] A system for identifying the origin of Chinese medicinal materials, comprising: The spectral acquisition module is used to acquire the one-dimensional infrared spectral sequence of the Chinese medicinal material sample to be identified; The spectral preprocessing module is used to perform spectral preprocessing on the one-dimensional infrared spectral sequence to obtain a standardized spectral sequence. The two-dimensional imaging module is used to construct a two-dimensional spectral-correlated image based on the standardized spectral sequence; The origin identification module is equipped with a trained spectral association attention U-shaped classification network, which is used to input the two-dimensional spectral association image into the trained spectral association attention U-shaped classification network, obtain spectral segment association features, and output the origin category of the Chinese medicinal material sample.

[0014] An electronic device includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the computer program to implement the method for identifying the origin of Chinese medicinal materials as described in any one of claims 1 to 7.

[0015] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for identifying the origin of Chinese medicinal materials as described in any one of claims 1 to 7.

[0016] Compared with the prior art, the method, system, electronic device and storage medium for identifying the origin of Chinese medicinal materials of the present invention have the following beneficial effects: This invention firstly suppresses random noise and sample scattering differences by preprocessing the original one-dimensional infrared spectrum through smoothing and standard normal transformation. Based on this, instead of directly using the one-dimensional sequence for classification, it constructs a two-dimensional spectral correlation conformation that explicitly characterizes the spectral band correlation between different wavenumber or wavelength points. This transforms subtle joint differences, which are difficult to capture, into a two-dimensional spatial structure pattern that is easy for deep networks to learn. Furthermore, this invention inputs this two-dimensional conformation into an attention-based U-shaped classification network specifically designed for spectral correlation features. This network utilizes an encoder-bottleneck-decoder structure and skipping... By connecting and fusing spectral band association features at different scales, and with the help of a spectral association attention module, the spectral band association regions that are strongly correlated with origin category discrimination are adaptively enhanced based on deep semantic features, while suppressing noise and interference regions unrelated to origin. Thus, through the overall technical path of "one-dimensional to two-dimensional explicit association modeling - attention U-shaped network weighted focusing", this invention can stably and accurately extract the spectral band association features that contribute most to origin identification from the preprocessed spectrum, thereby significantly improving the accuracy, robustness and interpretability of origin identification in complex scenarios such as highly similar origin samples and the presence of spectral perturbations. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the overall flowchart structure of the method in the embodiment of the present invention; Figure 2 This is a schematic diagram of the spectral association attention U-shaped classification network structure in an embodiment of the present invention; Figure 3 This is a schematic diagram of two-dimensional spectral correlation conformation in an embodiment of the present invention; Figure 4 This is a structural diagram of the spectral correlation attention module in an embodiment of the present invention; Figure 5 This is a schematic diagram illustrating the origin category and confidence level output in an embodiment of the present invention. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0019] Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of this invention.

[0020] Furthermore, the technical solutions of the various embodiments of the present invention can be combined with each other, but only if they are feasible for those skilled in the art. If the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.

[0021] Example 1 See Figure 1 As shown, in order to improve the characterization ability of weak spectral differences and spectral coupling relationships in the process of identifying the origin of Chinese medicinal materials, and to improve the accuracy, robustness, and interpretability of the identification of the origin of Chinese medicinal materials, this embodiment provides a method for identifying the origin of Chinese medicinal materials, including the following steps: S1: Obtain the one-dimensional infrared spectrum sequence of the Chinese medicinal material sample to be identified. The one-dimensional infrared spectrum sequence is the absorbance, reflectance or transmittance sequence arranged in order of wavenumber or wavelength.

[0022] For example, a Fourier transform infrared spectrometer, a near-infrared spectrometer, or other infrared spectral acquisition equipment can be used to acquire the spectra of the medicinal material samples to be identified, obtaining raw infrared spectral data. The raw infrared spectral data includes absorbance sequences, reflectance sequences, or transmittance sequences, with each sampling point corresponding to a wavenumber point or wavelength point. For the same batch of samples to be identified, the same resolution, number of scans, and wavenumber range can be maintained during acquisition to reduce the impact of differences in instrument acquisition parameters on subsequent identification results.

[0023] S2: Perform spectral preprocessing on the one-dimensional infrared spectrum sequence to obtain a standardized spectral sequence. Spectral preprocessing includes at least smoothing and standard normal variable transformation.

[0024] For example, after obtaining the one-dimensional infrared spectrum sequence, baseline correction is first performed on the spectral data to reduce the influence of background drift on the spectral peak shape. During baseline correction, non-characteristic absorption regions or low absorption variation regions in the infrared spectral sequence can be selected as baseline reference points. A polynomial fitting is used to obtain the baseline function $b(\lambda)$, and then the baseline-corrected spectral sequence is obtained according to the following formula:

[0025] in, Represents the original spectral sequence. This represents the baseline function obtained from the fit. This represents the spectral sequence after baseline correction. Baseline correction removes slow drift caused by instrument background, sample scattering, and environmental changes, making subsequent spectral correlation conformations more focused on spectral information related to differences in the origin of Chinese medicinal materials.

[0026] Then, the baseline-corrected spectral sequence is detrended. During detrending, the following steps can be performed: Perform linear or low-order polynomial trend fitting to obtain the trend function. Then, the detrended spectral sequence is obtained according to the following formula:

[0027] in, This represents the detrended spectral sequence. Detrending weakens the irrelevant global trend that varies continuously with wavenumber or wavelength, preventing it from forming large-area irrelevant correlation responses in the two-dimensional spectral correlation matrix.

[0028] Next, Savitzky-Golay smoothing is used to reduce random noise. Specifically, the sliding window length and polynomial order are set, and local polynomial fitting is performed on the spectral points within each sliding window. The fitted value at the center point of the window is then used to replace the original spectral value. This process can reduce noise fluctuations while preserving the spectral peak shape and spectral band variation trend, which is beneficial for subsequent calculations of the first and second derivative spectra.

[0029] Finally, the spectral sequences were standardized using a standard normal transformation to eliminate the influence of sample granularity, scattering differences, and overall intensity differences on the origin identification results. The standard normal transformation can be performed as follows:

[0030] in, Indicates the 1st spectral sequence after smoothing. spectral values ​​at each sampling point This represents the mean of the spectral sequence. This represents the standard deviation of the spectral sequence. This represents the standardized spectral values. By transforming the standard normal variable, the influence of sample granularity, scattering differences, and overall intensity differences on the origin identification results can be eliminated, making the two-dimensional spectral correlation conformations between different samples comparable.

[0031] Optionally, when wavenumber axis offsets exist in data collected from different instruments or batches, wavenumber axis alignment can be performed on the spectra. During wavenumber axis alignment, a reference spectrum or standard peak position is selected as the alignment benchmark. The characteristic peak positions of the spectrum to be processed are matched with the alignment benchmark to determine the offset, and the spectral sequence is corrected through interpolation or translation. Thus, different samples have corresponding spectral values ​​at the same wavenumber or wavelength position.

[0032] Optionally, when there are water vapor interference bands, instrument edge noise bands, or bands with low signal-to-noise ratios, abnormal bands are removed; when the spectral lengths of different samples are inconsistent, the spectral sequences are resampled to make them have a uniform length so as to construct a two-dimensional spectral correlation conformation with consistent size.

[0033] S3: Construct a two-dimensional spectral correlation conformation based on the normalized spectral sequence. The two-dimensional spectral correlation conformation is used to characterize the spectral segment correlation relationship between different wavenumber points or wavelength points. That is, the two-dimensional spectral correlation conformation includes a spectral segment correlation matrix constructed based on the normalized spectral sequence. The elements in the spectral segment correlation matrix are calculated by using correlation functions from the spectral values ​​at two different wavenumber points or wavelength points.

[0034] For example, constructing a spectral correlation matrix based on a standardized spectral sequence. The first in the matrix Line 1 Column elements Indicates the first The wavenumber point or wavelength point and the first The spectral correlation value between wavenumber points or wavelength points. This correlation value can be calculated using any one of the following correlation functions: product correlation function, difference correlation function, normalized correlation function, or kernel mapping function.

[0035] For example, a product-type correlation function can be represented as: in, This function is used to characterize the co-enhancement or co-de-enhancement relationship between normalized spectral values ​​at two sampling points. For synchronous variations in multiple spectral bands caused by different origins, this product-type correlation function can form a spatial response pattern that can be learned by a two-dimensional convolutional network.

[0036] For example, a differential association function can be represented as: in, Indicates the scale parameter. This function is used to characterize the similarity of spectral values ​​between two sampling points. The smaller the difference in spectral values ​​between the two sampling points, the larger the corresponding correlation value; conversely, the larger the difference, the smaller the corresponding correlation value. This function is useful for expressing the similarity structure between spectral bands.

[0037] For example, the normalized correlation function can be expressed as: in, To prevent constants with a denominator of zero, This is used to characterize the correlation between two sampling points on a normalized scale, thereby reducing the impact of differences in spectral intensity amplitude on the association expression.

[0038] Furthermore, to enhance the model's ability to represent local spectral variations and subtle signal differences, first-order and second-order derivative spectra can be calculated based on the normalized spectral sequence. The first-order derivative spectrum characterizes spectral variation trends, while the second-order derivative spectrum characterizes spectral shape curvature variations and subtle peak shape differences. The first-order and second-order derivative spectra can be obtained from the normalized spectral sequence through difference calculations, convolution derivative calculations, or Savitzky-Golay derivative calculations.

[0039] In a preferred embodiment, see Figure 3 As shown, the two-dimensional spectral correlation conformation is a multi-channel two-dimensional spectral correlation diagram, including a first channel, a second channel, and a third channel. The first channel is the normalized spectral correlation channel, used to characterize the overall intensity correlation between spectral segments; the second channel is the first derivative spectral correlation channel, used to characterize the correlation between the trends of spectral segment changes; and the third channel is the second derivative spectral correlation channel, used to characterize the correlation between spectral curvature and subtle peak shape differences. Each channel satisfies the following relationships:

[0040] In the formula, This indicates the standardized spectral correlation channel, i.e., the first channel; This indicates the first derivative spectrum correlation channel, i.e., the second channel; This indicates the second derivative spectrum correlation channel, i.e., the third channel; Represents the spectrum of the first derivative. This represents the spectrum of the second derivative.

[0041] The above method can convert a one-dimensional infrared spectral sequence into a two-dimensional spectral correlation graph suitable for processing by a two-dimensional convolutional neural network, enabling the model to simultaneously utilize local spectral shape information, global spectral segment correlation information, and derivative spectral detail information.

[0042] S4: Input the two-dimensional spectral association conformation into the spectral association attention U-shaped classification network to extract spectral association features used to distinguish the origin of Chinese medicinal materials.

[0043] For example, see Figure 2As shown, the spectral association attention U-shaped classification network includes an encoder, a bottleneck feature layer, a decoder, a skip connection structure, a spectral association attention module, and a classification output head. The encoder performs progressive convolutional encoding on the two-dimensional spectral association conformation to extract shallow local spectral association features and deep spectral semantic features. The bottleneck feature layer performs semantic compression and feature aggregation on the highest-level features output by the encoder to form deep spectral semantic features that guide attention weighting. The skip connection structure transmits the shallow spectral association features output by the encoder at each scale to the feature fusion position of the corresponding scale in the decoder. The decoder upsamples the deep spectral semantic features output by the bottleneck feature layer and fuses them with the corresponding-scale shallow spectral association features transmitted by the skip connection structure. The spectral association attention module adjusts the weights of the shallow spectral association features transmitted by the encoder via the skip connection structure based on the deep spectral semantic features output by the bottleneck feature layer or the upsampled deep features from the decoder. This enhances spectral association regions related to the origin category and suppresses spectral association regions unrelated to the origin category, thus obtaining enhanced spectral association features. The classification output head outputs the classification output value corresponding to the origin category based on the enhanced spectral association features.

[0044] For example, the encoder includes multiple residual convolutional blocks, each containing at least two sets of convolution, normalization, and activation operations, and fusing input features with convolutional output features through short-circuit connections. Residual convolutional blocks can reduce the vanishing gradient problem as the network deepens and preserve subtle differences in the spectrum during transmission through deeper layers. When the number of input channels and output channels of a residual convolutional block are inconsistent, channel dimension matching of the input features can be achieved through 1×1 convolutions.

[0045] For example, the spectral association attention module is positioned at the bottleneck feature layer and / or the skip connection feature fusion location to adjust the weights of the shallow spectral association features transmitted by the encoder via the skip connection structure based on the deep spectral semantic features. The shallow spectral association features refer to the feature maps obtained by the encoder after convolutional extraction of the two-dimensional spectral association conformation at the corresponding scale, which include local spectral segment association textures, local peak shape differences, and local channel response information. The deep spectral semantic features refer to the feature maps output by the bottleneck feature layer or higher layers of the decoder, which contain global spectral segment combination relationships related to origin category discrimination.

[0046] See Figure 4As shown, the spectral association attention module includes a gated branch and a weighted branch. The gated branch maps deep spectral semantic features and corresponding shallow spectral association features to the same feature space, and generates an attention weight map using a Sigmoid activation function, a Softmax activation function, or a normalization function. The weighted branch uses the attention weight map to weight the shallow spectral association features pixel-wise, channel-wise, or region-wise, obtaining weighted shallow spectral association features. The generated attention weights are used to enhance spectral segment association regions related to the origin category and suppress spectral segment association regions unrelated to the origin category. Therefore, the network can pay more attention to the key spectral segment combinations that contribute to origin identification, thereby improving the accuracy of origin recognition.

[0047] For example, the classification output head includes one or more of the following: a global average pooling layer, a global max pooling layer, a feature concatenation layer, a fully connected layer, and a Dropout layer. The global average pooling layer is used to extract overall spectral correlation distribution features, and the global max pooling layer is used to extract significant spectral correlation response features. These two layers can be concatenated and then input into the fully connected layer for classification. The Dropout layer is used to reduce the risk of model overfitting and improve the model's generalization ability.

[0048] S5: Output the origin category of Chinese medicinal material samples based on spectral segment association features.

[0049] For example, the classification output head of the spectral association attention U-shaped classification network can output the classification probability corresponding to each candidate origin category, and take the category with the highest classification probability (i.e., the maximum classification probability) as the origin category of the Chinese medicinal material sample to be identified.

[0050] Optional, see Figure 5 As shown, the program outputs both the origin category and a confidence score. The confidence score can be the maximum classification probability or the classification probability value after temperature calibration. Temperature calibration can be performed to calibrate the classification probability as follows:

[0051] in, Indicates the first Calibration probability for each origin category Indicates the first The classification output value corresponding to each origin category Indicates temperature parameter, This indicates the total number of origin categories. By outputting the origin categories and confidence scores, it provides a reference for the reliability of results in practical testing scenarios. When the confidence score is lower than a preset threshold, it can prompt for manual review or resampling and testing, thereby improving the reliability in practical applications.

[0052] Example 2 This embodiment further illustrates the training of the spectral association attention U-shaped classification network.

[0053] First, training samples of Chinese medicinal herbs with place-of-origin labels were obtained. The training samples included multiple samples of Chinese medicinal herbs from different origins, each with a corresponding place-of-origin label. Each training sample corresponded to a one-dimensional infrared spectral sequence.

[0054] Then, the infrared spectral training samples are subjected to the same spectral preprocessing as in Example 1, including baseline correction, detrending, smoothing, standard normal variable transformation, and optional outlier band removal, wavenumber axis alignment and resampling, to obtain a standardized spectral sequence.

[0055] Next, a two-dimensional spectral correlation conformation of the same form as in Example 1 is constructed based on the standardized spectral sequence. Optionally, the two-dimensional spectral correlation conformation is a multi-channel two-dimensional spectral correlation diagram, including a standardized spectral correlation channel, a first-derivative spectral correlation channel, and a second-derivative spectral correlation channel.

[0056] Next, the two-dimensional spectral association conformation is input into the spectral association attention U-shaped classification network for training. During training, one of the following can be used as the classification loss function: cross-entropy loss function, labeled smoothed cross-entropy loss function, or focus loss function.

[0057] For example, when using a labeled smooth cross-entropy loss function, its expression is: in, Indicates the number of training samples. Indicates the total number of origin categories. Indicates the first The sample was predicted as the first... The probability of each origin category This represents the true label after label smoothing. If the... The true category of each sample is ,but:

[0058] in, This represents the label smoothing coefficient. Since the infrared spectra of medicinal herbs from different origins may differ only slightly, the model is prone to overconfidence in similar samples in the training set. Label smoothing reduces the model's overfitting to a single label and improves the generalization ability of the spectral association attention U-shaped classification network on highly similar origin samples.

[0059] During training, the Adam, AdamW, SGD, or RMSProp optimizers can be used for parameter updates. For example, when using the AdamW optimizer for parameter updates, the network parameters are first adjusted according to the loss function. Calculate gradient :

[0060] Then update the first-order moment estimates respectively. and second-order moment estimation : Again and Perform deviation correction: Finally, update the parameters as follows: in, Indicates the learning rate. This represents the weight decay coefficient. This represents a constant used to prevent the denominator from being zero. and These represent the decay coefficients of the first and second moments, respectively. The AdamW optimizer can balance adaptive learning rate updates and weight decay regularization during training, reducing model overfitting.

[0061] Furthermore, during training, one or more of the following strategies can be employed to suppress overfitting: Dropout, early stopping, or learning rate scheduling. For example, when using early stopping, training samples with origin labels are divided into a training set and a validation set. After each training round, the validation set loss or validation set accuracy is calculated. When the validation set loss no longer decreases within a preset number of rounds, or the validation set accuracy no longer improves within a preset number of rounds, training is stopped, and the network parameters corresponding to the optimal validation performance are saved. This process avoids the model overfitting to local noise and batch features in the training set, thereby improving the stability of actual origin identification.

[0062] Furthermore, to improve the model's adaptability to noise and drift in real-world detection scenarios, spectral enhancement processing can be applied to the infrared spectral training samples during training. Spectral enhancement processing includes one or more of the following: adding Gaussian noise, simulating baseline drift, random wavenumber shift, random intensity scaling, or local spectral band masking. Through spectral enhancement processing, spectral perturbations from different instruments, batches, and acquisition environments can be simulated, enabling the spectral association attention U-shaped classification network to learn more robust spectral band association features to irrelevant perturbations.

[0063] After training, model parameters for identifying the origin of Chinese medicinal materials are obtained based on the training results. These model parameters are then deployed in the origin identification system to identify the origin of the Chinese medicinal material samples to be identified.

[0064] Example 3 This embodiment also provides a system for identifying the origin of Chinese medicinal materials. The system includes a spectrum acquisition module, a spectrum preprocessing module, a two-dimensional conformation module, and an origin identification module.

[0065] The spectral acquisition module is used to acquire the one-dimensional infrared spectral sequence of the Chinese medicinal material sample to be identified. The one-dimensional infrared spectral sequence can be an absorbance sequence, a reflectance sequence, or a transmittance sequence.

[0066] The spectral preprocessing module is used to preprocess the one-dimensional infrared spectral sequence to obtain a standardized spectral sequence. Spectral preprocessing includes at least smoothing and standard normal variable transformation, and may further include one or more of the following: baseline correction, detrending, outlier removal, wavenumber axis alignment, and resampling.

[0067] The two-dimensional conformation module is used to construct a two-dimensional spectral correlation conformation based on a normalized spectral sequence. Optionally, the two-dimensional conformation module includes a derivative spectrum generation unit and a multi-channel stitching unit. The derivative spectrum generation unit is used to generate the first-order derivative spectrum and / or the second-order derivative spectrum, and the multi-channel stitching unit is used to stitch the normalized spectral correlation channel, the first derivative spectrum correlation channel, and / or the second derivative spectrum correlation channel into a multi-channel two-dimensional spectral correlation map.

[0068] The origin identification module is used to input the two-dimensional spectral association conformation into the spectral association attention U-shaped classification network, extract spectral segment association features, and output the origin category of the Chinese medicinal material sample. Optionally, the origin identification module includes a residual coding unit, a bottleneck feature unit, a decoding fusion unit, a spectral association attention unit, and a classification output unit. The spectral association attention unit is positioned between the shallow spectral association features output by the residual coding unit and the deep spectral semantic features output by the bottleneck feature unit or the decoding fusion unit. It is used to generate attention weights based on the deep spectral semantic features and perform weighted fusion of the shallow spectral association features.

[0069] Furthermore, the system also includes a confidence calibration module. The confidence calibration module is used to calibrate the classification probability output by the origin identification module using temperature, and outputs the calibrated confidence score.

[0070] This embodiment also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, it implements the method for identifying the origin of Chinese medicinal materials in the above embodiment.

[0071] For example, an electronic device may include an infrared spectral data receiving interface, a processor, an internal bus, memory, and non-volatile memory. The processor reads the corresponding computer program from the non-volatile memory into the memory and runs it to perform steps such as spectral preprocessing, two-dimensional spectral association conformation construction, spectral association attention U-shaped classification network inference, and origin category output.

[0072] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the method for identifying the origin of Chinese medicinal materials in the above embodiment.

[0073] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A method for identifying the origin of Chinese medicinal materials, characterized in that, Includes the following steps: The one-dimensional infrared spectrum sequence of the Chinese medicinal material sample to be identified is obtained and the spectrum is preprocessed into a standardized spectral sequence; a two-dimensional spectral correlation conformation is constructed based on the standardized spectral sequence to characterize the spectral band correlation relationship between different wavenumber points or wavelength points; The two-dimensional spectral association conformation is input into the trained spectral association attention U-shaped classification network to obtain spectral segment association features used to distinguish the origin of Chinese medicinal materials. The origin category of the Chinese medicinal material sample is determined based on the spectral band correlation features; The trained spectral association attention U-shaped classification network includes an encoder for progressively convolutionally encoding the two-dimensional spectral association conformation to output multiple encoded spectral association features at different scales; a bottleneck feature layer for selecting the deepest encoded spectral association feature from the multiple encoded spectral association features at different scales as the highest-level encoded feature, performing semantic compression and feature aggregation to obtain bottleneck spectral semantic features; a decoder connected to the encoder via a skip connection structure to progressively upsample the bottleneck spectral semantic features and fuse them with the encoded spectral association features at the corresponding scale to form corresponding-scale decoded features; and a spectral association attention module for adjusting the weights of the encoded spectral association features at different scales based on the bottleneck spectral semantic features and the corresponding-scale decoded features to obtain spectral association features used to distinguish the origins of Chinese medicinal materials.

2. The method for identifying the origin of Chinese medicinal materials according to claim 1, characterized in that, The spectral preprocessing includes one or more of the following: baseline correction, detrending, outlier removal, wavenumber axis alignment, and resampling. Baseline correction removes background drift components from the one-dimensional infrared spectral sequence; detrending weakens the overall trend caused by instrument response or sample state; outlier removal eliminates outlier bands from the one-dimensional infrared spectral sequence; wavenumber axis alignment ensures that the spectral peaks in the one-dimensional infrared spectral sequences of different samples are aligned to a uniform wavenumber or wavelength coordinate system; and resampling ensures that the one-dimensional infrared spectral sequences of different samples have the same length.

3. The method for identifying the origin of Chinese medicinal materials according to claim 1, characterized in that, The two-dimensional spectral correlation image is a multi-channel two-dimensional spectral correlation map. The multi-channel two-dimensional spectral correlation map includes at least a first channel constructed based on the normalized spectral sequence, a second channel constructed based on the first derivative spectrum, and / or a third channel constructed based on the second derivative spectrum. The first channel is used to characterize the overall intensity correlation of the normalized spectrum between different wavenumber points or wavelength points. The second channel is used to characterize the trend correlation of the first derivative spectrum between different wavenumber points or wavelength points. The third channel is used to characterize the spectral curvature and subtle signal difference correlation of the second derivative spectrum between different wavenumber points or wavelength points.

4. The method for identifying the origin of Chinese medicinal materials according to claim 3, characterized in that, The first, second, and third channels of the multi-channel two-dimensional spectral correlation diagram are determined according to the following formulas: In the formula, This indicates the standardized spectral correlation channel, i.e., the first channel; This indicates the first derivative spectrum correlation channel, i.e., the second channel; This indicates the second derivative spectrum correlation channel, i.e., the third channel; and These represent the normalized spectral sequence at the th... The and the first spectral values ​​at each sampling point; Represents the spectrum of the first derivative; This represents the spectrum of the second derivative.

5. The method for identifying the origin of Chinese medicinal materials according to claim 1, characterized in that, The spectral association attention module is used to adjust the weights of the corresponding scale encoded spectral association features transmitted through the skip connection structure according to the bottleneck spectral semantic features or the corresponding scale decoding features, so as to enhance the spectral segment association region related to the place of origin and suppress irrelevant regions, and obtain the enhanced spectral segment association features. The spectral association attention U-shaped classification network also includes a classification output head, which is used to generate classification output values ​​for each origin category based on the enhanced spectral association features, and to determine the origin category of the Chinese medicinal material sample.

6. The method for identifying the origin of Chinese medicinal materials according to claim 5, characterized in that, Determining the origin category of the Chinese medicinal material samples includes the following steps: The classification output values ​​are converted into classification probabilities for each origin category using the Softmax function. The origin category with the highest classification probability is determined as the origin category of the Chinese medicinal material sample. The maximum classification probability, or the calibration probability corresponding to the determined origin category calculated by dividing each classification output value by the temperature parameter and then using the Softmax function, is determined as a confidence score. The accuracy of the origin category is calibrated by comparing the confidence score with a preset threshold. When the confidence score is lower than the preset threshold, manual verification or resampling is performed. When the confidence score is greater than or equal to the preset threshold, the origin category is output. The temperature calibration for classifying probability values ​​is determined according to the following formula: In the formula, Indicates the first Calibration probability for each origin category Indicates the first The classification output value corresponding to each origin category Indicates temperature parameter, This indicates the total number of origin categories.

7. The method for identifying the origin of Chinese medicinal materials according to claim 5, characterized in that, It also includes training the spectral association attention U-shaped classification network, the training steps of which include: Obtain infrared spectral training samples of Chinese medicinal materials with place of origin labels; Perform the same spectral preprocessing as in step S2 on the infrared spectral training samples; Construct a two-dimensional spectral correlation conformation of the same form as in step S3; The two-dimensional spectral association conformation is input into the spectral association attention U-shaped classification network for training, and the trained spectral association attention U-shaped classification network is obtained to determine the spectral association features used to distinguish the origin of Chinese medicinal materials. In the training process of the spectral association attention U-shaped classification network, one of the following is used as the classification loss function: cross-entropy loss function, labeled smooth cross-entropy loss function, or focus loss function.

8. A system for identifying the origin of Chinese medicinal materials, characterized in that, include: The spectral acquisition module is used to acquire the one-dimensional infrared spectral sequence of the Chinese medicinal material sample to be identified; The spectral preprocessing module is used to perform spectral preprocessing on the one-dimensional infrared spectral sequence to obtain a standardized spectral sequence. The two-dimensional imaging module is used to construct a two-dimensional spectral-correlated image based on the standardized spectral sequence; The origin identification module is equipped with a trained spectral association attention U-shaped classification network, which is used to input the two-dimensional spectral association image into the trained spectral association attention U-shaped classification network, obtain spectral segment association features, and output the origin category of the Chinese medicinal material sample.

9. An electronic device comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, characterized in that, When the processor executes the computer program, it implements the method for identifying the origin of Chinese medicinal materials as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for identifying the origin of Chinese medicinal materials as described in any one of claims 1 to 7.