Intelligent cordyceps sinensis powder identification method based on multi-modal spectrum analysis and deep learning
Through multimodal spectral analysis and deep learning methods, the spectral acquisition parameters are adaptively adjusted, and the deep learning model is combined to identify Cordyceps powder samples, which solves the problems of low recognition rate and high cost in traditional methods and achieves fast and accurate Cordyceps powder identification.
Patent Information
- Application Number
- CN202510712080.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-10-03
AI Technical Summary
Existing technologies make it difficult to quickly and accurately identify the authenticity and adulteration of Cordyceps powder. Traditional methods have complex sample pre-processing, long cycles, and high costs. The spectral analysis system cannot adapt to environmental changes, has a low recognition rate, and the addition of new varieties requires the reconstruction of the model.
Multimodal spectral analysis combined with deep learning methods were used to pre-scan Cordyceps powder samples, adaptively adjust spectral acquisition parameters, extract Cordyceps features through multimodal spectral scanning and deep learning models, and perform single-modal independent discrimination and multimodal weighted voting to identify sample categories and proportions.
The accuracy and refined identification capabilities of Cordyceps powder sample identification have been improved, and the category and adulteration ratio of Cordyceps powder can be identified quickly and accurately, reducing the cost of sample collection and model construction.
Smart Images

Figure CN120747579A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of edible and medicinal fungi detection, and more specifically, to an intelligent identification method for Cordyceps powder based on multimodal spectral analysis and deep learning. Background Art
[0002] There are many species of edible and medicinal fungi in the Cordyceps family, and different species not only have unique characteristics in morphology and ecological habits, but also in their edible and medicinal value. Precious medicinal materials such as Cordyceps sinensis are counterfeited or adulterated on the market. Traditional sensory identification methods require professional identification, but the characteristics are not obvious and difficult to judge. Traditional instrumental identification methods mainly rely on physical and chemical testing methods (HPLC, GC-MS), but sample pretreatment is complex, the cycle is long, and the cost is high. Molecular identification methods (DNA molecular labeling) are used, but DNA extraction is affected by the processing technology, the detection cycle is long, the cost is high, and a professional laboratory is required. Spectral identification methods (visible spectroscopy, near-infrared spectroscopy) can quickly distinguish medicinal materials, but existing spectral analysis systems have many problems, such as fixed calibration parameters that cannot adapt to different batches of samples and environmental changes; preset spectral acquisition parameters and poor handling of abnormal samples; limited information from a single spectral modality that cannot meet the needs of refined identification; traditional spectral analysis algorithms have a low recognition rate for adulterated samples; and the addition of new Cordyceps varieties requires the reconstruction of the entire model.
[0003] Therefore, it is necessary to study a better intelligent identification solution for Cordyceps powder. Summary of the Invention
[0004] In response to the technical problems existing in the prior art, the present invention provides an intelligent identification method for Cordyceps powder based on multimodal spectral analysis and deep learning, which improves the ability to process abnormal samples.
[0005] According to a first aspect of the present invention, a method for intelligently identifying Cordyceps powder based on multimodal spectral analysis and deep learning is provided, comprising:
[0006] S1, pre-scanning the Cordyceps powder sample and pre-judging the category of the Cordyceps powder sample according to the pre-scanning result;
[0007] S2, calling the corresponding scanning strategy according to the prediction result to perform multimodal spectral scanning on the Cordyceps powder sample to obtain multimodal spectral information;
[0008] S3, extracting Cordyceps features from the multimodal spectral information based on the deep learning model, performing single-modal independent discrimination and multimodal weighted voting on the Cordyceps features to identify the category and / or category ratio of the Cordyceps powder sample.
[0009] On the basis of the above technical solution, the present invention can also make the following improvements.
[0010] Optionally, before step S1, the cordyceps powder sample is pretreated, and the pretreatment includes:
[0011] The Cordyceps powder sample is subjected to standardized sieving to obtain a Cordyceps powder sample with a target particle size;
[0012] The sieved Cordyceps powder sample was compacted.
[0013] Optionally, step S1 includes:
[0014] S101, quickly scanning the Cordyceps powder sample at a low resolution to obtain a pre-scan spectrum, and calculating a first-order derivative spectrum S' of the pre-scan spectrum;
[0015] S102, extract multiple key wavelength points λ1, λ2, ..., λ in the first-order derivative spectrum S' k The response intensity at , k is a positive integer;
[0016] S103, calculate the sample characteristic vector P = {p1, p2, ..., p k};
[0017] S104, the sample characteristic vector P={p1,p2,…,p k}Match with the preset feature template library to determine the sample category prediction result.
[0018] Optionally, step S2 includes:
[0019] S201, select the corresponding spectral mode combination C = {c1, c2, ..., c n}, n is a positive integer, and the spectral modality combination includes near-infrared light and visible light;
[0020] S202, adaptively adjusting spectrum acquisition parameters according to the sample category prediction result and the sample characteristic vector P;
[0021] S203, based on the optimized spectrum acquisition parameters, activating the spectrum acquisition units corresponding to the respective modes in sequence according to the priority of the spectrum modes to perform multimodal spectrum scanning;
[0022] S204, adjusting the scanning times, scanning positions, and spectral modes according to the scanning results of step S203, to obtain multimodal spectral information of the Cordyceps powder sample.
[0023] Optionally, in step S201, selecting a suitable spectral modality combination according to the sample category prediction result includes:
[0024] The sample category is single-ingredient Cordyceps powder or suspected adulterated Cordyceps powder;
[0025] When the sample type prediction result is single-ingredient Cordyceps powder, near-infrared spectroscopy is used;
[0026] When the sample category prediction result is suspected adulterated Cordyceps powder, a combined spectrum of near-infrared light and visible light is used.
[0027] Optionally, step S202 includes:
[0028] According to the sample category prediction result, the basic parameter set B={b1,b2,…,b n1}, n1 is a positive integer;
[0029] According to the sample characteristic vector P, the parameter adjustment amount Δ={δ1,δ2,…,δ n1}, n1 is a positive integer;
[0030] According to the basic parameter set B and the parameter adjustment amount Δ, the optimized spectrum acquisition parameter set P is generated * =B+Δ.
[0031] Optionally, step S3 includes:
[0032] S301, extracting Cordyceps features corresponding to each mode in the multimodal spectral information based on the trained convolutional neural network model;
[0033] S302, performing reconstruction error analysis, adulteration feature band identification, and adulteration ratio estimation on the Cordyceps characteristics corresponding to each modality to obtain independent identification results for each modality;
[0034] S303: Perform weighted voting on the independent recognition results under each modality to determine the final result of the category recognition of the Cordyceps powder sample.
[0035] Optionally, step S301 includes:
[0036] Based on the trained convolutional neural network model, multiple scale features corresponding to each mode in the multimodal spectral information are extracted respectively;
[0037] Based on the spectral attention mechanism, the feature expression of key bands in different scale features is automatically identified and enhanced;
[0038] The features of different convolutional layers are fused through jump connections to obtain fused feature maps of different scale features under multiple single modalities.
[0039] Optionally, step S302 includes:
[0040] Reconstructing the normal sample spectrum, and identifying the abnormal sample based on the error between the reconstructed normal sample spectrum and the Cordyceps characteristics corresponding to a single modality;
[0041] Construct a spectral library S of pure samples, calculate the difference spectrum D between the abnormal sample to be tested and the pure sample, and apply wavelet transform to perform multi-scale analysis on the difference spectrum D to identify the bands with significant deviations; compare the identified bands with the characteristic library of known adulterants, and mark the adulteration characteristic bands;
[0042] A spectral linear mixing model M = γA + (1-γ)B was constructed, where A is the pure sample spectrum and B is the adulterated spectrum. The optimal mixing ratio γ was solved by the least squares method: min||M-(γA+(1-γ)B)||2, and the estimated adulteration ratio (1-γ) × 100% was output.
[0043] Traverse the Cordyceps features corresponding to each modality and obtain independent recognition results under each modality.
[0044] Optionally, self-learning calibration is also included, including:
[0045] Collect historical sample spectral data, environmental parameters, and discrimination results, and monitor the drift of key instrument parameters in real time. The key parameters include at least light source intensity, detector response, and light path transmittance.
[0046] The spectra of standard samples are collected regularly and compared with the standard spectra to calculate the drift vector D1={d1,d2,…,d n2}, n2 is a positive integer, d i ∈D1, where d i Represents the drift value of the i-th characteristic wavelength point in D1;
[0047] Establish the corresponding relationship model M between environmental parameters and drift vector: D1 = f(T,H,t), where T is temperature, H is humidity, and t is usage time;
[0048] Predicting the drift vector D1' in the current environment according to the correspondence model M, and calculating the compensation matrix C1 = I - D1', where I is the identity matrix;
[0049] Apply compensation to the newly acquired standard sample spectrum S: S' = S·C to update the instrument key parameters;
[0050] Define the sample feature vector set F'={F1',F2',…,F m1 '}, m1 is a positive integer, and the average distance D within the class is calculated based on the sample feature vector set F' intra =avg(dist(F i1 ',F j1 ')) and the minimum distance between classes D inter =min(dist(F i1 ',F k1')), where i1∈[1,m1], j1∈[1,m1], k1∈[1,m1], F i1 '∈F', F j1 '∈F', F k1 '∈F', F i1 ' and F j1 'Belong to the same category, F i1 ' and F k1 'belong to different categories;
[0051] Set the discrimination threshold T0 = αD intra +β(D inter -D intra ), where α and β are weight coefficients,
[0052] When new samples are added, the average distance D within the class is recalculated intra and the minimum distance D between classes inter , and update the discrimination threshold T0.
[0053] According to a second aspect of the present invention, there is provided a Cordyceps powder intelligent identification system based on multimodal spectral analysis and deep learning, comprising:
[0054] A pre-scanning module is used to pre-scan the Cordyceps powder sample and pre-judge the category of the Cordyceps powder sample based on the pre-scanning result;
[0055] A multimodal scanning module is used to call a corresponding scanning strategy according to the predicted results to perform multimodal spectral scanning on the Cordyceps powder sample to obtain multimodal spectral information;
[0056] The fusion discrimination module is used to extract Cordyceps features from multimodal spectral information based on a deep learning model, and perform single-modal independent discrimination and multimodal weighted voting on the Cordyceps features to identify the category and / or category ratio of the Cordyceps powder sample.
[0057] According to a third aspect of the present invention, an electronic device is provided, comprising a memory and a processor, wherein the processor is configured to implement the steps of the above-mentioned method for intelligent identification of Cordyceps powder based on multimodal spectral analysis and deep learning when executing a computer management program stored in the memory.
[0058] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer management program is stored. When the computer management program is executed by a processor, the steps of the above-mentioned method for intelligent identification of Cordyceps powder based on multimodal spectral analysis and deep learning are implemented.
[0059] The present invention provides a method, system, electronic device, and storage medium for intelligent identification of cordyceps powder based on multimodal spectral analysis and deep learning. The method pre-judges the category of the cordyceps powder sample based on the pre-scan results of the cordyceps powder sample, and then calls the corresponding scanning strategy for multimodal spectral scanning, thereby improving the accuracy of the multimodal spectral information of the sample. Multi-scale feature extraction of each modal spectrum is performed based on a deep learning model, and after independent discrimination of each modal feature, the final result is determined by weighted voting. In addition to including the category of the cordyceps powder sample, the recognition result also includes the corresponding proportion of the category, thereby improving the accuracy of cordyceps powder sample identification and meeting the needs of refined identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A flow chart of a method for intelligent identification of Cordyceps powder based on multimodal spectral analysis and deep learning provided by the present invention;
[0061] Figure 2 A schematic diagram of an application scenario provided by an embodiment of the present invention;
[0062] Figure 3 A schematic diagram showing the comparison of spectra that have been pre-processed and those that have not been pre-processed provided by an embodiment of the present invention;
[0063] Figure 4 A schematic diagram of the deep learning model network structure provided by an embodiment of the present invention;
[0064] Figure 5 A schematic diagram of the spectral characteristic distribution of a pure sample provided in an embodiment of the present invention;
[0065] Figure 6 This is a schematic diagram of the identification and verification effect of an embodiment of the present invention;
[0066] Figure 7 A block diagram of the functional modules of a Cordyceps powder intelligent identification system based on multimodal spectral analysis and deep learning provided by an embodiment of the present invention;
[0067] Figure 8 A schematic diagram of the hardware structure of a possible electronic device provided by the present invention;
[0068] Figure 9 A schematic diagram of the hardware structure of a possible computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION
[0069] The following embodiments of the present invention are described in further detail with reference to the accompanying drawings and examples. The following examples are used to illustrate the present invention but are not intended to limit the scope of the present invention.
[0070] Figure 1The present invention provides a flow chart of a method for intelligent identification of Cordyceps powder based on multimodal spectral analysis and deep learning, such as Figure 1 As shown, the method includes steps S1 to S3:
[0071] S1, pre-scanning the Cordyceps powder sample and pre-judging the category of the Cordyceps powder sample according to the pre-scanning result;
[0072] S2, calling the corresponding scanning strategy according to the prediction result to perform multimodal spectral scanning on the Cordyceps powder sample to obtain multimodal spectral information;
[0073] S3, extracting Cordyceps features from the multimodal spectral information based on the deep learning model, performing single-modal independent discrimination and multimodal weighted voting on the Cordyceps features to identify the category and / or category ratio of the Cordyceps powder sample.
[0074] It is understandable that based on the defects in the background technology, the embodiment of the present invention proposes a Cordyceps powder intelligent identification method based on multimodal spectral analysis and deep learning.
[0075] Figure 2 Shown Figure 1 A possible application scenario of the method, in which the system hardware involved includes: a light source, an optical system, a spectroscopic system, a detector and a computer system.
[0076] 1. A light source is used to emit light in the required wavelength range, preferably covering 400-2500 nm, including visible light (400-780 nm) and near-infrared light (780-2500 nm). The light source is directed at the sample to be tested, which is a processed Cordyceps powder sample that meets the test requirements. In one possible embodiment, a sample pretreatment unit can be used to process the sample before testing. The processing process includes:
[0077] The Cordyceps powder sample is subjected to standardized sieving to obtain a Cordyceps powder sample with a target particle size;
[0078] The Cordyceps powder sample obtained by screening is precisely compacted and can be used for testing.
[0079] It is worth noting that during the training stage of the deep learning model, it is also necessary to construct multiple pre-processed Cordyceps powder samples to form a sample pool.
[0080] 2. The optical system and spectroscopic system are used to collect light after passing through the sample to be tested, and after focusing, collimation, spectroscopic processing, etc., provide the collected light signal to the detector.
[0081] 3. A detector, associated with the multimodal spectrum acquisition unit, for acquiring near-infrared and visible spectra, for converting the detected optical signals into electrical signals and displaying them in the form of a spectrum graph in a computer system.
[0082] 4. A computer system equipped with an intelligent control system consisting of a high-performance embedded processor, a parameter storage module, and a control algorithm, as well as a deep learning data processing system equipped with a GPU-accelerated computing unit and a deep learning algorithm library to achieve intelligent recognition of multimodal spectral information. The computer system also includes output units such as a touch screen display and a data export interface for displaying and outputting multimodal spectral information recognition process data and recognition results.
[0083] Based on the above system hardware, the method for intelligent identification of cordyceps powder based on multimodal spectral analysis and deep learning provided by the embodiment of the present invention pre-scans the cordyceps powder sample to predict its category, and then uses the corresponding scanning strategy to perform multimodal spectral scanning, thereby improving the accuracy of the sample's multimodal spectral information. Based on the deep learning model, multi-scale feature extraction is performed on each modal spectrum. After independent discrimination of each modal feature, the final result is determined through weighted voting. The recognition result includes not only the category of the cordyceps powder sample, but also the corresponding proportion of the category, improving the accuracy of cordyceps powder sample identification and meeting the needs of refined identification.
[0084] In a possible embodiment, step S1 includes sub-steps S101 to S104:
[0085] S101, quickly scanning the Cordyceps powder sample at a low resolution to obtain a pre-scan spectrum, and calculating a first-order derivative spectrum S' of the pre-scan spectrum;
[0086] S102, extract multiple key wavelength points λ1, λ2, ..., λ in the first-order derivative spectrum S' k The response intensity at , k is a positive integer;
[0087] S103, calculate the sample characteristic vector P = {p1, p2, ..., p k}, k is a positive integer;
[0088] S104, the sample characteristic vector P={p1,p2,…,p k}Match with the preset feature template library to determine the sample category prediction result.
[0089] It is understood that this embodiment rapidly scans the sample at low resolution to obtain pre-judgment information before acquiring the standard spectrum. Specifically, the system evaluates sample characteristics based on the pre-scan results and adaptively adjusts the optimal spectrum acquisition parameters based on these characteristics to optimize the scanning strategy. For example, based on the sample pre-judgment results, the system automatically determines whether to increase the number of scans, change the scanning position, or adopt other spectral modalities. The system then selects the most appropriate spectral modality combination, which may include near-infrared (NIR) and visible light (UV).
[0090] In a possible embodiment, step S2 includes sub-steps S201 to S204.
[0091] S201, select the corresponding spectral mode combination C = {c1, c2, ..., c n}, n is a positive integer, and the spectral modality combination includes near-infrared light and visible light; the specific operation method includes:
[0092] The sample category in the sample category prediction result is single-ingredient Cordyceps powder or suspected adulterated Cordyceps powder;
[0093] When the sample type prediction result is single-ingredient Cordyceps powder, near-infrared spectroscopy is used for detection;
[0094] When the sample category prediction result is suspected adulterated Cordyceps powder, a combined spectrum of near-infrared light and visible light is used for detection.
[0095] S202, adaptively adjusting spectrum acquisition parameters according to the sample category prediction result and the sample characteristic vector P; specifically including:
[0096] According to the sample category prediction result, the basic parameter set B={b1,b2,…,b n1}, n1 is a positive integer;
[0097] According to the sample characteristic vector P, the parameter adjustment amount Δ={δ1,δ2,…,δ n1}, n1 is a positive integer;
[0098] According to the basic parameter set B and the parameter adjustment amount Δ, an optimized spectrum acquisition parameter set P*=B+Δ is generated.
[0099] S203, based on the optimized spectrum acquisition parameters, activate the spectrum acquisition units corresponding to each mode in turn according to the priority of the spectrum mode to perform multimodal spectrum scanning; here the priority is the spectrum mode combination C = {c1, c2, ..., c n}The priority of each spectral mode in.
[0100] S204, adjusting the scanning times, scanning positions, and spectral modes according to the scanning results of step S203, and finally obtaining multimodal spectral information of the Cordyceps powder sample.
[0101] The multimodal spectral information obtained in step S204 can be input into the deep learning model in step S3 for further processing.
[0102] like Figure 3 The figure shows the comparison of the spectrum obtained without the processing of step S2 and the multimodal spectrum obtained after the pre-scan processing of step S2. Figure 3 It can be seen that in the spectrum obtained after pre-scanning processing, the difference characteristics between different types of Cordyceps are more obvious, which is conducive to improving the accuracy of subsequent identification steps.
[0103] Since step S3 is based on the trained deep learning model for recognition, the deep learning model needs to be constructed and its training process needs to be completed before step S3.
[0104] like Figure 4 As shown, in an embodiment of the present invention, the deep learning model for extracting Cordyceps powder sample features and identifying them can be implemented using a convolutional neural network structure.
[0105] 1. Build a one-dimensional convolutional neural network structure to process spectral data. The deep network architecture includes:
[0106] (1) Input layer: receiving preprocessed multimodal spectral data S∈R n , R n represents an n-dimensional real vector space. In a certain implementation scenario, the received spectral data contains 2048 wavelength points;
[0107] (2) Encoder: includes a 3-layer fully connected network (for example, the number of neurons in each layer of the neural network changes as follows: 2048 → 1024 → 512 → 128);
[0108] Decoder: includes a 3-layer fully connected network (for example, the number of neurons in each layer changes as follows: 128 → 512 → 1024 → 2048);
[0109] Taking the encoder as an example, the encoder is composed of multiple one-dimensional convolutional layers (the first convolution block to the third convolution block) cascaded together. Each layer uses convolution kernels of different sizes to extract features of different scales. For example:
[0110] First convolutional block: 32 7×1 convolution kernels, ReLU function activation, batch normalization, and maximum pooling (2×1);
[0111] Second convolutional block: 64 5×1 convolution kernels, ReLU function activation, batch normalization, and maximum pooling (2×1);
[0112] The third convolutional block: 128 3×1 convolution kernels, ReLU function activation, batch normalization, and maximum pooling (2×1);
[0113] (3) Pooling layer: Use the maximum pooling operation to reduce the feature dimension;
[0114] (4) Attention layer: calculate the importance weight of each band;
[0115] (5) Fully connected layer: maps convolutional features to a low-dimensional representation space, including:
[0116] Fully connected layer 1: 512 neurons, ReLU function activation;
[0117] Fully connected layer 2: 128 neurons, ReLU function activation;
[0118] (6) Output layer: Use the Softmax function to output the probability distribution of sample categories, for example, including N neurons (N is the number of Cordyceps species), and the Softmax function is activated.
[0119] 2. Attention mechanism implementation: Introducing a spectral attention module to automatically identify and enhance the feature expression of key bands; for example:
[0120] (1) Global average pooling: Calculate the global response value of each band G = GAP(F) = {g1, g2, ..., g n}, where F is the convolution feature map, g1,g2,...,g n Represents the global response value of each band respectively. If i∈[1,n], let g i For g1, g2, ..., g n If any one of i Represents the average activation intensity of the i-th band in the entire feature map;
[0121] (2) Two-layer perceptron: Generates the attention weight vector A = softmax(W·G) = σ(W2·ReLU(W1·G)), where W is a learnable parameter, W1 is the first connection weight matrix, which is used to perform a linear transformation on the input G, ReLU is the activation function, W2 is the second connection weight matrix, which is used to perform another linear transformation on the output of the first hidden layer after ReLU activation, and σ is the Softmax activation function, which is used to map the result of (W2·ReLU(W1·G)) to the probability distribution range [0,1].
[0122] (3) Attention weighting: F A =F⊙A, apply the attention mechanism to the original feature map F.
[0123] 3. Multi-scale feature fusion: Combining features from different convolutional layers through skip connections enhances the model’s ability to perceive multi-scale spectral features.
[0124] 4. Training strategy:
[0125] Training objective: minimize the reconstruction error ||x-AE(x)|| 2 ; Abnormal judgment: reconstruction error e>μ e +3σ e , where μ e is the average reconstruction error of normal samples, σ e is the standard deviation;
[0126] Batch size: 32;
[0127] Optimizer: Adam, learning rate 0.001, weight decay 1e-5;
[0128] Learning rate scheduling: reduced to 0.1 every 50 epochs;
[0129] Early stopping strategy: Stop training if the validation set performance does not improve after 10 epochs.
[0130] Experimental verification shows that the network has an accuracy of 99.3% in the task of identifying five types of Cordyceps powder, which is 8.5 percentage points higher than the traditional PLS-DA method.
[0131] In order to expand the deep learning model to new Cordyceps categories without having to rebuild the deep learning model, a small sample learning technique can be used. The specific implementation method is as follows:
[0132] 1. Prototype network construction to construct the category prototype representation of Cordyceps spectral samples, including:
[0133] (1) constructing a feature extraction network f(·) based on a multi-layer one-dimensional convolutional network, for example, based on a four-layer one-dimensional convolutional network;
[0134] (2) For each Cordyceps category c, calculate its prototype vector pc = 1 / |Sc|·∑x∈Sc f(x) in the feature space, where f(x) is the feature extraction function;
[0135] (3) For the new sample x', calculate its Euclidean distance with each prototype d(f(x'),pc) = ||f(x)-pc||2;
[0136] (4) Based on the Euclidean distance calculated in (3), the category labels are assigned. The category prediction formula is: P(y=c|x)=exp(-d(f(x),pc)) / ∑c'exp(-d(f(x),pc')), where c' represents all possible category labels and pc' represents the prototype vector corresponding to category c'.
[0137] 2. Metric learning to learn the optimal distance metric in the spectral feature space, including:
[0138] (1) Design a parameterized distance function dφ(x,y)=||φ(x)-φ(y)||2, where φ is a mapping function that maps input data x or y to a new feature space, φ(x) is the feature vector of input data x after being mapped by the mapping function φ, and φ(y) is the feature vector of input data y after being mapped by the mapping function φ. For example, the designed parameterized distance function includes:
[0139] 1) Mahalanobis distance (taking into account feature correlation): dM(x,y) = (φ(x) - φ(y)) T M(φ(x)-φ(y)), used to measure the distance between data points x and y, which is convenient for dealing with the correlation problem between data points x and y;
[0140] 2) Cosine distance (angular similarity): dcos(x,y) = 1-(φ(x)·φ(y)) / (||φ(x)||×||φ(y)||), which measures the similarity between two vectors x and y by calculating the difference in their directions in space.
[0141] 3) Learnable bilinear distance: dW(x,y) = φ(x) T Wφ(y) is used to measure the distance between two virtual points (x and y) in two-dimensional space calculated by bilinear interpolation.
[0142] (2) Select samples (xa, xp, xn) from different categories;
[0143] Construct a triplet loss function: L = max(d(xa,xp) - d(xa,xn) + margin, 0), where L is the triplet loss value, xa is the anchor sample, representing the reference sample, xp is a positive sample that belongs to the same category or has the same attributes as the anchor sample xa, xn is a negative sample that belongs to a different category or has different attributes from the anchor sample xa, d(xa,xp) is the distance metric between the anchor sample xa and the positive sample xp, which is used to measure the similarity between the two in the feature space, d(xa,xn) is the distance metric between the anchor sample xa and the negative sample xn, and margin is a preset hyperparameter, called interval or margin; for example, the constructed triplet loss function includes:
[0144] 1). Weighted triplet loss function: L_weighted = Σwi × max(d(xa,xp)-d(xa,xn)+margin,0);
[0145] 2) Triplet loss function for hard sample mining: L_hard = max(max_p d(xa,xp)-min_n d(xa,xn)+margin,0);
[0146] 3) Soft boundary triplet loss function: L_soft = log(1+exp(d(xa,xp)-d(xa,xn)+margin));
[0147] 4) Multi-class triplet loss function: L_multi = Σc max(d(xa,xp)-d(xa,xnc)+marginc,0);
[0148] Based on the triplet loss function, stochastic gradient descent is used to optimize the parameters of the feature extraction network f(·).
[0149] 3. Data augmentation strategy: Generate synthetic samples through spectral transformation to expand the training set, including:
[0150] (1) Add random noise: x a '=x a +ε,ε~N(0,σ 2 ), where x a is the original data before adding noise, x a ' is the data after adding noise, ε is random noise, ε~N(0,σ 2 ) indicates that the random noise ε has a mean of 0 and a variance of σ 2 Normal distribution; for example, adding Gaussian noise at random wavelength points with a probability of 5%; adopting a sparse noise injection strategy: randomly selecting spectral wavelength points with a preset probability p (such as 5%), adding Gaussian noise only at the selected wavelength points, and keeping the original spectral characteristics of the remaining wavelength points unchanged.
[0151] (2) Wavelength slight shift: x b '(λ)=x b (λ+δ), λ is the wavelength before offset, δ is the small offset, x b is the data before the wavelength is slightly shifted, x b ' is the data after the wavelength is slightly shifted; for example, the wavelength is randomly shifted by ±2nm;
[0152] (3) Spectral mixing: x' = α1x1 + (1 - α1)x2, where x1 and x2 are samples of the same type, and α1 is the ratio of sample x1 in the mixed spectrum. For example, samples of the same type are mixed at a random ratio of 0.1-0.9.
[0153] It has been proven that this technology only requires 8 samples of each category to build a new variety identification model, with an identification accuracy rate of over 95%, greatly reducing the cost of sample collection and model building.
[0154] In a possible embodiment, step S3 includes sub-steps S301 to S303.
[0155] S301, extracting the Cordyceps characteristics corresponding to each mode in the multimodal spectral information based on the trained convolutional neural network model. Specifically including:
[0156] Based on the trained convolutional neural network model, multiple scale features corresponding to each mode in the multimodal spectral information are extracted respectively;
[0157] Based on the spectral attention mechanism, the feature expression of key bands in different scale features is automatically identified and enhanced;
[0158] By fusing the features of different convolutional layers through jump connections, we can obtain the fusion feature map of different scale features under a single modality. By traversing all modalities, we can obtain the fusion feature map of different scale features under multiple modalities, which can be expressed as a joint feature vector F = [F1; F2; ...; F n ], F1; F2; ...; F n is the fusion feature map of n single modalities.
[0159] S302, perform reconstruction error analysis, adulteration feature band identification, and adulteration ratio estimation on the Cordyceps features corresponding to each mode, and obtain independent identification results under each mode, that is, obtain the probability prediction result p for category c under the i-th mode. i (c) Specifically including:
[0160] (1) Reconstruction error analysis: The autoencoder of the convolutional neural network model is used to reconstruct the normal sample spectrum and identify abnormal samples.
[0161] In the training phase, the autoencoder AE is trained so that AE(x)≈x holds for normal samples;
[0162] The normal sample spectrum is reconstructed through the autoencoder, and the reconstruction error e = ||x-AE(x)||2 between the reconstructed normal sample spectrum and the Cordyceps feature corresponding to a single modality is calculated. Abnormal samples are identified based on the reconstruction error e: if e>τ (threshold), it is judged to be an abnormal sample.
[0163] (2) Identification of adulteration characteristic bands: Automatically discover and mark the characteristic bands of suspected adulterants. Figure 5 As shown in the figure, the spectral characteristic distribution of a pure sample is shown. Figure 5 It can be seen that the importance of each band is different, so for samples with the same composition, their spectral feature distributions should be very close.
[0164] In this step, first construct a pure sample spectrum library S = {s1, s2, ..., s n}, calculate the difference spectrum D = s'-avg(S) between the abnormal sample to be tested and the pure sample, and then apply continuous wavelet transform to perform multi-scale analysis on the difference spectrum D to identify multiple bands with significant deviations in spectral characteristics.
[0165] More specifically, the continuous wavelet transform is applied to the difference spectrum D, which is expressed as CWT(D,ψ,s), where ψ is the wavelet function and s is the scale; the maximum point of the CWT coefficient is extracted as the characteristic band. The specific operation is: set the threshold τ = μ a +2σ a , where μ a is the coefficient mean, σ a is the standard deviation; the bands with coefficients greater than the threshold τ are marked as adulteration characteristic bands.
[0166] The adulteration characteristic band λ will be identified α ,λ β ,...,λ j Compare with the characteristic library of known adulterants and mark the adulteration characteristic bands.
[0167] (3) Estimation of adulteration ratio: Estimation of adulteration ratio based on spectral linear mixed model.
[0168] Construct a spectral linear mixed model M = γA + (1-γ)B, where A is the pure sample spectrum, B is the adulterated spectrum, γ is the pure sample spectrum ratio, and (1-γ) is the adulterated ratio;
[0169] Solve the optimal mixing ratio γ by the least squares method: min||M-(γA+(1-γ)B)||2, and output the estimated adulteration ratio (1-γ)×100%;
[0170] Traverse the Cordyceps features corresponding to each modality and obtain independent recognition results under each modality. The probability prediction result of category c under the i-th modality is expressed as p i (c).
[0171] S303: Perform weighted voting on the independent recognition results under each modality to determine the final result of the classification of the Cordyceps powder sample. For example, the final classification is determined by the following formula:
[0172] C=argmax(∑ i w i ·p i (c)),
[0173] where w i is the weight of the i-th mode, p i (c) is the probability prediction of the modality for category c. In this embodiment, the weight of each modality is dynamically adjusted according to the historical accuracy rate to achieve adaptive weight adjustment during each detection.
[0174] It can be understood that this embodiment adopts a multimodal information fusion algorithm. The fusion at the feature layer is: extracting the main component features of each modality to form a joint feature vector; the fusion at the decision layer is: after each modality is independently judged, the weighted voting method is applied to determine the final category, and the weight of each modality is adaptively adjusted, thereby improving the detection accuracy of Cordyceps powder samples; fusion at the data level: constructing a multimodal tensor and directly inputting it into the deep learning model for end-to-end learning.
[0175] The fusion effect was verified through experiments, and the following results were obtained:
[0176] Sampling a single near-infrared modality: 92.7% accuracy;
[0177] The near-infrared + visible light fusion according to the embodiment of the present invention has an accuracy rate of 97.8%.
[0178] In one possible embodiment, the method provided by the embodiment of the present invention further includes self-learning calibration, and the calibration process specifically includes:
[0179] Collect historical sample spectral data, environmental parameters, and discrimination results, and monitor the drift of key instrument parameters in real time. The key parameters include at least light source intensity, detector response, and light path transmittance. The environmental parameters include temperature, humidity, atmospheric pressure, and other parameters.
[0180] The spectra of standard samples are collected regularly and compared with the standard spectra to calculate the drift vector D1={d1,d2,...,d n2}, n2 is a positive integer, d i ∈D1, where d iRepresents the drift value of the i-th characteristic wavelength point in D1; stores the reference spectrum of the standard sample and its trend over time; establishes the corresponding relationship model M between environmental parameters and drift vector: D1=f(T,H,t)=a1T+a2H+a3t+a4TH+a5Tt+a6Ht+C1, where T is temperature, H is humidity, t is usage time, a1, a2…a6 are coefficients corresponding to each environmental parameter, and C1 is the compensation matrix; more specifically, the temperature coefficient a1 represents the contribution of each 1°C change in temperature to the spectrum drift, with a typical range of: -0.1~0.1nm / °C; the humidity coefficient a2 represents the contribution of each 1% change in relative humidity to the spectrum drift, with a typical range of: The time coefficient a3 of -0.05 to 0.05 nm / % RH represents the contribution of equipment aging to the spectral drift per hour, with a typical range of -0.001 to 0.001 nm / hour. The temperature-humidity interaction coefficient a4 represents the influence of the temperature-humidity coupling effect on the drift, with a typical range of -0.001 to 0.001 nm / (°C·% RH). The temperature-time interaction coefficient a5 represents the temperature-accelerated aging effect, with a typical range of -0.0001 to 0.0001 nm / (°C·hour). The humidity-time interaction coefficient a6 represents the humidity-accelerated aging effect, with a typical range of -0.0001 to 0.0001 nm / (% RH·hour).
[0181] Predicting the drift vector D1' in the current environment according to the correspondence model M, and calculating the compensation matrix C1 = I - D1', where I is the identity matrix;
[0182] Apply compensation to the newly acquired standard sample spectrum S1: S1' = S1·C to update the instrument key parameters;
[0183] Define the sample feature vector set F'={F1',F2',...,F m1 '}, m1 is a positive integer, and the average distance D within the class is calculated based on the sample feature vector set F' intra =avg(dist(F i1 ',F j1 ')) and the minimum distance between classes D inter =min(dist(F i1 ',F k1 ')), where i1∈[1,m1], j1∈[1,m1], k1∈[1,m1], F i1 '∈F', F j1 '∈F', F k1 '∈F', F i1 ' and F j1 'Belong to the same category, F i1 ' and F k1 'belong to different categories;
[0184] Set the discrimination threshold T0 = αD intra +β(D inter -D intra ), where α and β are weight coefficients,
[0185] When new samples are added, the sample feature vector set F' is updated and the average distance D within the class is recalculated. intra and the minimum distance D between classes inter , and update the discrimination threshold T0.
[0186] It can be understood that by realizing self-learning calibration parameter optimization based on the incremental learning method, the adaptive ability of the Cordyceps powder intelligent identification method carrier is improved, and the detection accuracy can be continuously improved.
[0187] like Figure 6 The results of the Cordyceps powder sample identification of the present invention are shown in Figure 1, which is the result of classifying four Cordyceps species by principal component analysis (PCA), with the horizontal and vertical axes representing the first two principal components (PC1 and PC2) respectively. Figure 6 It can be seen that different types of Cordyceps samples show a certain clustering trend in the two-dimensional space after dimensionality reduction, indicating that multimodal spectral features can effectively distinguish some or all Cordyceps species. Therefore, the scheme of the present invention has a high accuracy in identifying various types of Cordyceps samples.
[0188] Figure 7 The structure diagram of a Cordyceps powder intelligent identification system based on multimodal spectral analysis and deep learning provided by an embodiment of the present invention is as follows: Figure 7 As shown, a Cordyceps powder intelligent identification system based on multimodal spectral analysis and deep learning includes a pre-scanning module, a multimodal scanning module and a fusion discrimination module, wherein:
[0189] A pre-scanning module is used to pre-scan the Cordyceps powder sample and pre-judge the category of the Cordyceps powder sample based on the pre-scanning result;
[0190] A multimodal scanning module is used to call a corresponding scanning strategy according to the predicted results to perform multimodal spectral scanning on the Cordyceps powder sample to obtain multimodal spectral information;
[0191] The fusion discrimination module is used to extract Cordyceps features from multimodal spectral information based on a deep learning model, and perform single-modal independent discrimination and multimodal weighted voting on the Cordyceps features to identify the category and / or category ratio of the Cordyceps powder sample.
[0192] It can be understood that the Cordyceps powder intelligent identification system based on multimodal spectral analysis and deep learning provided by the present invention corresponds to the Cordyceps powder intelligent identification method based on multimodal spectral analysis and deep learning provided in the aforementioned embodiments. The relevant technical features of the Cordyceps powder intelligent identification system based on multimodal spectral analysis and deep learning can refer to the relevant technical features of the Cordyceps powder intelligent identification method based on multimodal spectral analysis and deep learning, and will not be repeated here.
[0193] See also Figure 8 , Figure 8 Schematic diagram of an embodiment of an electronic device provided by an embodiment of the present invention. Figure 8 As shown, an embodiment of the present invention provides an electronic device 800, including a memory 810, a processor 820, and a computer program 811 stored in the memory 810 and executable on the processor 820. When the processor 820 executes the computer program 811, the following steps are implemented:
[0194] S1, pre-scanning the Cordyceps powder sample and pre-judging the category of the Cordyceps powder sample according to the pre-scanning result;
[0195] S2, calling the corresponding scanning strategy according to the prediction result to perform multimodal spectral scanning on the Cordyceps powder sample to obtain multimodal spectral information;
[0196] S3, extracting Cordyceps features from the multimodal spectral information based on the deep learning model, performing single-modal independent discrimination and multimodal weighted voting on the Cordyceps features to identify the category and / or category ratio of the Cordyceps powder sample.
[0197] See also Figure 9 , Figure 9 Schematic diagram of an embodiment of a computer-readable storage medium provided by the present invention. Figure 9 As shown, this embodiment provides a computer-readable storage medium 900, on which a computer program 911 is stored. When the computer program 911 is executed by a processor, the following steps are implemented:
[0198] S1, pre-scanning the Cordyceps powder sample and pre-judging the category of the Cordyceps powder sample according to the pre-scanning result;
[0199] S2, calling the corresponding scanning strategy according to the prediction result to perform multimodal spectral scanning on the Cordyceps powder sample to obtain multimodal spectral information;
[0200] S3, extracting Cordyceps features from the multimodal spectral information based on the deep learning model, performing single-modal independent discrimination and multimodal weighted voting on the Cordyceps features to identify the category and / or category ratio of the Cordyceps powder sample.
[0201] The embodiments of the present invention provide a method, system, electronic device and storage medium for intelligent identification of cordyceps powder based on multimodal spectral analysis and deep learning. The method pre-judges the category of the cordyceps powder sample based on the pre-scanning results of the cordyceps powder sample, and calls the corresponding scanning strategy to perform multimodal spectral scanning, thereby improving the accuracy of the multimodal spectral information of the sample. Multi-scale feature extraction of each modal spectrum is performed based on the deep learning model, and after independent discrimination of each modal feature, the final result is determined by weighted voting. In addition to the category of the cordyceps powder sample, the recognition result also includes the corresponding proportion of the category, which improves the accuracy of the identification of the cordyceps powder sample and can meet the needs of refined identification. Compared with the existing technology, it has the following advantages:
[0202] 1. Strong adaptive recognition capability: calibration parameters are optimized in real time to adapt to different environmental conditions, and the discrimination threshold is dynamically adjusted to improve recognition stability and recognition accuracy to over 99.5%;
[0203] 2. Multimodal fusion advantage: Combining multiple spectral information, complementary verification and recognition capabilities are significantly enhanced, the false positive rate is reduced by 80%, and different Cordyceps species with extremely high similarity can be distinguished;
[0204] 3. Deep Learning Feature Extraction: Automatically discover hidden features without manual feature design, end-to-end learning process, simplifying model construction and improving feature expression capabilities by more than 200%;
[0205] 4. Small sample learning advantage: Only 5-10 samples are needed to build a new variety identification model, and the model iteration and update are fast, adapting to new adulteration methods and reducing sample collection costs by 90%;
[0206] 5. Anomaly detection capability: Able to detect unknown types of adulterants, accurately identify characteristic bands, provide evidence of adulteration, and estimate the adulteration ratio with an accuracy of ±3%.
[0207] It should be noted that, in the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0208] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0209] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0210] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0211] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0212] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0213] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A method for intelligent identification of Cordyceps powder based on multimodal spectral analysis and deep learning, characterized in that: include: S1, pre-scanning the Cordyceps powder sample and pre-judging the category of the Cordyceps powder sample according to the pre-scanning result; S2, calling the corresponding scanning strategy according to the prediction result to perform multimodal spectral scanning on the Cordyceps powder sample to obtain multimodal spectral information; S3, extracting Cordyceps features from the multimodal spectral information based on the deep learning model, performing single-modal independent discrimination and multimodal weighted voting on the Cordyceps features to identify the category and / or category ratio of the Cordyceps powder sample.
2. The method according to claim 1, characterized in that Before step S1, the cordyceps powder sample is pretreated, and the pretreatment includes: The Cordyceps powder sample is subjected to standardized sieving to obtain a Cordyceps powder sample with a target particle size; The sieved Cordyceps powder sample was compacted.
3. The method according to claim 1, characterized in that Step S1 includes: S101, quickly scanning the Cordyceps powder sample at a low resolution to obtain a pre-scan spectrum, and calculating a first-order derivative spectrum S' of the pre-scan spectrum; S102, extract multiple key wavelength points λ1, λ2, ..., λ in the first-order derivative spectrum S' k The response strength at S103, calculate the sample characteristic vector P = {p1, p2, ..., p k }, k is a positive integer; S104, the sample characteristic vector P={p1,p2,…,p k }Match with the preset feature template library to determine the sample category prediction result.
4. The method according to claim 3, characterized in that Step S2 includes: S201, select the corresponding spectral mode combination C={c1,c2,…,c n }, n is a positive integer, and the spectral modality combination includes near-infrared light and visible light; S202, adaptively adjusting spectrum acquisition parameters according to the sample category prediction result and the sample characteristic vector P; S203, based on the optimized spectrum acquisition parameters, activating the spectrum acquisition units corresponding to the respective modes in sequence according to the priority of the spectrum modes to perform multimodal spectrum scanning; S204, adjusting the scanning times, scanning positions, and spectral modes according to the scanning results of step S203, to obtain multimodal spectral information of the Cordyceps powder sample.
5. The method according to claim 4, characterized in that Step S202 includes: According to the sample category prediction result, the basic parameter set B={b1,b2,…,b n1 }, n1 is a positive integer; According to the sample characteristic vector P, the parameter adjustment amount Δ={δ1,δ2,…,δ n1 }, n1 is a positive integer; According to the basic parameter set B and the parameter adjustment amount Δ, the optimized spectrum acquisition parameter set P is generated * =B+Δ.
6. The method according to claim 4, characterized in that In step S201, selecting a suitable spectral modality combination according to the sample category prediction result includes: The sample category is single-ingredient Cordyceps powder or suspected adulterated Cordyceps powder; When the sample type prediction result is single-ingredient Cordyceps powder, near-infrared spectroscopy is used; When the sample category prediction result is suspected adulterated Cordyceps powder, a combined spectrum of near-infrared light and visible light is used.
7. The method according to claim 1, characterized in that Step S3 includes: S301, extracting Cordyceps features corresponding to each mode in the multimodal spectral information based on the trained convolutional neural network model; S302, performing reconstruction error analysis, adulteration feature band identification, and adulteration ratio estimation on the Cordyceps characteristics corresponding to each modality to obtain independent identification results for each modality; S303: Perform weighted voting on the independent recognition results under each modality to determine the final result of the category recognition of the Cordyceps powder sample.
8. The method according to claim 7, characterized in that Step S301 includes: Based on the trained convolutional neural network model, multiple scale features corresponding to each mode in the multimodal spectral information are extracted respectively; Based on the spectral attention mechanism, the feature expression of key bands in different scale features is automatically identified and enhanced; The features of different convolutional layers are fused through jump connections to obtain fused feature maps of different scale features under multiple single modalities.
9. The method according to claim 7 or 8, characterized in that Step S302 includes: Reconstructing the normal sample spectrum, and identifying the abnormal sample based on the error between the reconstructed normal sample spectrum and the Cordyceps characteristics corresponding to a single modality; Construct a spectral library S of pure samples, calculate the difference spectrum D between the abnormal sample to be tested and the pure sample, and apply wavelet transform to perform multi-scale analysis on the difference spectrum D to identify the bands with significant deviations; compare the identified bands with the characteristic library of known adulterants, and mark the adulteration characteristic bands; A spectral linear mixing model M = γA + (1-γ)B was constructed, where A is the pure sample spectrum and B is the adulterated spectrum. The optimal mixing ratio γ was solved by the least squares method: min||M-(γA+(1-γ)B)||2, and the estimated adulteration ratio (1-γ) × 100% was output. Traverse the Cordyceps features corresponding to each modality and obtain independent recognition results under each modality.
10. The method according to claim 1, characterized in that Also includes self-learning calibration, including: Collect historical sample spectral data, environmental parameters, and discrimination results, and monitor the drift of key instrument parameters in real time. The key parameters include at least light source intensity, detector response, and light path transmittance. The spectra of standard samples are collected regularly and compared with the standard spectra to calculate the drift vector D1={d1,d2,…,d n2 }, n2 is a positive integer, d i ∈D1, where d i Represents the drift value of the i-th characteristic wavelength point in D1; Establish the corresponding relationship model M between environmental parameters and drift vector: D1 = f(T,H,t), where T is temperature, H is humidity, and t is usage time; Predicting the drift vector D1' in the current environment according to the correspondence model M, and calculating the compensation matrix C1 = I - D1', where I is the identity matrix; Apply compensation to the newly acquired standard sample spectrum S: S' = S·C to update the instrument key parameters; Define the sample feature vector set F'={F1',F2',…,F m1 '}, m1 is a positive integer, and the average distance D within the class is calculated based on the sample feature vector set F' intra =avg(dist(F i1 ',F j1 ')) and the minimum distance between classes D inter =min(dist(F i1 ',F k1 ')), where i1∈[1,m1], j1∈[1,m1], k1∈[1,m1], F i1 '∈F', F j1 '∈F', F k1 '∈F', F i1 ' and F j1 'Belong to the same category, F i1 ' and F k1 'belong to different categories; Set the discrimination threshold T0 = αD intra +β(D inter -D intra ), where α and β are weight coefficients, When new samples are added, the average distance D within the class is recalculated intra and the minimum distance D between classes inter , and update the discrimination threshold T0.