Directed training method for identifying impurities in Platycodon grandiflorum based on spectral imaging

By introducing a multi-dimensional label system and multiple model branch structures for spectral imaging in deep learning, the problem of insufficient classification accuracy in the recognition of Platycodon impurities in traditional methods is solved, and higher recognition accuracy and interpretability are achieved, especially for transparency. Identification of plastic ingredients.

CN114694140BActive Publication Date: 2024-11-22NANJING FORESTRY UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210286878.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-22
Publication Date
2024-11-22
Estimated Expiration
2042-03-22

AI Technical Summary

Technical Problem

Traditional deep learning lacks interpretability and the introduction of expert prior knowledge in the identification of Platycodon impurities, resulting in insufficient classification accuracy and it is difficult to ensure the consistency of Platycodon products.

Method used

Using a multi-dimensional label system based on spectral imaging, multiple model branch structures are established through hyperspectral image acquisition and data processing, each label dimension is trained in binary classification, and error tuning is performed to improve the classification accuracy and explanatory model. sex.

Benefits of technology

The classification accuracy of Platycodon impurities recognition is improved, making the model prediction results more explainable, and can identify transparent plastic components that cannot be identified by traditional methods, which improves the quality consistency of Platycodon products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114694140B_ABST
    Figure CN114694140B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for identifying impurities of Platycodon grandiflorum through directional training based on spectral imaging, which belongs to the field of deep learning technology. First, a multidimensional label system is established; then a model branch structure is constructed for each label. In the process of training model data, binary classification training is first performed on each dimension of the multidimensional label, and then the overall error is optimized, so as to achieve binary classification discrimination for different color attributes of Platycodon grandiflorum debris. The present invention introduces a multidimensional label system so that spectral data belongs to multiple categories, and introduces prior knowledge from the perspective of category labels, so that the algorithm can be more interpretable in the classification process. Different attribute labels are used to divide the categories to which the spectrum belongs, so that the classification results of the spectrum are more interpretable, and training can be performed according to the corresponding attributes, so as to improve the final classification accuracy of the model; high-precision identification and classification of impurities with different spectral characteristics from Platycodon grandiflorum are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of hyperspectral imaging and deep learning, and specifically relates to a method for identifying Platycodon grandiflorum impurities based on directional training of spectral imaging. Background Art

[0002] my country is a major producer and consumer of Platycodon grandiflorum, and Platycodon grandiflorum processing and sales play an important role in the national economy. However, it is difficult to ensure the purity of Platycodon grandiflorum raw materials during the planting and transportation process. If the impurities are not thoroughly cleaned, the final Platycodon grandiflorum products will have serious problems such as low content of effective ingredients, poor Platycodon grandiflorum flavor, and difficulty in maintaining consistency in the quality of Platycodon grandiflorum products. At present, deep learning is an effective way to solve the problem of impurities in Platycodon grandiflorum raw materials. Traditional deep learning uses unique hot encoding as the classification output of training, which certainly keeps the distance between each category in the vector space the same, but it also makes the prediction results of the model less interpretable. In addition, although the traditional labeling method combined with degree-hot encoding can play a training effect in the training process, it lacks the introduction of expert prior knowledge, which has become an obstacle to the application of deep learning in the field of spectroscopy. Therefore, how to introduce expert prior knowledge to improve the classification accuracy of the model is a technical problem that needs to be solved in the sorting process. Summary of the invention

[0003] The technical problem solved by the present invention is to provide a method for identifying Platycodon grandiflorum impurities with directional training based on spectral imaging and high classification and identification accuracy.

[0004] Technical solution: In order to solve the above technical problems, the technical solution adopted by the present invention is as follows:

[0005] A method for identifying impurities in Platycodon grandiflorum by directional training based on spectral imaging establishes a multidimensional label system, and divides the different attributes of the spectrum of Platycodon grandiflorum materials into multiple label dimensions; then a model branch structure is constructed for each label. In the process of model data training, binary classification training is first performed on each dimension of the multidimensional label, and then the overall error is optimized, thereby achieving binary classification discrimination for different color attributes of Platycodon grandiflorum impurities.

[0006] First, establish a multi-dimensional labeling system. The steps are as follows:

[0007] Step 1: Collect hyperspectral images of Platycodon grandiflorum and impurities, and perform data correction and noise reduction;

[0008] Step 2: Draw spectrum graphs for the collected materials of different categories;

[0009] Step 3: Observe the spectral lines of different types of materials and establish corresponding category attribute labels based on the spectral lines;

[0010] Step 4: Encode the data of different categories to generate the final classification target label.

[0011] Furthermore, in step 3, the process of establishing the category attribute label is as follows:

[0012] Step 3.1: Collect imaging hyperspectral images of materials, and analyze the spectral images to obtain n binary attributes;

[0013] Step 3.2: Create labels for the collected spectral images. During the creation process, for each spectral data, generate an n+x-dimensional array, where x is the minimum encoding dimension;

[0014] Step 3.3: According to the object category, mark the category in the hyperspectral imaging data. For new categories, extend the x-dimension array with all zeros after the attribute label. For subsequent attribute labels that are exactly the same as the previous ones, perform binary addition on the basis of the previous label encoding;

[0015] Step 3.4: Repeat the process of step 3.3 until more than 1,000 pieces of data are collected for each required category of debris.

[0016] Furthermore, in the observation process of Platycodon grandiflorum materials, n=5 specifically includes the following five items: whether the color is yellow, whether the color is blue, whether the color is red, whether the spectrum line has a moisture absorption peak, whether there is a chlorophyll absorption peak, and whether there is an infrared absorption peak. During the labeling process, when the attribute value is true, it corresponds to 1, and when the attribute value is false, it corresponds to 0.

[0017] Furthermore, during model training, the trained network is a multi-attribute branch neural network, and multiple neural network branches are constructed according to the number of binary attribute values ​​n+1.

[0018] Furthermore, two stages are established during the model training process: multiple rounds of binary training and final model tuning.

[0019] Furthermore, during multiple rounds of binary training, the model only trains a single branch network and divides the attribute label into n independent binary classification labels. When training a single branch, the weights and bias values ​​on other branches are frozen so that they do not change. After training multiple branches, the encoding branch is combined for final model tuning.

[0020] Furthermore, the final model tuning process: unfreeze all frozen branches, combine the last branch for training, and store the corresponding model weights after the training process is completed and use them in the sorting prediction process. Beneficial effects: Compared with the prior art, the present invention has the following advantages:

[0021] (1) The present invention introduces a multi-dimensional labeling system into the traditional classification algorithm, so that the spectral data that originally belonged to a single category can be classified into multiple categories. Prior knowledge is introduced from the perspective of category labels, so that the algorithm can be more interpretable during the classification process.

[0022] (2) The present invention uses different attribute labels to classify the spectrum into categories, so that the spectral classification results are more interpretable and can be trained according to the corresponding attributes, thereby improving the final classification accuracy of the model.

[0023] (3) During the model construction process, the model branch structure is constructed for multiple labels respectively, thereby improving the prediction ability of the model; and after a classification error occurs, the selected scheme can be used to find the branch model with the classification error, and the corresponding model can be trained in a targeted manner, thereby improving the classification accuracy.

[0024] (4) The present invention applies hyperspectral technology to the field of impurity identification in Platycodon grandiflorum. For residual transparent plastic components that cannot be identified by color cameras and black and white cameras, the present invention uses a hyperspectral imager to collect the reflected spectrum in the infrared part as an attribute label, and then identifies and classifies components such as transparent plastics that have different spectral characteristics from Platycodon grandiflorum. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 It is the spectrum curve of Platycodon grandiflorum used for observation;

[0026] Figure 2 It is the branch network structure diagram corresponding to the generated labels;

[0027] Figure 3 It is the actual sorting accuracy map obtained after model training. DETAILED DESCRIPTION

[0028] The present invention is further illustrated below in conjunction with specific examples. The examples are implemented based on the technical solutions of the present invention. It should be understood that these examples are only used to illustrate the present invention and are not used to limit the scope of the present invention.

[0029] like Figure 1 As shown, the directional training method for identifying impurities in Platycodon grandiflorum based on spectral imaging of the present application includes the following steps: first, a multidimensional label system is established, and then a model branch structure is constructed for each label. In the process of data training, each dimension of the multidimensional label is firstly trained for binary classification, and then the overall error is optimized. Hyperspectral technology is applied to the field of Platycodon grandiflorum impurity identification, and binary classification is performed for different color attributes.

[0030] (1) First, establish a multi-dimensional labeling system. The steps are as follows:

[0031] Step 1: Collect hyperspectral images of Platycodon grandiflorum and impurities, and perform data correction and noise reduction;

[0032] The reflectance spectrum images of Platycodon grandiflorum and impurities at 400 to 1000 nm were obtained using the SWIR series hyperspectral imager of SPECIM of Finland;

[0033] Step 2: Draw spectrum graphs for the collected materials of different categories, see Figure 1 Spectral lines in ;

[0034] Step 3: Observe the spectral lines of different types of materials and establish corresponding category attribute labels based on the spectral lines;

[0035] Step 4: Encode the data of different categories to generate the final classification target label.

[0036] In step 3, the process of establishing the category attribute label includes the following steps:

[0037] Step 3.1: Collect imaging hyperspectral images of the material, and analyze the spectral images to obtain n binary attributes; in the observation process of Platycodon grandiflorum materials, n=5 specifically includes the following 5 items: whether the color is yellow, whether the color is blue, whether the color is red, whether the spectrum line has a moisture absorption peak, whether there is a chlorophyll absorption peak, and whether there is an infrared absorption peak. During the labeling process, the attribute value corresponds to 1 when it is true, and corresponds to 0 when the attribute value is false.

[0038] Step 3.2: Create labels for the collected spectral images. During the creation process, for each spectral data, generate an n+x-dimensional array, where x is the minimum encoding dimension; x is calculated as follows:

[0039]

[0040] In the formula, c represents the number of categories with the same attributes. The symbol indicates that the element . is rounded up. In the process of creating labels for Platycodon materials, objects are classified into 14 categories. The specific categories are shown in Table 1 below:

[0041] Table 1 Attribute labels corresponding to different materials of Platycodon grandiflorum

[0042]

[0043] According to the attribute labels in the above table, maxc = 3 can be obtained, and the same categories are yellow kraft paper, hemp rope, and yellow cigarette butts. Then the minimum encoding dimension x = 2;

[0044] Step 3.3: According to the object category, mark the category in the hyperspectral imaging data. For new categories, extend the x-dimension array with all zeros after the attribute label. For subsequent attribute labels that are exactly the same as the previous ones, perform binary addition on the basis of the previous label encoding;

[0045] Step 3.4: Repeat the process of step 3.3 until more than 1,000 pieces of data are collected for each required category of debris.

[0046] (2) Then build a model branch structure for each label.

[0047] In the model training, the trained network is a multi-attribute branch neural network, and multiple neural network branches are constructed according to the number of binary attribute values ​​n+1. In the construction process of the Platycodon grandiflorum foreign body sorting algorithm, the number of branches n+1=6. The network structure is as follows Figure 2 As shown. In the figure, n_spec represents the dimension of the spectrum, Conv represents the convolutional layer in the neural network, branch represents the number of each branch, and the following numbers only represent the serial number, which has nothing to do with the network structure. The first 5 branches are neural network branches constructed for each category, and the sixth branch is the n+1th branch, which outputs an x-dimensional encoding vector. Dense represents the fully connected layer in the neural network, x represents the minimum encoding dimension, t represents the predicted value of each attribute, and the subsequent serial number corresponds to the order of the attribute values ​​in Table 1. The category matcher represents the use of category attributes for binary matching, converting the result t of multiple labels into the final binary result. The binary result only contains two categories, namely whether it is impurity. The specific matching process is as follows:

[0048] r=[t,v x ]·l1+[t,v x ]·l2+…+[t,v x ]·l m

[0049] In the formula, r represents the final output binary result, [t, v x ] represents the attribute label prediction value vector t and the encoding vector v x The concatenation vector of . i , i∈[1,m] and i is an integer, which means the attribute labels and encoding vectors corresponding to the m types of materials that need to be retained. This binary operation can speed up the sorting speed of the system. For example, in the Platycodon grandiflorum sorting system, m=2, and the retained material types are background and Platycodon grandiflorum.

[0050] During the model training process, two stages are established: multiple rounds of binary training and final model tuning.

[0051] In the multi-round binary training process, the model only trains a single branch network, divides the attribute label into n independent binary classification labels, and uses the following loss function as the classification loss function:

[0052]

[0053] In the formula, y and Represents the results of actual value and predicted value respectively. Each of the n network branches is trained once. The optimizer used in the training process is Adam. When training a single branch, the weights and bias values ​​on other branches are frozen so that they do not change. After training multiple branches, the encoding branch is combined for final model tuning.

[0054] The final model tuning process: unfreeze all frozen branches and combine them with the last branch for training. The loss function used in the training process is as follows:

[0055]

[0056] In the formula, y and The results represent the actual value and the predicted value respectively. After the training process is completed, the corresponding model weights are stored and used in the sorting prediction process.

[0057] The present invention introduces a multi-dimensional label system on the traditional classification algorithm, so that the spectral data originally belonging to only a single category belongs to multiple categories, and introduces prior knowledge from the perspective of category labels, so that the algorithm can be more interpretable in the classification process. In the process of model construction, a model branch structure is constructed for multiple labels respectively, thereby improving the prediction ability of the model. In the process of data training, binary classification training is first performed on each dimension of the multi-dimensional label, and then the overall error is optimized. The present invention applies hyperspectral technology to the field of impurity identification of Platycodon grandiflorum, and performs binary classification discrimination for different color attributes. The present invention collects hyperspectral images of materials at 400-1000nm through a hyperspectral imager, and then identifies and classifies impurities with different spectral characteristics from Platycodon grandiflorum.

[0058] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for identifying impurities in Platycodon grandiflorum by directional training based on spectral imaging. It is characterized in that A multidimensional label system is established to divide the different properties of the spectrum of Platycodon grandiflorum materials into multiple label dimensions; then a model branch structure is constructed for each label. During the model data training process, each dimension of the multidimensional label is firstly trained for binary classification, and then the overall error is optimized, so as to achieve binary classification discrimination for different color properties of Platycodon grandiflorum debris; In model training, the trained network is a multi-attribute branch neural network, and multiple neural network branches are constructed according to the number of binary attribute values ​​n+1; The category matcher uses category attributes to perform binary matching and converts the results t of multiple labels into the final binary results. The binary results only contain two categories, namely, whether it is impurity or not; During the model training process, two stages are established: multiple rounds of binary training and final model tuning; In the multi-round binary training process, the model only trains a single branch network and divides the attribute labels into n Independent binary classification labels, use the following loss function as the classification loss function: In the formula, y and Represent the results of actual value and predicted value respectively; n Each network branch is trained once. The optimizer used in the training process is Adam. When training a single branch, the weights and bias values ​​on other branches are frozen so that they do not change. After training multiple branches, the encoding branch is combined for final model tuning. The final model tuning process: unfreeze all frozen branches and combine them with the last branch for training. The loss function used in the training process is as follows: In the formula, y and Represent the results of actual value and predicted value respectively; after the training process is completed, the corresponding model weights are stored and used in the sorting prediction process.

2. The method for identifying impurities in Platycodon grandiflorum by directional training based on spectral imaging according to claim 1, Features: First, establish a multi-dimensional labeling system. The steps are as follows: Step 1: Collect hyperspectral images of Platycodon grandiflorum and impurities, and perform data correction and noise reduction; Step 2: Draw spectrum graphs for the collected materials of different categories; Step 3: Observe the spectral lines of different types of materials and establish corresponding category attribute labels based on the spectral lines; Step 4: Encode the data of different categories to generate the final classification target label.

3. The method for identifying impurities in Platycodon grandiflorum by directional training based on spectral imaging according to claim 2, Features: In step 3, the process of establishing the category attribute label is: Step 3.1: Collect imaging hyperspectral images of materials, and analyze the spectral images to obtain n binary attributes; Step 3.2: Create labels for the collected spectral images. During the creation process, generate a n+x dimensional array, x is the minimum encoding dimension; Step 3.3: Label the hyperspectral imaging data according to the object category. For new categories, extend the attribute label x Dimensional all-zero array, for subsequent attribute labels that are exactly the same as the previous ones, binary addition is performed on the basis of the previous label encoding; Step 3.4: Repeat the process of step 3.3 until more than 1,000 pieces of data are collected for each required category of debris.

4. The method for identifying impurities in Platycodon grandiflorum by directional training based on spectral imaging according to claim 3, Features: During the observation of Platycodon grandiflorum materials, n =6 specifically includes the following 6 items: whether the color is yellow, whether the color is blue, whether the color is red, whether the spectrum line has a water absorption peak, whether there is a chlorophyll absorption peak, and whether there is an infrared absorption peak. During the labeling process, when the attribute value is true, it corresponds to 1, and when the attribute value is false, it corresponds to 0.