Near infrared spectrum and deep learning-based lossless identification method for producing areas and cultivation types of licorice
By constructing a GL-MDFNet model and employing multi-path parallel spectral preprocessing and adaptive weight adjustment mechanisms, the problems of sample destructiveness and insufficient model generalization ability in existing methods for identifying the origin and quality of licorice are solved, achieving rapid, non-destructive, and high-precision identification of the origin and cultivation type of licorice.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HENAN UNIVERSITY OF TECHNOLOGY
- Filing Date
- 2026-02-10
- Publication Date
- 2026-05-15
AI Technical Summary
Existing methods for identifying the origin and quality of licorice are highly destructive to samples, have long testing cycles, are highly dependent on operation, and are sensitive to data distribution with insufficient generalization ability, making it impossible to achieve rapid and non-destructive accurate identification of multiple origins and cultivation types.
A licorice multidimensional feature network (GL-MDFNet) model was constructed. Multi-path parallel spectral preprocessing and multi-scale feature extraction were adopted, combined with an adaptive weight adjustment mechanism, to perform non-destructive identification of licorice origin and cultivation type using near-infrared spectral data.
It enables rapid, non-destructive, and high-precision classification of licorice origin and cultivation type, improves the stability and generalization ability of the model, and avoids the complex chemical processing and sample damage of traditional methods.
Smart Images

Figure CN122049522A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of quality traceability and intelligent detection of Chinese medicinal materials, and in particular to a non-destructive identification method for the origin and cultivation type of licorice. Background Technology
[0002] Licorice (Glycyrrhiza spp.) is a representative variety of traditional Chinese medicine and food-medicine homology resource. It has multiple effects such as harmonizing various medicines, anti-inflammatory and antiviral. Its efficacy and application value are determined by the content and ratio of active ingredients such as glycyrrhizic acid and flavonoids. These components are significantly affected by the ecological environment and cultivation methods of the place of origin. Therefore, the identification of the place of origin and cultivation type of licorice is the key to quality control and traceability. Currently, existing technologies in the field of licorice origin and quality identification mainly fall into three categories: first, physicochemical detection methods, such as high-performance liquid chromatography (HPLC) and gas chromatography-mass spectrometry (GC-MS), which analyze the chemical components of licorice samples after chemical pretreatment to achieve qualitative and quantitative identification; second, molecular biology methods, such as SSR molecular markers and DNA barcoding technology, which identify species based on the genetic information of licorice; and third, near-infrared spectroscopy (NIR) correlation analysis technology, which uses the absorption characteristics of near-infrared light to indirectly reflect the information of organic compounds in licorice, combined with traditional chemometric methods such as partial least squares discriminant analysis (PLS-DA) and linear discriminant analysis (LDA). With the development of machine learning and deep learning technologies, some studies have attempted to apply neural network models to near-infrared spectroscopy analysis to enhance the ability to model nonlinear relationships.
[0003] However, existing technologies have many shortcomings in practical applications: physicochemical detection methods require complex sample pretreatment processes, have long detection cycles, consume large amounts of organic solvents, and are destructive to samples, failing to meet the needs of large-scale, rapid, and on-site detection, while also being highly dependent on the operator's technical skills; molecular biology methods can only reflect the genetic information of licorice, making it difficult to reflect the influence of exogenous factors such as growth environment and cultivation methods on chemical composition, and thus unable to achieve quality evaluation and functional difference identification; although near-infrared spectroscopy has the advantages of being fast and non-destructive, the spectral data suffers from high dimensionality, severe redundancy, and significant nonlinear characteristics. Traditional chemometric methods rely on manual experience to select preprocessing methods and the number of features, and the models are sensitive to data distribution, with insufficient generalization ability and stability. The inventors have discovered that existing neural network models, when extracting spectral features, fail to fully explore multi-dimensional feature information and lack dynamic evaluation and adaptive adjustment mechanisms for the discriminative contribution of each feature. They are easily interfered with by redundant features and invalid information, resulting in limited performance in complex classification scenarios involving multiple production areas and cultivation types of licorice, and thus failing to achieve accurate identification. Summary of the Invention
[0004] To address the technical problem of insufficient classification accuracy in existing methods for identifying the origin and quality of licorice due to the failure to fully exploit multidimensional features and susceptibility to interference from redundant features and invalid information, this invention proposes a non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning. A non-destructive identification model for licorice origin and cultivation type, Glycyrrhiza Multi-dimensional Feature Network (GL-MDFNet), is constructed. In the implementation process, multi-path parallel spectral preprocessing is performed. Simultaneously, the overall model structure design adopts a modeling mechanism combining multi-path parallelism, multi-scale feature extraction, multi-dimensional feature fusion, and adaptive weight adjustment to adapt to the characteristics of high dimensionality, strong variable correlation, and significant nonlinear features of near-infrared spectral data. This improves the discriminative performance and model stability in the task of identifying licorice origin and its corresponding cultivation method, achieving rapid, non-destructive, and high-precision classification of licorice sample origin and its corresponding cultivation type without destroying the sample or undergoing complex chemical treatments.
[0005] To achieve the above objectives, the technical solution of the present invention is implemented as follows:
[0006] A non-destructive method for identifying the origin and cultivation type of licorice based on near-infrared spectroscopy and deep learning includes the following steps:
[0007] S1: The reflectance spectral data of licorice samples are collected by a near-infrared spectrometer. After the spectral data is organized and standardized, a spectral tensor dataset that can be processed by a deep model is constructed.
[0008] S2: At least wavelet denoising, multivariate scattering correction and baseline correction are used to process the training set in the spectral tensor dataset in parallel to obtain the enhanced training set;
[0009] S3: Construct a non-destructive identification model for licorice origin and cultivation type. The non-destructive identification model adopts a multi-branch parallel convolutional structure combined with an adaptive weight adjustment mechanism based on feature response to perform non-destructive identification of licorice origin and cultivation type.
[0010] S4: Use the enhanced training set to train the non-destructive recognition model of licorice origin and cultivation type to obtain the trained non-destructive recognition model of licorice origin and cultivation type.
[0011] S5: Obtain the near-infrared spectral data of the licorice to be classified, and perform tissue and standardization processing. Use the trained non-destructive identification model of licorice origin and cultivation type to perform non-destructive identification of the origin and cultivation type of the standardized licorice to be classified.
[0012] Furthermore, before organizing and standardizing the spectral data, the following steps are also included:
[0013] Limited spectral intensity range If an abnormal jump or saturation point occurs, it will be discarded.
[0014] For spectral sequences Calculate the first-order difference If it exists The situation is then judged as an abnormal spectrum. For all first-order differences The standard deviation of the constituent sequences;
[0015] Using Mahalanobis distance to identify outlier samples , Represents Mahalanobis distance, Let be the mean vector of all spectral signals. Let be the covariance matrix of all spectral signals, when Remove abnormal samples in time. This represents the 99th percentile of the chi-square distribution.
[0016] Furthermore, the spectral data is organized and standardized, including representing the near-infrared spectrum of each licorice sample as a one-dimensional spectral signal arranged in wavelength order, aligning all spectral data with wavelength axes, unifying data length, and standardizing data format, and constructing the standardized one-dimensional spectral signal into an input tensor form that can be processed by the depth model.
[0017] Furthermore, the non-destructive identification model for licorice origin and cultivation type includes:
[0018] The multi-scale convolution feature extraction module is used to take the spectral tensor of the near-infrared spectrum of licorice as input and output multi-scale initial convolution features through convolution operation of multi-path differential convolution kernels.
[0019] The first feature concatenation layer is used to take multi-scale initial convolutional features as input and output multi-scale shallow comprehensive features through feature dimension concatenation method;
[0020] The feature response-based adaptive weight adjustment module is used to take the first multi-scale spliced features as input and output weighted optimized features through feature response analysis and dynamic weight allocation methods.
[0021] The multi-scale deep feature extraction module is used to take weighted optimized features as input and output multi-dimensional deep enhanced features through multi-path deep convolution operations;
[0022] The second feature concatenation layer is used to take multi-dimensional deep enhancement features as input and output multi-scale deep comprehensive features through feature dimension concatenation method;
[0023] The feature compression module is used to take multi-scale deep integrated features as input, and output compressed features through pooling dimensionality reduction operation;
[0024] The classification output layer takes compressed features as input and outputs the classification results of licorice origin and cultivation type through flattening, fully connected mapping and the Softmax function.
[0025] Furthermore, the multi-scale convolutional feature extraction module includes at least three one-dimensional convolutional paths, with different kernel sizes corresponding to different one-dimensional convolutional paths;
[0026] The scale-based deep feature extraction module includes at least three one-dimensional convolutional paths, with different kernel sizes corresponding to different one-dimensional convolutional paths.
[0027] Furthermore, the method for outputting multi-scale initial convolutional features through convolution operations using multi-path differentiated convolutional kernels is as follows:
[0028] The first convolutional kernel size is One-dimensional convolution is used to process the spectral tensor of the near-infrared spectrum of licorice, and then one-dimensional pooling is used to reduce the feature dimension to 1 / 3 of the original, thereby obtaining shallow, fine-grained spectral features corresponding to the local features of the core components of licorice. , For batches, The number of feature channels, The sequence length;
[0029] The first convolutional kernel size is One-dimensional convolution is used to process the spectral tensor of the near-infrared spectrum of licorice, and then one-dimensional pooling is used to reduce the feature dimension to 1 / 3 of the original, thereby obtaining the shallow band correlation features between various components of licorice. ;
[0030] The first convolutional kernel size is One-dimensional convolution is used to process the spectral tensor of the near-infrared spectrum of licorice to obtain shallow global spectral features that characterize the overall spectral trend and broad peak structure. .
[0031] Furthermore, the method for outputting weighted optimization features through feature response analysis and dynamic weight allocation is as follows:
[0032] Channel-level statistical analysis was performed on the multi-scale shallow integrated features to calculate the eigenvalue of each feature channel. ;
[0033] Adaptive weight coefficients are generated through a trainable mapping based on the feature response value of each feature channel. ;
[0034] Adaptive weight coefficients The weighted optimized features are obtained by multiplying the multi-scale shallow integrated features element by element.
[0035] Furthermore, the eigenresponse value of each characteristic channel is calculated. The method is as follows:
[0036] ;
[0037] in, For the first The response values of each feature channel, The first of the multi-scale shallow integrated features The first channel The feature values at each position, where L is the number of features.
[0038] Furthermore, based on the feature response value of each feature channel, adaptive weight coefficients are generated through a trainable mapping. ,include:
[0039] ;
[0040] in, For adaptive weight matrix, C is the number of feature channels. Indicates the first Adaptive weight coefficients for each feature channel It is the Sigmoid activation function. ReLU represents the nonlinear activation function. For the dimension reduction mapping matrix, Let be the dimension-upgrading mapping matrix, and r be the compression ratio.
[0041] Furthermore, through multi-path deep convolution operations, multi-dimensional deep enhancement features are output, including:
[0042] The second convolution kernel size is One-dimensional convolution is used to process the weighted optimized features to obtain deep, fine-grained features of local absorption peaks of licorice active ingredients. ;
[0043] The second convolution kernel size is One-dimensional convolution is used to process the weighted optimization features to obtain deep band correlation features among the components of licorice. ;
[0044] The second convolution kernel size is One-dimensional convolution is used to process the weighted optimized features to obtain deep global spectral features that characterize the overall spectral trend and broad peak structure. .
[0045] The beneficial effects of this invention are as follows:
[0046] Data acquisition using near-infrared spectroscopy (NIR) eliminates the need for chemical treatments such as crushing and extraction of licorice samples, preserving their morphology. Each detection takes only seconds, completely overcoming the limitations of traditional physicochemical testing methods, which are complex, time-consuming, and prone to sample damage. By introducing various spectral preprocessing techniques such as wavelet denoising, multivariate scattering correction, and baseline correction, and employing a multi-path parallel approach for feature enhancement, non-chemical interference caused by random noise, scattering effects, and baseline drift in the near-infrared spectrum can be suppressed from multiple angles. Furthermore, an adaptive weighting module based on feature response assesses and reconstructs the importance of the multi-scale fused features, further weakening redundant or less discriminative features and highlighting key spectral response regions closely related to the differences in the chemical composition of licorice, thereby improving the overall effectiveness of spectral feature expression and data quality.
[0047] The GL-MDFNet model introduces a multi-branch parallel feature extraction structure after the input layer. Each branch receives spectral data or feature vectors from different spectral preprocessing paths and extracts features from the near-infrared spectral signal using convolutional kernel sizes and layer combinations at different scales within its respective branch. This multi-path parallel structure design allows the model to simultaneously capture both local absorption variations and overall trend features of the spectral data at different scales during the same modeling process, thus avoiding the problem of feature information omission or insufficient representation that can easily occur when processing complex spectral patterns using existing single convolutional paths.
[0048] This invention incorporates a multi-scale feature splicing and fusion mechanism into the model structure, integrating high-dimensional features from multiple convolutional branches along the feature dimension to construct a comprehensive feature representation containing multi-source and multi-scale information. Compared to existing methods that rely solely on single spectral preprocessing results or a single feature space for modeling, this multi-dimensional feature fusion strategy can fully exploit the complementary relationships between different spectral preprocessing results and features at different scales, providing a more comprehensive spectral information foundation for subsequent discriminative modeling.
[0049] After completing the multi-scale feature stitching, this invention further introduces an adaptive weight adjustment module based on feature response after the feature fusion layer to enhance the discrimination of the fused multi-channel spectral features. This module analyzes the response intensity of different feature channels and spectral positions, dynamically assesses the relative importance of each feature in the current sample discrimination process, and generates corresponding adaptive weights to adjust the input features accordingly. In this way, the model can suppress redundant or low-contribution features while maintaining the feature dimension and network structure, and strengthen key spectral response regions highly correlated with the discrimination of licorice origin and cultivation methods. Compared with existing fixed fusion or direct stitching feature modeling methods, this adaptive weight adjustment mechanism enables the model to automatically adjust the feature contribution based on the spectral response characteristics of different samples, thereby improving the model's stability and generalization ability under complex spectral conditions. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 This is a flowchart of the non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to the present invention.
[0052] Figure 2 This is a schematic diagram of the GL-MDFNet model structure of the present invention.
[0053] Figure 3 (a) is the model confusion matrix of the present invention, and (b) is the GL-MDFNet model confusion matrix based on the Kennard-Stone (KS) algorithm for data partitioning. Detailed Implementation
[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0055] A non-destructive method for identifying the origin and cultivation type of licorice based on near-infrared spectroscopy and deep learning, such as Figure 1 As shown, the steps are as follows:
[0056] S1: The reflectance spectral data of licorice samples are collected by a near-infrared spectrometer. After the spectral data is organized and standardized, a spectral tensor dataset that can be processed by a deep model is constructed.
[0057] In this embodiment of the application, the reflectance spectral data of licorice samples are collected using a near-infrared spectrometer, including:
[0058] To systematically characterize the differences in chemical composition and internal structure of licorice samples from different origins and under different cultivation methods, licorice samples from three major licorice distribution areas—Gansu, Inner Mongolia, and Xinjiang—were selected. Furthermore, cultivated and wild licorice were distinguished to cover the differences in chemical composition caused by different ecological environments, growth conditions, and cultivation methods. This ensured the representativeness and completeness of the data from both the sample source and growth method dimensions. Each production area included both cultivated and wild licorice samples, resulting in six classification labels, denoted as Y∈{1,2,3,4,5,6}. To ensure the statistical stability of the model training, each category contained no fewer than 150 samples, with a total sample size of no fewer than 900.
[0059] All samples were uniformly processed into standard slices with a thickness of 2–3 mm, ensuring a smooth surface, no obvious breakage, and no water stains or contamination. Before spectral acquisition, the samples were placed in an environment with a temperature of 25±2℃ and a relative humidity of 50±5% for 48 hours to allow the moisture content of the samples to reach a dynamic equilibrium state, thereby reducing the interference of moisture differences on the near-infrared absorption band.
[0060] Subsequently, Fourier transform near-infrared spectroscopy (FT-NIR) was used to scan each licorice sample. The spectral acquisition wavelength range was 900–2500 nm, the resolution was 4 cm⁻¹, the number of scans was 32 and the cumulative average was 1557, the light source was a stable halogen tungsten lamp, the detector was an InGaAs detector, and the sampling mode was diffuse reflectance. The specific scanning procedure was as follows: the instrument was powered on and preheated for 30 minutes to ensure the stability of the light source; background scanning was performed; the background was rescanned every 30 minutes; each sample was rotated 120° and scanned 3 times; the average of the three scan spectra was taken as the final spectral data. The 900–2500 nm band covers the overtone and combination frequency absorption regions of C–H, O–H, and N–H chemical bond vibrations in organic compounds, which are closely related to the changes in the main active components of licorice, such as glycyrrhizic acid, flavonoids, and polysaccharides. The entire spectral acquisition process does not require sample crushing, extraction, or chemical treatment, and does not damage the sample morphology, making it suitable for rapid detection and green analysis scenarios. The spectral data obtained in this step contains both chemical composition and physical structure information, providing a reliable raw data foundation for subsequent models to distinguish licorice samples from different origins and cultivation methods.
[0061] In this embodiment, the spectral data is organized and standardized to construct a spectral tensor dataset that can be processed by deep models. This achieves an effective connection between experimental measurement data and the input structure of deep neural networks, providing a unified entry point for subsequent end-to-end modeling, including:
[0062] First, the near-infrared spectra of each licorice sample were represented as a one-dimensional spectral signal arranged in order of wavelength from smallest to largest. Its form can be expressed as:
[0063] ;
[0064] in, This indicates that the i-th licorice sample is in the i-th... The reflection intensity value at each wavelength point, L=1557 represents the number of spectral sampling points.
[0065] Furthermore, to ensure data quality, a spectral quality control mechanism is set up. First, the spectral intensity range is limited. If abnormal jumps or saturation points are observed, they are discarded. Next, the spectral sequence is... Calculate the first-order difference If it exists The situation is then judged as an abnormal spectrum. For all first-order differences The standard deviation of the constituent sequences reflects the fluctuation level of spectral intensity changes under normal conditions. Furthermore, Mahalanobis distance is used to identify anomalous samples. , Represents Mahalanobis distance, Let be the mean vector of all spectral signals. Let be the covariance matrix of all spectral signals, when Remove abnormal samples in time. This represents the 99th percentile of the chi-square distribution.
[0066] Furthermore, to eliminate potential data format differences between different samples during the acquisition process, all spectral data were uniformly organized and standardized, including wavelength axis alignment, data length uniformity, and Z-score standardization. This ensured that the spectral data of each sample were consistent in dimension and order, eliminating the dimensional inconsistency caused by differences in instrument acquisition accuracy or storage methods. After this process, the spectral data of different licorice samples achieved strict uniformity in wavelength dimension and numerical structure, enabling each spectrum to be represented as a one-dimensional continuous numerical vector with consistent dimensions.
[0067] Furthermore, after standardizing the spectral data, a hierarchical random partitioning strategy was adopted to divide the data into training, validation, and test sets in a ratio of 7:2:1, thus constructing the one-dimensional spectral signal into an input tensor form that can be processed by the deep model.
[0068] ;
[0069] in, The first dimension represents the number of samples, the second dimension 1 represents the single-channel spectral input, and the third dimension... Indicates the wavelength dimension.
[0070] S2: Wavelet denoising, multivariate scattering correction (MSC), and baseline correction are used to process the training set in the spectral tensor dataset in parallel to obtain the enhanced training set.
[0071] In this embodiment, the training set is processed in parallel using wavelet denoising, multivariate scattering correction (MSC), and baseline correction, while the validation set is not processed. This ensures the independence of the validation set, avoids data leakage, and guarantees the authenticity and reliability of the model evaluation results. The training set is represented as follows: .
[0072] The one-dimensional spectral tensor from the training set is synchronously input into multiple independent spectral preprocessing branches to construct a multi-path parallel spectral preprocessing and feature enhancement framework. Each spectral preprocessing branch performs targeted signal correction and enhancement operations for non-chemical interference factors from different sources in the near-infrared spectrum.
[0073] In one of the preprocessing branches, wavelet denoising is used to decompose the spectral signal into multiple scales. By weakening or reconstructing the signal components in the high-frequency scale that are mainly caused by random noise and environmental disturbances, the random fluctuation amplitude of the spectral curve is significantly reduced without changing the position and shape of the main absorption peaks, making the overall spectrum smoother and the characteristic peaks clearer.
[0074] Specifically, one path is the wavelet denoising branch.
[0075] First, the spectrum is decomposed using discrete wavelet transform:
[0076] ;
[0077] in, The approximation coefficients for the Jth layer are... Let be the detail coefficient of the j-th layer.
[0078] Furthermore, a soft thresholding process is applied to the detail coefficients:
[0079] ;
[0080] in, For the processed level j detail coefficients, For sign function, soft threshold , This represents the standard deviation of noise.
[0081] The denoised spectrum is reconstructed using the processed detail coefficients and approximation coefficients. .
[0082] In another preprocessing branch, a multivariate scattering correction method is adopted. By establishing a linear regression relationship between the sample spectrum and the reference spectrum, the multiplicative scattering and additive shift caused by factors such as uneven sample particle size, surface roughness differences, and optical path changes are compensated. This reduces the amplitude changes caused by differences in physical structure between different samples, making the spectral intensity changes more realistically reflect the differences in the internal chemical composition of the sample.
[0083] Specifically, the second path is the multivariate scattering correction branch.
[0084] First, define the reference spectrum:
[0085] ;
[0086] in, The average reference spectrum for all samples, Let be the original spectrum of the i-th sample.
[0087] Furthermore, a linear regression model is established:
[0088] ;
[0089] in, Let be the slope of the i-th sample relative to the reference spectrum. Let be the intercept of the i-th sample relative to the reference spectrum.
[0090] Furthermore, after scattering correction, we obtain:
[0091] ;
[0092] After multivariate scattering correction, the spectrum is denoted as .
[0093] In the third preprocessing branch, baseline correction is performed on the spectral signal. By fitting and removing baseline offset components caused by instrument drift, background absorption, or changes in light source stability, the spectral curve returns to a unified benchmark in the overall trend, effectively suppressing the interference of low-frequency drift on model learning.
[0094] Specifically, the third path is the baseline correction branch.
[0095] First, a second-order polynomial is used to fit the baseline:
[0096] ;
[0097] in, The baseline function is the fitted function. For wavelength variables, , , These are the fitting coefficients for the second-order polynomial.
[0098] Furthermore, the corrected spectrum is:
[0099] ;
[0100] After baseline correction, the spectrum is denoted as .
[0101] The final three-path outputs constitute a multi-source enhanced spectrum set. After three-path enhancement, the stacked structures form a tensor. , where 3 represents the number of enhanced channels.
[0102] Through the above multi-path parallel preprocessing operations, the original near-infrared spectrum of licorice is transformed into multiple sets of enhanced spectra with different focuses in terms of noise level, scattering effect and baseline state. The spectral data is transformed from the original measurement signal into a set of one-dimensional spectral tensors with consistent structure but different feature focuses, providing a stable and rich input source for subsequent multi-branch feature extraction and feature complementary fusion.
[0103] S3: Construct a non-destructive identification model for licorice origin and cultivation type. The non-destructive identification model adopts a multi-branch parallel convolutional structure combined with an adaptive weight adjustment mechanism based on feature response to perform non-destructive identification of licorice origin and cultivation type.
[0104] In this embodiment, the non-destructive identification model for licorice origin and cultivation type includes: a multi-scale convolutional feature extraction module, a first feature splicing layer, an adaptive weight adjustment module based on feature response, a multi-scale deep feature extraction module, a second feature splicing layer, a feature compression module, and a classification output layer, as follows: Figure 2 As shown.
[0105] The multi-scale convolution feature extraction module is used to take the spectral tensor of the near-infrared spectrum of licorice as input and output multi-scale initial convolution features through convolution operation of multi-path differentiated convolution kernels.
[0106] Specifically, through convolution operations using multi-path differentiated convolution kernels, multi-scale initial convolutional features are output, including:
[0107] Using a convolution kernel size of A one-dimensional convolution with a stride of 1 is used to perform fine-grained feature extraction of local absorption peaks of licorice active ingredients from the spectral tensor of the near-infrared spectrum. Combined with a one-dimensional pooling operation, the feature dimension is reduced to 1 / 3 of the original, retaining key features, reducing computational burden, and obtaining shallow fine-grained spectral features corresponding to the local features of core components such as glycyrrhizic acid and glycyrrhizin. , For batches, The number of feature channels, The sequence length is given.
[0108] Using a convolution kernel size of A one-dimensional convolution with a stride of 1 is used to extract the band correlation features of multiple components in the near-infrared spectrum of licorice using the spectral tensor. This is combined with a kernel size of... One-dimensional pooling with a stride of 3 reduces the feature dimension to one-third of its original size, retaining key features, reducing computational burden, and obtaining shallow band correlation features between licorice polysaccharides and flavonoids. .
[0109] Using a convolution kernel size of One-dimensional convolution with a stride of 1 is used to extract global trend features of the overall chemical composition of licorice from the spectral tensor of the near-infrared spectrum, obtaining shallow global spectral features to characterize the overall spectral trend and broad peak structure. .
[0110] The first feature concatenation layer is used to take multi-scale initial convolutional features as input and output multi-scale shallow comprehensive features through a feature dimension concatenation method. This process fully preserves feature information at different scales, constructing a multi-scale comprehensive spectral feature space to provide sufficient input for subsequent weight adjustment. The stitching operation, while maintaining spectral order consistency, connects the feature maps output from different branches along the feature channel dimension, thereby constructing a comprehensive feature tensor that simultaneously contains information from multiple preprocessing paths and multi-scale convolutional features. Through this multi-dimensional feature fusion, the spectral information emphasized by different preprocessing strategies and the structural features captured by different convolutional scales coexist in the same feature space, enabling the model to simultaneously utilize local detail information and overall trend information for joint discrimination. After this fusion, the feature representation formed within the model remains stable and controllable in dimensional structure, while its information density and discriminative potential are significantly improved.
[0111] The adaptive weight adjustment module based on feature response is used to take the first multi-scale spliced features as input and output weighted optimized features through feature response analysis and dynamic weight allocation methods.
[0112] Specifically, through feature response analysis and dynamic weight allocation methods, weighted optimized features are output, highlighting key discriminative features and suppressing redundant information. This significantly improves feature discrimination ability and model stability without changing the network structure, including:
[0113] First, the multi-scale shallow integrated features Perform channel-level statistical analysis to calculate the average activation intensity of each feature channel as the feature response value:
[0114] ;
[0115] in, For the first The response values of each feature channel, For the first The first channel The feature values at each position, where L is the number of features and the sequence length.
[0116] Furthermore, based on the feature response vector composed of feature response values Adaptive weight coefficients are generated through trainable mapping:
[0117] ;
[0118] in, Adaptive weight matrix, Indicates the first Adaptive weight coefficients for each feature channel It is the Sigmoid activation function. For the dimension reduction mapping matrix, Let r be the dimension-up mapping matrix, and r be the compression ratio. In this embodiment, r is set to 4. Specifically, it represents the nonlinear activation function ReLU.
[0119] Furthermore, the adaptive weight coefficients are multiplied element-wise with the multi-scale shallow integrated features to achieve feature recalibration, resulting in weighted optimized features. :
[0120] ;
[0121] in, Indicates the first The weighted optimization features of each channel have tensor shapes that remain consistent with the input, and only the feature values are adaptively adjusted.
[0122] This module dynamically evaluates the relative contribution of different features to the task of distinguishing licorice origin and cultivation type by analyzing the activation response intensity of each feature channel in the fused features under the current sample conditions. The module first performs global feature statistics on the fused features to obtain the overall response level of each feature channel, and generates corresponding weight coefficients accordingly. These weights are then applied to the original fused features to adaptively adjust the importance of feature channels. Feature channels that contribute significantly to classification are given increased weight, thus occupying a higher proportion in subsequent calculations; while feature channels with low contribution or information redundancy are appropriately suppressed. After this weight adjustment, the numerical distribution and discrimination center of the fused features are optimized while maintaining the original tensor structure and dimensionality, thereby significantly improving the relevance and effectiveness of feature representation.
[0123] The multi-scale deep feature extraction module is used to take weighted optimized features as input and output multi-dimensional deep enhanced features through multi-path deep convolution operations.
[0124] Specifically, through multi-path deep convolution operations, multi-dimensional deep enhancement features are output, including:
[0125] Weighting enhances the characteristic signals of core components such as glycyrrhizic acid and glycyrrhizin. A convolution kernel size of [size missing] is used. One-dimensional convolution pairs for weighted feature optimization A deep-layer refinement extraction process was performed on the local absorption peaks of licorice active ingredients to obtain the deep-layer fine-grained characteristics of these peaks. ;
[0126] Leveraging the weighted and enhanced component correlation signals, a convolution kernel size of [size missing] is employed. One-dimensional convolution pairs for weighted feature optimization Deep mining of band correlation patterns among multiple components of licorice was performed to obtain deep band correlation features among various components of licorice. .
[0127] Using a convolution kernel size of One-dimensional convolution pairs for weighted feature optimization Deep capture operations were performed on the overall chemical composition of licorice to obtain deep global spectral features for characterizing the overall spectral trend and broad peak structure. .
[0128] The second feature concatenation layer is used to take multi-dimensional deep enhancement features as input and output multi-scale deep comprehensive features through feature dimension concatenation methods. .
[0129] The feature compression module is used to synthesize multi-scale deep features. As input, pooling dimensionality reduction operation is used to output compressed features. One-dimensional pooling operations are used to synthesize multi-scale deep features. Compression is performed, reducing the feature dimension to 1 / 3 of the original, to obtain compressed features. By downsampling multi-scale deep integrated features through one-dimensional pooling operations, the model's robustness to local noise disturbances and individual sample differences is improved while reducing redundant information and computational complexity.
[0130] The classification output layer is used to take compressed features as input and output the classification results of licorice origin and cultivation type through flattening, fully connected mapping and Softmax function.
[0131] Specifically, regarding compression features Perform a flattening operation, The multidimensional tensor structure is flattened into a two-dimensional feature matrix, eliminating the spatial structure of the channel and wavelength dimensions, and obtaining the feature vectors. Subsequently, the fully connected layer maps the high-dimensional feature space to the category space through linear transformation. The layer has 6 neurons, corresponding to the 6 categories of licorice: Gansu cultivated, Gansu wild, Inner Mongolia cultivated, Inner Mongolia wild, Xinjiang cultivated, and Xinjiang wild. This achieves a non-linear mapping from the feature space to the category space, transforming complex spectral features into discriminative vectors that clearly indicate the origin and cultivation type of licorice samples. Then, the Softmax function is used to transform the 6 category log-probability vectors into 6-dimensional category probability vectors. The model finally outputs the probability value corresponding to each category, realizing the automatic classification of the origin and cultivation type of licorice samples.
[0132] S4: Use the enhanced training set to train the non-destructive recognition model of licorice origin and cultivation type to obtain the trained non-destructive recognition model of licorice origin and cultivation type.
[0133] In this embodiment, the model training process is performed in a GPU computing environment, employing an end-to-end supervised learning approach. All trainable parameters in the network are jointly optimized by minimizing the classification loss function, including convolutional layer parameters, fully connected layer parameters, and parameter matrices W1 and W2 in the adaptive weight adjustment module. The recognition task of this invention is a six-class classification problem (Gansu cultivated, Gansu wild, Inner Mongolia cultivated, Inner Mongolia wild, Xinjiang cultivated, Xinjiang wild). Therefore, the categorical cross-entropy loss function is used as the optimization objective function, and its mathematical expression is:
[0134] ;
[0135] Where N represents the batch sample size. This represents the true label of the i-th sample in the k-th class (using one-hot encoding, 1 if it belongs to the class, 0 otherwise). 6 represents the predicted probability that the i-th sample belongs to the k-th class, and 6 represents the number of classes.
[0136] The cross-entropy loss function is chosen because it effectively measures the difference between the predicted probability distribution and the true distribution, making it suitable for multi-class classification problems. Furthermore, when combined with the Softmax function, it exhibits good gradient propagation properties, which is beneficial for stable training of deep networks. Model parameter optimization employs the Adam optimization algorithm. Adam, through its adaptive adjustment mechanism of first-order moment estimation and second-order moment estimation, improves training stability while ensuring convergence speed, making it particularly suitable for multi-branch deep convolutional network structures. Its parameters are set as follows: initial learning rate α = 0.001, first-order moment estimation decay rate β1 = 0.9, second-order moment estimation decay rate β2 = 0.999, and numerical stability constant ε = 1 × 10⁻⁻⁴. 8 To avoid oscillations in the later stages of training and improve convergence accuracy, an adaptive learning rate decay strategy is adopted. When the validation set accuracy does not improve within 10 consecutive epochs, the learning rate is adjusted to 0.5 times its original value. The batch size is set to 32, taking into account factors such as the wavelength range of the spectral data (900–2500 nm), the large feature length, the multi-branch structure, and the large parameter scale of the weight adjustment module. This setting achieves a good balance between GPU memory usage and gradient estimation stability. The maximum number of training epochs is set to 150, and an EarlyStopping mechanism is introduced. Training is automatically terminated when the validation set loss does not decrease within 20 consecutive epochs to prevent overfitting and improve generalization ability. To further enhance the model's generalization performance, a Dropout layer is added before the fully connected layer, with a Dropout ratio set to 0.5. An L2 regularization term is also introduced during optimization, and the weight decay coefficient λ is set to 1×10⁻⁻⁶. 4 The total loss function with regularization is expressed as:
[0137] ;
[0138] Where θ represents all trainable parameters.
[0139] For network parameter initialization, both convolutional and fully connected layers use the He normal initialization method: ,in The initialization method, which determines the number of input neurons, is suitable for ReLU-type activation functions, helping to alleviate the vanishing or exploding gradient problem and ensuring that deep networks maintain stable gradient propagation characteristics in the early stages of training. Through the collaborative design of the loss function setting, optimization algorithm selection, learning rate control mechanism, batch size configuration, regularization strategy, and weight initialization method, the lossless identification model for licorice origin and cultivation type described in this invention is ensured to possess good convergence stability, discriminative ability, and generalization performance during training.
[0140] After model construction and training, the model's classification performance was systematically evaluated using metrics such as confusion matrix, classification accuracy, precision, recall, and area under the receiver operating characteristic (AUC). Multiple repeated experiments were conducted on the dataset using different sample partitioning methods to verify the model's stability and generalization ability. The confusion matrix is shown below. Figure 3 As shown in the figure, the horizontal axis represents the model's predicted category, and the vertical axis represents the sample's true category. Labels 1–6 correspond to licorice samples from Gansu cultivated, Inner Mongolia cultivated, Xinjiang cultivated, Gansu wild, Inner Mongolia wild, and Xinjiang wild, respectively. The confusion matrix results show that all categories of samples were accurately identified by the GL-MDFNet model, with the classification accuracy corresponding to the diagonal line reaching 100%, showing no misclassification or missed classification. This indicates that the proposed technical solution has extremely strong discriminative ability in identifying licorice samples from different origins and cultivation types. Furthermore, the dataset was partitioned using different sample partitioning methods (including KS partitioning and stratified sampling), and the GL-MDFNet model was retrained and tested. The classification results remained highly consistent, indicating that the method of this invention is insensitive to sample partitioning methods, and the GL-MDFNet model has good stability and generalization ability, providing a reliable technical foundation for licorice quality detection and intelligent origin traceability.
[0141] S5: Obtain the near-infrared spectral data of the licorice to be classified, and perform tissue and standardization processing. Use the trained non-destructive identification model of licorice origin and cultivation type to perform non-destructive identification of the origin and cultivation type of the standardized licorice to be classified.
[0142] The GL-MDFNet model proposed in this invention systematically integrates multi-path spectral preprocessing results, multi-branch convolutional feature extraction, and adaptive weight adjustment mechanisms to achieve multi-dimensional collaborative enhancement of spectral data from preprocessing and feature extraction to discriminative modeling stages. Through multi-scale parallel modeling and feature stitching mechanisms, it improves the model's ability to capture nonlinear and weakly discriminative features in near-infrared spectra. By introducing an adaptive weight adjustment module based on feature response, the model can dynamically adjust feature contributions according to the spectral characteristics of different samples, enhancing discriminative ability without altering the feature structure. While maintaining the modularity and scalability of the model structure, it reduces reliance on manual experience in selecting a single preprocessing method and a single model structure, improving the automation and generalization performance of the modeling process. Using licorice near-infrared spectral data as input and the place of origin and its corresponding cultivation methods as output, a dedicated discriminative model suitable for practical quality control and origin traceability scenarios is constructed.
[0143] Through the synergistic effect of the above structural design and adaptive weight adjustment mechanism, the GL-MDFNet model can achieve high-precision and stable identification of licorice origin and cultivation methods under complex near-infrared spectral conditions, providing core modeling support for the implementation of the overall technical solution of this invention.
[0144] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A non-destructive method for identifying the origin and cultivation type of licorice based on near-infrared spectroscopy and deep learning, characterized in that, Including the following steps: S1: The reflectance spectral data of licorice samples are collected by a near-infrared spectrometer. After the spectral data is organized and standardized, a spectral tensor dataset that can be processed by a deep model is constructed. S2: At least wavelet denoising, multivariate scattering correction and baseline correction are used to process the training set in the spectral tensor dataset in parallel to obtain the enhanced training set; S3: Construct a non-destructive identification model for licorice origin and cultivation type. The non-destructive identification model adopts a multi-branch parallel convolutional structure combined with an adaptive weight adjustment mechanism based on feature response to perform non-destructive identification of licorice origin and cultivation type. S4: Use the enhanced training set to train the non-destructive recognition model of licorice origin and cultivation type to obtain the trained non-destructive recognition model of licorice origin and cultivation type. S5: Obtain the near-infrared spectral data of the licorice to be classified, and perform tissue and standardization processing. Use the trained non-destructive identification model of licorice origin and cultivation type to perform non-destructive identification of the origin and cultivation type of the standardized licorice to be classified.
2. The non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to claim 1, characterized in that, Before organizing and standardizing the spectral data, the following steps are also included: Limited spectral intensity range If an abnormal jump or saturation point occurs, it will be discarded. For spectral sequences Calculate the first-order difference If it exists The situation is then judged as an abnormal spectrum. For all first-order differences The standard deviation of the constituent sequences; Using Mahalanobis distance to identify outlier samples , Represents Mahalanobis distance, Let be the mean vector of all spectral signals. Let be the covariance matrix of all spectral signals, when Remove abnormal samples in time. This represents the 99th percentile of the chi-square distribution.
3. The non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to claim 2, characterized in that, The spectral data is organized and standardized, including representing the near-infrared spectrum of each licorice sample as a one-dimensional spectral signal arranged in wavelength order, aligning all spectral data with wavelength axes, unifying data length, and standardizing data format, and constructing the standardized one-dimensional spectral signal into an input tensor form that can be processed by the depth model.
4. The non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to any one of claims 1-3, characterized in that, The non-destructive identification model for licorice origin and cultivation type includes: The multi-scale convolution feature extraction module is used to take the spectral tensor of the near-infrared spectrum of licorice as input and output multi-scale initial convolution features through convolution operation of multi-path differential convolution kernels. The first feature concatenation layer is used to take multi-scale initial convolutional features as input and output multi-scale shallow comprehensive features through feature dimension concatenation method; The feature response-based adaptive weight adjustment module is used to take the first multi-scale spliced features as input and output weighted optimized features through feature response analysis and dynamic weight allocation methods. The multi-scale deep feature extraction module is used to take weighted optimized features as input and output multi-dimensional deep enhanced features through multi-path deep convolution operations; The second feature concatenation layer is used to take multi-dimensional deep enhancement features as input and output multi-scale deep comprehensive features through feature dimension concatenation method; The feature compression module is used to take multi-scale deep integrated features as input, and output compressed features through pooling dimensionality reduction operation; The classification output layer takes compressed features as input and outputs the classification results of licorice origin and cultivation type through flattening, fully connected mapping and the Softmax function.
5. The non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to claim 4, characterized in that, The multi-scale convolutional feature extraction module includes at least three one-dimensional convolutional paths, and the convolutional kernel size is different for each one-dimensional convolutional path. The scale-based deep feature extraction module includes at least three one-dimensional convolutional paths, with different kernel sizes corresponding to different one-dimensional convolutional paths.
6. The non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to claim 5, characterized in that, The method for outputting multi-scale initial convolutional features through convolution operations using multi-path differential convolutional kernels is as follows: The first convolutional kernel size is One-dimensional convolution is used to process the spectral tensor of the near-infrared spectrum of licorice, and then one-dimensional pooling is used to reduce the feature dimension to 1 / 3 of the original, thereby obtaining shallow, fine-grained spectral features corresponding to the local features of the core components of licorice. , For batches, The number of feature channels, The sequence length; The first convolutional kernel size is One-dimensional convolution is used to process the spectral tensor of the near-infrared spectrum of licorice, and then one-dimensional pooling is used to reduce the feature dimension to 1 / 3 of the original, thereby obtaining the shallow band correlation features between various components of licorice. ; The first convolutional kernel size is One-dimensional convolution is used to process the spectral tensor of the near-infrared spectrum of licorice to obtain shallow global spectral features that characterize the overall spectral trend and broad peak structure. .
7. The non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to claim 6, characterized in that, The method for outputting weighted optimized features through feature response analysis and dynamic weight allocation is as follows: Channel-level statistical analysis was performed on the multi-scale shallow integrated features to calculate the eigenvalue of each feature channel. ; Adaptive weight coefficients are generated through a trainable mapping based on the feature response value of each feature channel. ; Adaptive weight coefficients The weighted optimized features are obtained by multiplying the multi-scale shallow integrated features element by element.
8. The non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to claim 7, characterized in that, Calculate the eigenresponse value for each feature channel. The method is as follows: ; in, For the first The response values of each feature channel, The first of the multi-scale shallow integrated features The first channel The feature values at each position, where L is the number of features.
9. The non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to claim 8, characterized in that, Adaptive weight coefficients are generated through a trainable mapping based on the feature response value of each feature channel. ,include: ; in, For adaptive weight matrix, C is the number of feature channels. Indicates the first Adaptive weight coefficients for each feature channel It is the Sigmoid activation function. ReLU represents the nonlinear activation function. For the dimension reduction mapping matrix, Let be the dimension-upgrading mapping matrix, and r be the compression ratio.
10. The non-destructive identification method for licorice origin and cultivation type based on near-infrared spectroscopy and deep learning according to claim 1, characterized in that, Through multi-path deep convolution operations, multi-dimensional deep enhancement features are output, including: The second convolution kernel size is One-dimensional convolution is used to process the weighted optimized features to obtain deep, fine-grained features of local absorption peaks of licorice active ingredients. ; The second convolution kernel size is One-dimensional convolution is used to process the weighted optimization features to obtain deep band correlation features among the components of licorice. ; The second convolution kernel size is One-dimensional convolution is used to process the weighted optimized features to obtain deep global spectral features that characterize the overall spectral trend and broad peak structure. .