A property analysis method based on composite fertilizer infrared spectrum data

By constructing a teacher network using graph neural networks and a Transformer encoder, and combining it with a teacher-student knowledge distillation framework based on a lightweight 1D-CNN model, the problem of balancing training efficiency and accuracy in compound fertilizer attribute analysis is solved, achieving efficient and accurate prediction of compound fertilizer attributes.

CN122177288APending Publication Date: 2026-06-09SHANDONG MINGQUAN GREEN ENERGY ECOLOGICAL FERTILIZER CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANDONG MINGQUAN GREEN ENERGY ECOLOGICAL FERTILIZER CO LTD
Filing Date
2026-03-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Traditional compound fertilizer testing methods are complex to operate, costly, and cannot detect multiple components simultaneously. Existing deep learning models struggle to balance training efficiency and accuracy in compound fertilizer property analysis, and transfer learning is rarely applied.

Method used

A teacher network is constructed by combining a graph neural network with a self-attention mechanism and a Transformer encoder. Through a teacher-student knowledge distillation framework, transfer learning is applied to a lightweight 1D-CNN model to achieve efficient and high-standard compound fertilizer property analysis.

Benefits of technology

It significantly improves the prediction quality of compound fertilizer properties, solves the overfitting problem caused by the scarcity of labeled samples, dynamically identifies key wavelength points and reveals non-adjacent chemical associations, thus improving prediction performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122177288A_ABST
    Figure CN122177288A_ABST
Patent Text Reader

Abstract

The application discloses a property analysis method based on composite fertilizer infrared spectrum data, and belongs to the technical field of data processing. The method first acquires and pre-processes near-infrared spectrum data of a composite fertilizer sample; secondly, a complex teacher network comprising a graph neural network, a covariance matrix guided self-attention mechanism and a Transformer encoder is constructed; then, a lightweight network is constructed by adopting a residual dense connection mode based on a 1D-CNN; finally, knowledge of the teacher network is transferred to a student network through temperature scaling soft target supervision and a multi-level intermediate layer feature alignment mechanism, and the student network is used to realize efficient and accurate analysis of the properties of the composite fertilizer. The application effectively alleviates the overfitting problem caused by the scarcity of labeled samples, significantly improves the prediction accuracy and model generalization ability, and at the same time ensures the lightweight of the student network, facilitating the deployment and application in actual production scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, specifically to a method for attribute analysis based on infrared spectral data of compound fertilizer. Background Technology

[0002] Compound fertilizer is a mixed fertilizer containing two or more main nutrients. Its granules contain scientifically proportioned nutrient elements, which can effectively improve the convenience of fertilization and fertilizer utilization. Due to its unique advantages, compound fertilizer has become an important part of the fertilizer industry.

[0003] In recent years, compound fertilizers have accounted for more than 50% of all fertilizer usage in China. The content of the main elements nitrogen, phosphorus, and potassium is key to determining the efficiency and price of compound fertilizers. Traditional methods for detecting element content in compound fertilizers rely on wet chemical methods. These methods lack real-time performance and environmental friendliness, are complex to operate, and cannot simultaneously detect multiple components. Furthermore, due to the high cost and timeliness of traditional methods, the limited sample size makes it difficult to achieve comprehensive monitoring of the entire production batch.

[0004] Near-infrared spectroscopy, as a highly efficient and environmentally friendly advanced analytical technique, is widely used in online quality monitoring during compound fertilizer production due to its advantage of enabling simultaneous quantitative analysis of multiple components without complex pretreatment steps. This technology provides a practical new approach for the rapid and non-destructive detection of key elements such as nitrogen, phosphorus, and potassium in compound fertilizers.

[0005] Chemometric methods have long held a central position in high-performance near-infrared spectroscopy qualitative and quantitative modeling. With the rapid development of artificial intelligence, deep learning has achieved widespread application and significant results in many fields such as image recognition and video processing. Against this backdrop, an emerging research path has gradually gained attention: converting one-dimensional spectral sequences into two-dimensional image structures through specific encoding strategies, and then using deep learning networks to achieve high-quality spectral qualitative identification and quantitative regression modeling. Although the above research path shows great potential, spectral analysis schemes based on image generation and deep learning still face the challenge of balancing training efficiency and accuracy. To achieve accurate detection, training based on the original deep learning model is required. Transfer learning, as an effective method to address insufficient training data or limited computational resources, can significantly reduce training time while maintaining model performance stability. However, its application in compound fertilizer property analysis remains relatively limited. Summary of the Invention

[0006] This application provides an attribute analysis method based on infrared spectral data of compound fertilizer, which introduces transfer learning into the field of compound fertilizer attribute analysis to achieve efficient and high-standard identification with a limited sample size.

[0007] The technical solution of this application is as follows: A property analysis method based on infrared spectral data of compound fertilizer includes the following steps: S1. Obtain the near-infrared spectral dataset of compound fertilizer samples, and perform preprocessing and calculate the covariance matrix; S2. Add a self-attention mechanism and a Transformer encoder to the graph neural network to form a teacher network; In a graph neural network, the near-infrared spectrum of a sample is used as a graph, each wavelength point in the graph is used as a node, and the feature vector is used as node information. The information of adjacent nodes is aggregated to update the nodes in order to extract the local structural feature sequence of the near-infrared spectrum. The self-attention mechanism receives a sequence of local structural features and calculates the attention coefficient between any two nodes. It performs attention constraints and initialization based on the covariance matrix to generate a weighted fusion feature that can characterize the chemical correlation between nodes. The Transformer encoder performs multi-layer nonlinear transformation based on weighted fusion features to generate high-level chemical features characterizing the chemical properties of compound fertilizer. S3. The teacher network is trained based on the dataset, and the teacher network outputs teacher data through a fully connected layer; S4. A lightweight 1D-CNN model is used as the baseline model. In the baseline model, residual dense connections are used to connect each convolutional layer to form a student network. The student network can generate student data after being trained on the dataset. S6. Input the dataset into the teacher network and the student network. Based on the temperature scaling technique, use the teacher data as a soft target to form a supervision signal. The student network outputs student data under the supervision of the supervision signal. During the supervision process, the distillation loss function is used to optimize the student data. S7. Based on a multi-level feature alignment mechanism, the middle layer of the student network is aligned with the middle layer of the teacher network. The alignment process optimizes the alignment result through the feature distillation loss function. S8. According to steps S4~S7, the student network is trained using the dataset, and the student data output by the trained student network is used as the result of compound fertilizer attribute analysis.

[0008] Furthermore, in S2, the model for aggregating neighboring node information is as follows: ; In the formula, Indicates the first l Layer nodes i The updated feature vector; Indicates the first l Layer nodes i eigenvectors; N ( i ) represents a node iThe set of adjacent nodes; , Representing nodes respectively i and nodes j Normalized node degree; This represents a trainable weight matrix. Represents a nonlinear activation function; Indicates the first l Layer adjacent nodes j The characteristics are represented.

[0009] Furthermore, in S4, the convolutional layers in the baseline model are calculated as follows: ; In the formula, f i Indicates the first i A convolutional layer; ReLU represents the ReLU activation function; BN Indicates batch normalization; K Indicates the total number of convolutional layers; s( i + j ) indicates at index position ( i+j The absorption intensity value at the sampling point; w j Indicates that the convolution kernel is in j The weight of each position; b This indicates the bias term.

[0010] Furthermore, in S4, the expression for the residual-dense join is as follows: ; In the formula, x l Indicates the first l The output features of the layer; x 0、 x 1… x l-1 H represents the features of each convolutional layer; l Indicates the first l The nonlinear transformation function of the layer.

[0011] Furthermore, in S4, the student data generated after the student network is trained on the dataset is the basic feature, and the mathematical calculation model for the basic feature is as follows: ; In the formula, L base Indicates basic features; N Indicates the total number of samples; Indicates the parameters to be optimized; D (-) indicates a distance metric; f sRepresents a mapping function; x i Indicates the first i Near-infrared spectral data of one compound fertilizer sample; y i This represents the baseline value during the training process.

[0012] Furthermore, the distillation loss function in step S6 is as follows: ; In the formula, D soft Indicates the similarity in distribution between student data and teacher data; D hard This indicates the difference in distribution between student data and teacher data; Indicates the equilibrium hyperparameters; f T This indicates a teacher network that has completed pre-training. Indicates a soft target. y Indicates the label parameter; Furthermore, the characteristic distillation loss function in step S7 is as follows: ; In the formula, L FD Indicates characteristic distillation loss; and These represent the student network and the teacher network, respectively. l Feature mapping degree of the layer; (-) represents the feature similarity measurement function. Indicates the importance weight of the hierarchy; L This represents the set of network layers.

[0013] Due to the adoption of the above technical solution, the beneficial effects of this application are as follows: 1. This application introduces a teacher-student knowledge distillation framework in the analysis of compound fertilizer properties. Based on a structurally complex teacher network, high-discriminative features are extracted from limited labeled data, and then the knowledge is transferred to a lightweight student network. This technical approach can significantly alleviate the overfitting problem caused by the scarcity of labeled samples in the near-infrared spectroscopy analysis of compound fertilizers, and significantly improve the prediction quality of compound fertilizer properties.

[0014] 2. This application is based on a graph neural network combined with a covariance matrix-guided self-attention mechanism, which enables the model to dynamically identify key wavelength points and reveal the attribute relationships between non-adjacent but chemically related bands, thus overcoming the limitations of local window analysis.

[0015] 3. This application combines and optimizes the student network based on the soft objective and intermediate layer representation of the teacher network, realizing full knowledge transfer under supervision, which can significantly improve the prediction performance of the student network and make it highly aligned with the output of the teacher network. Attached Figure Description

[0016] The accompanying drawings, which are provided to further illustrate this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application.

[0017] Figure 1 A flowchart of a property analysis method based on infrared spectral data of compound fertilizer provided in this application. Detailed Implementation

[0018] Based on the background technology described, as shown in the appendix Figure 1 As shown, this application provides a property analysis method based on infrared spectral data of compound fertilizer, including the following steps: S1. Obtain the near-infrared spectral dataset of the compound fertilizer samples, and perform preprocessing and calculate the covariance matrix.

[0019] In this embodiment, based on the MPA Fourier Transform Near-Infrared Spectrometer from Bruker Optics, Germany, the compound fertilizer sample was first ground into a uniform powder and then pressed into a flat sheet with uniform thickness. The instrument was preheated for 30 minutes. The sample number was entered into the OPUS software, and the instrument automatically began scanning, calculating, and displaying the spectrum. For each sample, to ensure accuracy, three acquisitions were performed at different positions and angles. The average of the three spectra was recorded as the overall spectrum of the sample, and this record was maintained. This process was repeated, recording a total of 200 spectral data points to form a dataset. After obtaining the test set, Savitzky-Golay filtering was first used to remove high-frequency noise generated by the instrument during data acquisition. Then, MSC correction for physical scattering effects was used to handle random and systematic errors caused by sample particle size, uneven distribution, and surface physical properties, enhancing the usability of relevant information. After preprocessing, the dataset was divided into a training set and a test set, and the covariance matrices of the training and test sets were calculated separately.

[0020] S2. Add a self-attention mechanism and a Transformer encoder to the graph neural network to form a teacher network.

[0021] S3. The teacher network is trained based on the dataset, and the teacher network outputs teacher data through a fully connected layer.

[0022] In practical implementation, a self-attention mechanism and a Transformer encoder are added to the graph neural network to address the limitation of a single graph neural network that only focuses on local information of the data. Adding the self-attention mechanism allows for better acquisition of the overall information of the covariance matrix of the near-infrared spectral data.

[0023] In a graph neural network, the near-infrared spectrum of a sample is used as a graph, each wavelength point in the graph is used as a node, and the feature vector is used as node information. The information of adjacent nodes is aggregated to update the nodes in order to extract the local structural feature sequence of the near-infrared spectrum. The self-attention mechanism receives a sequence of local structural features and calculates the attention coefficient between any two nodes. It performs attention constraints and initialization based on the covariance matrix to generate a weighted fusion feature that can characterize the chemical correlation between nodes. The Transformer encoder performs multi-layer nonlinear transformations based on weighted fusion features to generate high-level chemical features characterizing the chemical properties of compound fertilizers.

[0024] In the technical solution of this application, a near-infrared spectral sample is a graph, where each wavelength point is a point. The graph convolutional layer updates node features by aggregating node information from neighboring nodes. l layer"" The model for aggregating information about neighboring nodes is as follows: ; In the formula, Indicates the first l Layer nodes i The updated feature vector; Indicates the first l Layer nodes i eigenvectors; N ( i ) represents a node i The set of adjacent nodes; , Representing nodes respectively i and nodes j Normalized node degree; This represents a trainable weight matrix. Represents a nonlinear activation function; Indicates the first l Layer adjacent nodes j The characteristics are represented.

[0025] The above formula allows for the preliminary extraction of local structural features of the spectrum. By using the covariance matrix as a priori guide, a self-attention mechanism is introduced into the output features of the graph neural network to achieve dynamic weighting of the strength of relationships between wavelength points, thereby automatically discovering key bands and their interactions. Building upon this, a Transformer encoder is introduced to perform multi-level nonlinear representation of the spectral features processed by the self-attention mechanism, gradually realizing a hierarchical representation from low-level physical responses to high-level chemical semantics, thus completing the mapping from the original spectrum to high-level chemical property representation. After training the teacher network using the above three modules, the output data is processed through a fully connected layer, and the finally trained teacher network outputs teacher data at the fully connected layer. During the optimization process, the weights can be updated using the Adam optimization algorithm.

[0026] S4. A lightweight 1D-CNN model is used as the baseline model. In the baseline model, residual dense connections are used to connect each convolutional layer to form a student network. The student network can generate student data after being trained on the dataset.

[0027] The convolutional layers in the baseline model are calculated as follows: ; In the formula, f i Indicates the first i A convolutional layer; ReLU represents the ReLU activation function; BN Indicates batch normalization; K Indicates the total number of convolutional layers; s( i + j ) indicates at index position ( i+j The absorption intensity value at the sampling point; w j Indicates that the convolution kernel is in j The weight of each position; b This represents the bias term. Convolutional kernels are applied during the feature detection stage. w j Learning to identify specific spectral patterns at wavelength points i At that point, examine the pattern of its K adjacent wavelength points and set the threshold using the bias term.

[0028] To address the gradient vanishing and feature degradation problems faced by deep 1D-CNN networks, a residual dense connection approach is adopted. This approach, through the combined use of dense feature reuse and identity mapping shortcuts, achieves efficient gradient propagation and enhances the feature representation capability of deep networks. The expression for residual dense connections is as follows: ; In the formula, x l Indicates the first l The output features of the layer;x 0、 x 1… x l-1 H represents the features of each convolutional layer; l Indicates the first l The nonlinear transformation function of the layer.

[0029] The student data generated after training the student network with the dataset is the basic feature, and the mathematical calculation model for the basic feature is as follows: ; In the formula, L base Indicates basic features; N Indicates the total number of samples; Indicates the parameters to be optimized; D (-) indicates a distance metric; f s Represents a mapping function; x i Indicates the first i Near-infrared spectral data of one compound fertilizer sample; y i This represents the baseline value during the training process. The parameters to be optimized are all trainable parameters.

[0030] The advantage of lightweight 1D-CNN models lies in their simplified parameters. The residual dense connection method can maximize feature utilization, making it easy to deploy and learn knowledge from the teacher network, and also easy to align with the features of the teacher network.

[0031] S6. Input the dataset into the teacher network and the student network. Based on the temperature scaling technique, use the teacher data as a soft target to form a supervision signal. The student network outputs student data under the supervision of the supervision signal. During the supervision process, the distillation loss function is used to optimize the student data.

[0032] The distillation loss function in step S6 is as follows: ; In the formula, D soft Indicates the similarity in distribution between student data and teacher data; D hard This indicates the difference in distribution between student data and teacher data; Indicates the equilibrium hyperparameters; f T This indicates a teacher network that has completed pre-training. Indicates a soft target. y This represents the label parameter.

[0033] In S6, teacher data (soft objectives) generated by a teacher network is introduced as a supervision signal. Temperature scaling is used to smooth the probability distribution and enhance the information content of knowledge transfer. The relative importance of soft and hard objectives is controlled by balancing hyperparameters.

[0034] S7. Based on a multi-level feature alignment mechanism, the middle layer of the student network is aligned with the middle layer of the teacher network. The alignment process optimizes the alignment result through the feature distillation loss function. The characteristic distillation loss function in step S7 is as follows: ; In the formula, L FD Indicates characteristic distillation loss; and These represent the student network and the teacher network, respectively. l Feature mapping degree of the layer; (-) represents the feature similarity measurement function. Indicates the importance weight of the hierarchy; L This represents the set of network layers.

[0035] In S7, the intermediate layer specifically refers to the internal representation layers in the teacher network and student network that have corresponding semantic levels. In this application, the intermediate layer of the teacher network includes the output of the graph neural network layer, the output of the self-attention mechanism, and the output of the Transformer encoder; the intermediate layer of the student network corresponds to the output of several convolutional modules in its residual dense connection structure. By establishing a feature alignment loss between these specific levels, the student network is forced to mimic the behavior of the teacher network at multiple levels, such as local spectral modeling, global band correlation, and chemical semantic abstraction.

[0036] S8. According to steps S4~S7, the student network is trained using the dataset, and the student data output by the trained student network is used as the result of compound fertilizer attribute analysis.

[0037] Through the above technical solution, this application introduces a teacher-student knowledge distillation framework in the analysis of compound fertilizer properties. Based on a structurally complex teacher network, high-discriminative features are extracted from limited labeled data, and then the knowledge is transferred to a lightweight student network. This technical approach can significantly alleviate the overfitting problem caused by the scarcity of labeled samples in the near-infrared spectroscopy analysis of compound fertilizers, and significantly improve the prediction quality of compound fertilizer properties.

[0038] For any parts not mentioned in this application, existing technologies may be used or referenced.

[0039] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for attribute analysis based on infrared spectral data of compound fertilizer, characterized in that, Includes the following steps: S1. Obtain the near-infrared spectral dataset of compound fertilizer samples, and perform preprocessing and calculate the covariance matrix; S2. Add a self-attention mechanism and a Transformer encoder to the graph neural network to form a teacher network; In a graph neural network, the near-infrared spectrum of a sample is used as a graph, each wavelength point in the graph is used as a node, and the feature vector is used as node information. The information of adjacent nodes is aggregated to update the nodes in order to extract the local structural feature sequence of the near-infrared spectrum. The self-attention mechanism receives a sequence of local structural features and calculates the attention coefficient between any two nodes. It performs attention constraints and initialization based on the covariance matrix to generate a weighted fusion feature that can characterize the chemical correlation between nodes. The Transformer encoder performs multi-layer nonlinear transformation based on weighted fusion features to generate high-level chemical features characterizing the chemical properties of compound fertilizer. S3. The teacher network is trained based on the dataset, and the teacher network outputs teacher data through a fully connected layer; S4. A lightweight 1D-CNN model is used as the baseline model. In the baseline model, residual dense connections are used to connect each convolutional layer to form a student network. The student network can generate student data after being trained on the dataset. S6. Input the dataset into the teacher network and the student network. Based on the temperature scaling technique, use the teacher data as a soft target to form a supervision signal. The student network outputs student data under the supervision of the supervision signal. During the supervision process, the distillation loss function is used to optimize the student data. S7. Based on a multi-level feature alignment mechanism, the middle layer of the student network is aligned with the middle layer of the teacher network. The alignment process optimizes the alignment result through the feature distillation loss function. S8. According to steps S4~S7, the student network is trained using the dataset, and the student data output by the trained student network is used as the result of compound fertilizer attribute analysis.

2. The attribute analysis method based on infrared spectral data of compound fertilizer according to claim 1, characterized in that, In S2, the model for aggregating neighboring node information is as follows: ; In the formula, Indicates the first l Layer nodes i The updated feature vector; Indicates the first l Layer nodes i eigenvectors; i>N( i ) represents a node i The set of adjacent nodes; , Representing nodes respectively i and nodes j Normalized node degree; This represents a trainable weight matrix. Represents a nonlinear activation function; Indicates the first l Layer adjacent nodes j The characteristics are represented.

3. The attribute analysis method based on infrared spectral data of compound fertilizer according to claim 2, characterized in that, In S4, the convolutional layers in the baseline model are calculated as follows: ; In the formula, f i Indicates the first i One convolutional layer; Relu represents the Relu activation function; BN Indicates batch normalization; K Indicates the total number of convolutional layers; s( i + j ) indicates at index position ( i+j The absorption intensity value at the sampling point; w j Indicates that the convolution kernel is in j The weight of each position; b This indicates the bias term.

4. The attribute analysis method based on infrared spectral data of compound fertilizer according to claim 3, characterized in that, In S4, the expression for residual-dense joins is as follows: ; In the formula, x l Indicates the first l The output features of the layer; x 0、 x 1… x l-1 H represents the features of each convolutional layer; l Indicates the first l The nonlinear transformation function of the layer.

5. The property analysis method based on infrared spectral data of compound fertilizer according to claim 4, characterized in that, In S4, the student data generated after the student network is trained on the dataset is the basic feature. The mathematical calculation model for the basic feature is as follows: ; In the formula, L base Indicates basic features; N Indicates the total number of samples; Indicates the parameters to be optimized; D (-) indicates a distance metric; f s Represents a mapping function; x i Indicates the first i Near-infrared spectral data of one compound fertilizer sample; y i This represents the baseline value during the training process.

6. The attribute analysis method based on infrared spectral data of compound fertilizer according to claim 5, characterized in that, The distillation loss function in step S6 is as follows: ; In the formula, D soft This indicates the similarity in distribution between student data and teacher data; D hard This indicates the difference in distribution between student data and teacher data; Indicates the equilibrium hyperparameters; f T This indicates a teacher network that has completed pre-training. Indicates a soft target. y This represents the label parameter.

7. The attribute analysis method based on infrared spectral data of compound fertilizer according to claim 6, characterized in that, The characteristic distillation loss function in step S7 is as follows: ; In the formula, L FD Indicates characteristic distillation loss; and These represent the student network and the teacher network, respectively. l Feature mapping degree of the layer; (-) represents the feature similarity measurement function. Indicates the importance weight of the hierarchy; L This represents the set of network layers.