Soil X-ray fluorescence spectrum classification method
By combining the methods of convolutional neural network (CNN) and balance optimizer (EO), the characteristics of soil X-ray fluorescence spectroscopy (XRF) data are automatically extracted and optimized, and the problem of insufficient soil classification efficiency and accuracy in the prior art is solved, and efficient and accurate soil classification is achieved.
Patent Information
- Application Number
- CN202411937390.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-04
AI Technical Summary
The existing soil spectral data processing methods are inefficient and difficult to deal with complex patterns and noise problems, resulting in insufficient soil classification efficiency and accuracy.
The method of convolutional neural network (CNN) combined with balance optimizer (EO) is used to automatically extract and optimize soil X-ray fluorescence spectroscopy (XRF) data to build a soil classification network model.
The classification accuracy of soil XRF spectral data is significantly improved, the dependence on artificial feature engineering is reduced, classification efficiency is improved, and noise and complex patterns are effectively dealt with, and the stability and noise resistance of the model are enhanced.
Smart Images

Figure CN119763728A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of soil XRF spectrum analysis, and in particular to a soil X-ray fluorescence spectrum classification method. Background Art
[0002] Soil classification is an important research direction in the field of soil science. It is the basis for scientifically evaluating soil resources and building a classification system. Reasonable soil classification is of great significance for protecting the soil environment, rationally utilizing cultivated land resources, and promoting the development of agricultural modernization. At present, my country mainly uses two standards: soil system classification and soil genetic classification. Among them, soil genetic classification is more widely used because of its ease of application. This method is based on the various factors of soil formation, soil formation mechanism and its physical and chemical properties. Since there are significant differences in the element content of different types of soil, these differences can be expressed through spectral technology. X-ray fluorescence spectroscopy (XRF) is a fast, non-destructive and efficient elemental analysis technology that can accurately detect the content of various elements in the soil and reveal the differences in element distribution of different types of soil. In soil classification research, XRF technology has been widely used due to its high sensitivity and accuracy, especially in soil genetic classification based on spectral analysis. It has obvious advantages.
[0003] However, when existing methods process soil spectral data, the manual feature extraction method is inefficient and difficult to deal with complex patterns and noise problems in the data. Therefore, the introduction of automated feature extraction and optimization technology is the key to improving classification efficiency and accuracy. Convolutional neural network (CNN) is a deep learning model that can automatically extract features from spectral data and reduce dependence on manual feature engineering. Its hierarchical structure is suitable for the classification needs of soil spectral data. To solve the above problems, we propose a soil X-ray fluorescence spectroscopy classification method. Summary of the invention
[0004] In view of the deficiencies in the prior art, the present invention provides a soil X-ray fluorescence spectrum classification method to solve the problems raised in the background technology.
[0005] The above technical objectives of the present invention are achieved through the following technical solutions:
[0006] A soil X-ray fluorescence spectrum classification method comprises the following steps:
[0007] S1. Establishment of classification standards: Establish classification standards based on the oxide content of elements in the soil, such as SiO2, Al2O3, Fe2O3, MgO, CaO, K2O and Na2O, including the classification rules of sandy soil, loam, clay, acidic soil, alkaline soil and saline-alkali soil;
[0008] S2. Data labeling and set division: label the soil X-ray fluorescence spectroscopy (XRF) data according to the established classification criteria, and divide the data into training set, validation set and test set;
[0009] S3. Optimize the convolutional neural network (CNN) based on the balanced optimizer (EO) and establish a soil classification network model: Use the EO algorithm to optimize the parameters and hyperparameters of CNN, build a classification model and perform soil spectral classification.
[0010] Preferably, in step S1, the classification standard is based on the content range of various oxides in the soil, wherein:
[0011] Sandy soil: SiO2>70%, Al2O3<5%, Fe2O3<2%;
[0012] Loam: SiO2 30%-60%, Al2O3 10%-20%, Fe2O3 5%-10%;
[0013] Clay: SiO2<30%, Al2O3>20%, Fe2O3 5%-15%;
[0014] Acidic soil: Al2O3>10%, Fe2O3>15%;
[0015] Alkaline soil: CaO>15%, Na2O>5%;
[0016] Saline-alkali soil: Na2O>5%.
[0017] Preferably, in step S3, the construction of the convolutional neural network (CNN) comprises the following steps:
[0018] Define the convolutional layer, activation layer, pooling layer and fully connected layer structure of CNN;
[0019] The convolution layer uses multiple convolution kernels to extract soil spectral data features;
[0020] The activation layer uses the rectified linear unit (ReLU) activation function;
[0021] The pooling layer reduces the dimension of the feature map through the maximum pooling operation;
[0022] Fully connected layers are used for classification output.
[0023] Preferably, in step S3, the optimization process of the equilibrium optimizer (EO) comprises the following steps:
[0024] Initialize the population, generate initial solutions, and define parameter ranges;
[0025] Calculate the fitness value of each solution, using classification accuracy as the fitness indicator;
[0026] Build a balancing pool, select the top 4 optimal solutions, and use random solutions to enhance population diversity, and then randomly generate initial solutions within the range of variables according to the following formula:
[0027]
[0028] in, is the position of individual i at the tth iteration, r i is a random number in [0,1].
[0029] Preferably, the balancing pool includes an optimal solution, a suboptimal solution and an average solution, which are used to guide the update direction of subsequent solutions.
[0030] Preferably, in step S3, the training of the CNN model uses the following formula to calculate the output:
[0031] Convolution operation, the output of CNN is calculated by the following formula:
[0032] Z=Conv(X,W)+b
[0033] Among them, Z is the output of the convolution layer, Conv is the convolution operation, X is the input feature map, W is the convolution kernel, and b is the bias;
[0034] Use ReLU (rectified linear unit) as the activation function, the formula is as follows:
[0035] A=max(0,Z)
[0036] Maximum pooling, the formula is as follows:
[0037] A pool =maxpool(A)
[0038] The output of the pooling layer is flattened and passed to the fully connected layer, and the final output is a probability distribution of 6 categories, using the softmax activation function:
[0039] Y pred =softmax(W fc ·A pool +b fc )
[0040] The cross entropy loss function is used to calculate the loss of the model:
[0041]
[0042] Among them, y i is the true label, is the predicted probability.
[0043] Furthermore, the Adam optimizer is used to update the model parameters, and the update formula is:
[0044]
[0045] Where m and v are the first and second order moments, η is the learning rate, and ε is a small constant to avoid division by zero errors;
[0046] When the training round reaches the hyperparameter epoch, the network training ends;
[0047] Then calculate the fitness value to verify the performance of the model on the validation set, and select accuracy as the fitness indicator;
[0048] Select the top 4 best solutions from the population to form a balancing pool C eq,pool , and includes the average solution C eq,ave :
[0049]
[0050] C eq,pool ={C eq,1 ,C eq,2 ,C eq,3 ,C eq,4 ,C eq,ave}
[0051] make Where Iter is the current number of iterations, and Max_iter is the maximum number of iterations;
[0052] Update the exponential term coefficient F by the following formula:
[0053] F = a1·sign(r-0.5)(e -λt -1)
[0054]
[0055] G0=GCP(C eq -λC)
[0056] G=G0F
[0057] Where r is a random number in [0,1], a1 and λ are control parameters:
[0058] Update the population according to the following formula:
[0059]
[0060] When the number of iterations of the algorithm reaches Max_iter, the algorithm is stopped and the best parameters after the iteration are used as the parameters and hyperparameters of the convolutional neural network.
[0061] Through the above steps, the characteristics of convolutional neural networks and the balanced optimization algorithm are combined to achieve efficient classification of soil XRF spectra.
[0062] Preferably, in step S3, the EO optimization process stops after the population reaches the maximum number of iterations, and the solution with the best fitness is selected as the final CNN model parameters.
[0063] Preferably, the model is suitable for soil spectral data classification tasks with large noise interference, and can be further used in environmental monitoring and agricultural management.
[0064] In summary, the present invention mainly has the following beneficial effects:
[0065] 1. The present invention combines an equilibrium optimizer (EO) with a convolutional neural network (CNN), and uses EO to globally optimize the parameters and hyperparameters of CNN, so that the classification accuracy of the classification model in soil X-ray fluorescence spectrum (XRF) data is significantly improved. The present invention uses CNN to automatically extract multi-level features in spectral data, reducing dependence on artificial feature engineering, which not only improves the classification efficiency, but also reduces the uncertainty caused by human intervention.
[0066] 2. The EO algorithm optimizes the global search capability of the solution space by simulating the equilibrium mechanism, so that the model can more effectively deal with the noise and complex patterns in the spectral data. The EO algorithm avoids the problem that traditional optimization methods are prone to fall into local optimality, greatly shortens the time of model parameter search, and accelerates the convergence speed of the CNN model, improving computational efficiency.
[0067] 3. The present invention is applicable to the classification tasks of various types of soils, especially the classification of complex spectral data. It can also be extended to the fields of environmental monitoring, agricultural management and soil resource evaluation, providing efficient and accurate technical support for related industries. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 This is a schematic diagram of the soil XRF spectrum classification method based on EO-CNN of the present invention. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the described embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0070] The following examples are used to illustrate the present invention, but they cannot be used to limit the scope of protection of the present invention. The conditions in the examples can be further adjusted according to specific conditions. Simple improvements to the method of the present invention under the premise of the concept of the present invention belong to the scope of protection claimed in the present invention.
[0071] Example 1
[0072] refer to Figure 1 , a soil X-ray fluorescence spectrum classification method, comprising the following steps:
[0073] S1. Establishment of classification standards: Establish classification standards based on the oxide content of elements in the soil, such as SiO2, Al2O3, Fe2O3, MgO, CaO, K2O and Na2O, including the classification rules of sandy soil, loam, clay, acidic soil, alkaline soil and saline-alkali soil;
[0074] S2. Data labeling and set division: label the soil X-ray fluorescence spectroscopy (XRF) data according to the established classification criteria, and divide the data into training set, validation set and test set;
[0075] S3. Optimize the convolutional neural network (CNN) based on the balanced optimizer (EO) and establish a soil classification network model: Use the EO algorithm to optimize the parameters and hyperparameters of CNN, build a classification model and perform soil spectral classification.
[0076] In step S1, the classification standard is based on the content range of various oxides in the soil, where:
[0077] Sandy soil: SiO2>70%, Al2O3<5%, Fe2O3<2%;
[0078] Loam: SiO2 30%-60%, Al2O3 10%-20%, Fe2O3 5%-10%;
[0079] Clay: SiO2<30%, Al2O3>20%, Fe2O3 5%-15%;
[0080] Acidic soil: Al2O3>10%, Fe2O3>15%;
[0081] Alkaline soil: CaO>15%, Na2O>5%;
[0082] Saline-alkali soil: Na2O>5%;
[0083] As shown in the following table:
[0084] Soil Type SiO2(%) Al2O3(%) Fe2O3(%) MgO(%) CaO(%) K2O(%) Na2O(%) sand >70 <5 <2 - - <1 - Loam 30-60 10-20 5-10 3-7 5-15 1-3 <1 clay <30 >20 5-15 <5 <5 - - Acidic soil - >10 >15 - <5 - - Alkaline soil - <5 <5 - >15 - >5 Saline-alkali soil - - - - - - >5
[0085] Example 2
[0086] In combination with step S3, the construction of the convolutional neural network (CNN) includes the following steps:
[0087] Define the convolutional layer, activation layer, pooling layer and fully connected layer structure of CNN;
[0088] The convolution layer uses multiple convolution kernels to extract soil spectral data features;
[0089] The activation layer uses the rectified linear unit (ReLU) activation function;
[0090] The pooling layer reduces the dimension of the feature map through the maximum pooling operation;
[0091] Fully connected layers are used for classification output.
[0092] Example 3
[0093] In conjunction with step S3, the optimization process of the equilibrium optimizer (EO) includes the following steps:
[0094] Initialize the population, generate initial solutions, and define parameter ranges;
[0095] Calculate the fitness value of each solution, using classification accuracy as the fitness indicator;
[0096] Build a balancing pool, select the top 4 optimal solutions, and use random solutions to enhance population diversity, and then randomly generate initial solutions within the range of variables according to the following formula:
[0097]
[0098] in, is the position of individual i at the tth iteration, r i is a random number in [0,1];
[0099] The balancing pool includes the optimal solution, suboptimal solution and average solution, which are used to guide the update direction of subsequent solutions;
[0100] In step S3, the CNN model is trained to calculate the output using the following formula:
[0101] Convolution operation, the output of CNN is calculated by the following formula:
[0102] Z=Conv(X,W)+b
[0103] Among them, Z is the output of the convolution layer, Conv is the convolution operation, X is the input feature map, W is the convolution kernel, and b is the bias;
[0104] Use ReLU (rectified linear unit) as the activation function, the formula is as follows:
[0105] A=max(0,Z)
[0106] Maximum pooling, the formula is as follows:
[0107] A pool =maxpool(A)
[0108] The output of the pooling layer is flattened and passed to the fully connected layer, and the final output is a probability distribution of 6 categories, using the softmax activation function:
[0109] Y pred =softmax(W fc ·A pool +b fc )
[0110] The cross entropy loss function is used to calculate the loss of the model:
[0111]
[0112] Among them, y i is the true label, is the predicted probability;
[0113] Furthermore, the Adam optimizer is used to update the model parameters, and the update formula is:
[0114]
[0115] Where m and v are the first and second order moments, η is the learning rate, and ε is a small constant to avoid division by zero errors;
[0116] When the training round reaches the hyperparameter epoch, the network training ends;
[0117] Then calculate the fitness value to verify the performance of the model on the validation set, and select accuracy as the fitness indicator;
[0118] Select the top 4 best solutions from the population to form a balancing pool C eq,pool , and includes the average solution C eq,ave :
[0119]
[0120] C eq,pool ={C eq,1 ,C eq,2 ,C eq,3 ,C eq,4 ,C eq,ave}
[0121] make Where Iter is the current number of iterations, and Max_iter is the maximum number of iterations;
[0122] Update the exponential term coefficient F by the following formula:
[0123] F = a1·sign(r-0.5)(e -λt -1)
[0124]
[0125] G0=GCP(C eq -λC)
[0126] G=G0F
[0127] Where r is a random number in [0,1], a1 and λ are control parameters:
[0128] Update the population according to the following formula:
[0129]
[0130] When the number of iterations of the algorithm reaches Max_iter, the algorithm is stopped and the best parameters after the iteration are used as the parameters and hyperparameters of the convolutional neural network.
[0131] Through the above steps, the characteristics of convolutional neural networks and the balanced optimization algorithm are combined to achieve efficient classification of soil XRF spectra.
[0132] The EO optimization process stops when the population reaches the maximum number of iterations, and the solution with the best fitness is selected as the final CNN model parameters.
[0133] Working principle: The present invention is based on X-ray fluorescence spectroscopy (XRF) technology. By analyzing the characteristic differences in the content of elemental oxides in soil samples, a classification standard is established, and automatic classification is achieved by combining a balance optimizer (EO) and a convolutional neural network (CNN). First, the soil types are divided and the data is labeled according to the main oxide content of different types of soil. The data is divided into a training set, a validation set, and a test set. Then, the EO algorithm is used to globally optimize the parameters and hyperparameters of the CNN model to construct a highly robust soil classification model. In model training, the convolution layer extracts the hierarchical features of the spectral data, the pooling layer reduces the data dimension, and the fully connected layer outputs the classification results. Finally, the probability distribution of each soil category is calculated through the Softmax function. The EO algorithm simulates the interaction between objects through a balance mechanism, continuously optimizes parameters to improve the classification accuracy of the model, and makes the classification results more stable and noise-resistant.
[0134] Although the embodiments of the present invention have been shown and described, it is understood by those skilled in the art that, unless otherwise defined, the technical terms or scientific terms used in the present invention should have the usual meanings understood by persons with ordinary skills in the field to which the present invention belongs, and the words "include" or "comprise" and the like used in the present invention mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents.
[0135] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A soil X-ray fluorescence spectroscopy classification method, characterized in that: The following steps are involved: S1. Establishment of classification standards: Establish classification standards based on the oxide content of elements in the soil, such as SiO2, Al2O3, Fe2O3, MgO, CaO, K2O and Na2O, including the classification rules of sandy soil, loam, clay, acidic soil, alkaline soil and saline-alkali soil; S2. Data labeling and set division: label the soil X-ray fluorescence spectroscopy (XRF) data according to the established classification criteria, and divide the data into training set, validation set and test set; S3. Optimize the convolutional neural network (CNN) based on the balanced optimizer (EO) and establish a soil classification network model: Use the EO algorithm to optimize the parameters and hyperparameters of CNN, build a classification model and perform soil spectral classification.
2. A soil X-ray fluorescence spectrum classification method according to claim 1, characterized in that: In step S1, the classification standard is based on the content range of various oxides in the soil, where: Sandy soil: SiO2>70%, Al2O3<5%, Fe2O3<2%; Loam: SiO2 30%-60%, Al2O3 10%-20%, Fe2O3 5%-10%; Clay: SiO2<30%, Al2O3>20%, Fe2O35%-15%; Acidic soil: Al2O3>10%, Fe2O3>15%; Alkaline soil: CaO>15%, Na2O>5%; Saline-alkali soil: Na2O>5%.
3. The soil X-ray fluorescence spectrum classification method according to claim 1, characterized in that: In step S3, the construction of the convolutional neural network (CNN) includes the following steps: Define the convolutional layer, activation layer, pooling layer and fully connected layer structure of CNN; The convolution layer uses multiple convolution kernels to extract soil spectral data features; The activation layer uses the rectified linear unit (ReLU) activation function; The pooling layer reduces the dimension of the feature map through the maximum pooling operation; Fully connected layers are used for classification output.
4. The soil X-ray fluorescence spectrum classification method according to claim 1, characterized in that: In step S3, the optimization process of the equilibrium optimizer (EO) includes the following steps: Initialize the population, generate initial solutions, and define parameter ranges; Calculate the fitness value of each solution, using classification accuracy as the fitness indicator; Build a balancing pool, select the top 4 optimal solutions, and use random solutions to enhance population diversity, and then randomly generate initial solutions within the range of variables according to the following formula: in, is the position of individual i at the tth iteration, r i is a random number in [0,1].
5. A soil X-ray fluorescence spectrum classification method according to claim 4, characterized in that: The balancing pool includes an optimal solution, a suboptimal solution and an average solution, which are used to guide the update direction of subsequent solutions.
6. The soil X-ray fluorescence spectrum classification method according to claim 1, characterized in that: In step S3, the training of the CNN model uses the following formula to calculate the output: Convolution operation, the output of CNN is calculated by the following formula: Z=Conv(X,W)+b Among them, Z is the output of the convolution layer, Conv is the convolution operation, X is the input feature map, W is the convolution kernel, and b is the bias; Use ReLU (rectified linear unit) as the activation function, the formula is as follows: A=max(0,Z) Maximum pooling, the formula is as follows: A pool =maxpool(A) The output of the pooling layer is flattened and passed to the fully connected layer, and the final output is a probability distribution of 6 categories, using the softmax activation function: Y pred =softmax(W fc ·A pool +b fc ) The cross entropy loss function is used to calculate the loss of the model: Among them, y i is the true label, is the predicted probability.
7. The soil X-ray fluorescence spectrum classification method according to claim 1, characterized in that: In step S3, the EO optimization process stops after the population reaches the maximum number of iterations, and the solution with the best fitness is selected as the final CNN model parameters.
8. The soil X-ray fluorescence spectrum classification method according to claim 1, characterized in that: The model is suitable for the classification task of soil spectral data with large noise interference, and can be further used in environmental monitoring and agricultural management.