A method for predicting soil element content based on fractional-order multi-channel
The best order is screened through fractional differential transformation and electric eel foraging optimization algorithm, and combined with the GA-PLE network architecture, a soil multi-element content prediction model was constructed, solving the problem of imbalance in soil element content prediction under multi-element conditions, and achieving high-precision, fast and lossless multi-element quantitative detection.
Patent Information
- Application Number
- CN202411555267.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-04
AI Technical Summary
The prior art has the problem of model prediction imbalance in soil element content prediction under multi-element conditions, making it difficult to achieve fast, lossless and accurate multi-element quantitative detection.
The soil element content prediction method based on fractional order multi-channel is adopted, and the best order is screened through fractional order differential transformation and electric eel foraging optimization algorithm, and the soil multi-element content prediction model is constructed based on the GA-PLE network architecture, and the multi-channel input data is used for training and verification.
It effectively alleviates the problem of task imbalance under multi-element conditions, improves the prediction accuracy of soil elements, and supports fast, lossless and accurate multi-element quantitative detection.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] The invention relates to a method for predicting soil element content based on fractional-order multi-channel, and belongs to the technical field of soil spectrum acquisition and analysis. Background Art
[0002] Detection of soil element content is an important process in environmental governance, agricultural production and food safety. In particular, soil heavy metals have hysteresis and accumulation, so it is difficult to detect them in time. Once the concentration of heavy metals exceeds a certain threshold, they will enter the food chain through plants and other channels, which may eventually cause harm to human health. Therefore, how to quickly, non-destructively and accurately detect the content of heavy metals in soil has far-reaching significance for environmental protection and agricultural production activities. In the previous quantitative detection process of soil heavy metal content, not only did it need to collect a lot of samples, but they also needed to be sent to the laboratory for chemical analysis based on the properties of different heavy metals. This detection process would take a lot of time and it was difficult to meet the current needs of environmental pollution management.
[0003] Visible near-infrared spectroscopy (VIS-NIRS) is different from traditional laboratory physical and chemical detection methods. NIRS realizes quantitative analysis of samples to be tested through modeling, and has the advantages of no need to use chemical reagents, high stability, and high analysis efficiency. In recent years, with the development of deep learning, more deep learning algorithms have begun to be applied to the field of soil spectral acquisition and analysis, and have shown better performance than traditional machine learning. However, most models only predict a single element. Although this method can achieve high prediction accuracy, it requires repeated modeling when facing multi-element content prediction. Not only that, some studies also study modeling under multi-element conditions, but it will cause task imbalance. Therefore, a soil element content prediction method based on fractional-order multi-channel is proposed to achieve content prediction under multi-element conditions. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a method for predicting soil element content based on fractional-order multi-channel to solve the problem of imbalance between quantitative detection and model prediction under multi-element conditions.
[0005] The technical scheme of the present invention is: a method for predicting soil element content based on fractional order multi-channel, firstly, soil samples are collected and visible near-infrared spectra and multiple soil element contents are measured, then soil spectrum data are divided into training set and test set, and the training set and test set are preprocessed and feature bands are screened respectively; then the training set and test set are further processed by fractional order differential method and the best order is screened out in combination with electric eel foraging optimization algorithm to be spliced with original data to form multi-channel input data, and then a soil multi-element content prediction model is constructed using fractional order multi-channel adaptive progressive hierarchical extraction (GA-PLE) network; multiple metal content prediction models are trained using multi-channel data of training set, and finally the prediction accuracy of each model is evaluated using evaluation index using validation set.
[0006] The specific steps are as follows:
[0007] Step 1: Collect soil samples and measure the visible near-infrared spectrum data and soil element content of each soil sample;
[0008] Step 2: Use statistical sampling methods to divide the obtained spectral data and soil element content into training sets and test sets in proportion;
[0009] Step 3: Preprocess the obtained training set and test set and screen the characteristic bands;
[0010] Among them, the Savitzky-Golay (SG) smoothed cascade standard normal transformation (SNV, Standard NormalVariate) is used
[0011] The visible and near-infrared spectral data of the training set and the test set were denoised, and then the near-infrared spectral data of the training set and the test set were normalized to the maximum and minimum respectively. Finally, the characteristic bands of the pre-processed data were extracted using the Pearson correlation coefficient method.
[0012] Step 4: Perform fractional differential transformation on the training set and test set preprocessed in Step 3. This is because fractional differentials have the advantage of being able to refine the information of spectral reflectance and effectively avoid the introduction of noise peaks, which is very beneficial for the prediction model to capture the nonlinear relationship in spectral data. However, although there are multiple fractional orders within the specified range, it becomes a difficult problem to select the order with a higher contribution to the target task. Therefore, the electric eel foraging optimization algorithm is introduced, and the root mean square error (RMSE) between the predicted value and the measured value under the optimization partial least squares modeling is used. ) find the orders with higher contribution and splice them with the orders before transformation to help the inversion model obtain more characteristic information.
[0013] Specifically:
[0014] Step 4.1: Perform fractional differential transformation on the data preprocessed in Step 3. The transformation formula is as follows:
[0015]
[0016] in, is the soil spectral reflectance, represents the fractional order, , is the reference point for approximate calculation, is the step size for fractional differential calculation, n is With point The distance between The discretization representation of represents the function whose fractional derivative is to be found, is the gamma function.
[0017] Step 4.2: The data transformed in Step 3.1 is screened for contribution order using the electric eel foraging optimization algorithm. The optimization process can be expressed as follows:
[0018]
[0019] in, is the moment, C is the constant used to adjust the step size, and is a random number between (0,1), It is The suitability of the next candidate position, , is a randomly selected electric eel position from the current population and , is the mean position of all electric eels, It is an electric eel At the new time position, n is the population size, is a random vector in (0,1), and are the upper and lower limits respectively.
[0020] In the fractional differential transformation process, the order range is first determined, and the order is increased with a fixed step size to finally obtain the results of several orders. Then, the results of the several orders are respectively input into the electric eel foraging optimization algorithm. In the iterative process of the optimization algorithm, the predicted contents of arsenic, nickel and chromium are respectively obtained by using the partial least squares regression algorithm. Finally, the root mean square errors of the arsenic, nickel and chromium contents and the measured values are calculated, and the average value is taken to minimize the average value. Get the final order group.
[0021] Step 5: Although traditional deep neural networks (DNN) and convolutional neural networks (CNN) can capture nonlinear relationships in spectral data, they do not have a dedicated task balance module under multi-element prediction conditions, so task imbalance is prone to occur. In order to solve the above problems, the present invention proposes a new multi-element soil content prediction architecture GA-PLE. For each task, this model architecture has its own expert network that can learn the unique information in each task. In addition, each task also has a gating network that can obtain more useful information from the shared expert network. This architecture can not only adapt to different numbers of tasks, but also adaptively adjust the weight of each task under multi-task conditions to prevent the occurrence of task imbalance, that is, the prediction performance of a certain task is excellent while the prediction performance of another task is poor. The present invention achieves this goal by improving the loss function.
[0022] Specifically:
[0023]
[0024] in, Indicates the predicted content quantity, represents the predicted value of the i-th task, It is The observed value of a task, It is a The parameters that can be learned by each task.
[0025] The network architecture of the present invention is constructed using the Pytorch deep learning framework and Python 3.7 language, and then the model is trained using the multi-channel input data, and finally the model is constructed according to the size of the loss function.
[0026] Step 6: Input the multi-channel input data into the soil element content prediction model to complete the soil element content prediction;
[0027] The constructed prediction model was loaded, the test set was input into the model, the determination coefficient, root mean square error and relative analysis error were calculated based on the actual soil element content, and the prediction model was comprehensively evaluated based on the three evaluation indicators to complete the model's prediction of arsenic, nickel and chromium.
[0028] The beneficial effects of the present invention are: the present invention can realize the prediction of soil element content under single-task and multi-task conditions and can effectively alleviate the problem of task imbalance under multi-task conditions. At the same time, the present invention can effectively improve the prediction accuracy of existing soil elements, can realize fast, non-destructive and accurate prediction, and provide strong technical support for the quantitative prediction of soil elements. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a flow chart of the steps of the present invention;
[0030] Figure 2 It is a statistical graph of the data set content;
[0031] Figure 3 It is the characteristic band screening diagram;
[0032] Figure 4 It is a statistical graph of the frequency of occurrence of orders under the electric eel foraging optimization algorithm;
[0033] Figure 5 It is a comparison diagram of the best contribution order of different soil elements;
[0034] Figure 6 This is the GA-PLE network architecture diagram;
[0035] Figure 7 It is a scatter plot of the predicted and measured values of the test set on the GA-PLE network architecture after each sample is denormalized. DETAILED DESCRIPTION
[0036] The content of the present invention is further described below through the drawings and specific embodiments, but this does not limit the scope of the present invention.
[0037] Example 1: Soil samples were collected from a farmland. There is a rich mineral deposit 10 kilometers away from the sampling area. Due to the long-term development of mineral resources, the surrounding farmland environment has been polluted to a certain extent. There is a river near the mine, and the water source for irrigation of the surrounding farmland comes from it.
[0038] like Figure 1 As shown in FIG. 1 , a method for predicting soil element content based on fractional-order multi-channel includes the following steps:
[0039] Step 1: Soil sample collection: The soil samples in this example were collected from February 11 to 15, 2022. A grid was used to collect 61, 60, and 62 sampling points in the upper, middle, and lower reaches of the river. The collection depth of each soil sample is 0-20 cm, and visible impurities such as gravel and weeds are cleaned during the sampling process. Then, the soil sample is placed in a sealed bag and the location information is marked. When the soil sample is transported back to the laboratory, it is first dried and ground using glassware. Use the ASDFieldSpec3 spectrometer to collect near-infrared spectral data in a dark room.
[0040] Step 2: The soil spectral data and soil element content collected in Step 1 are divided using the conditional Latin hypercube algorithm, and the soil samples are divided into a training set and a test set in a ratio of 2:1. The statistical results of the divided data set are shown in Figure 2, it can be seen that each element of the divided training set and test set is relatively uniform, and the division is representative.
[0041] Step 3: Use Savitzky-Golay (SG) smoothing cascade Standard Normal Variate (SNV) to denoise the visible near-infrared spectral data of the training set and the test set. Then, perform maximum and minimum normalization on the spectral data of the training set and the test set. Finally, use the Pearson correlation coefficient method to screen the characteristic bands of the preprocessed training set and the test set. A total of 85 characteristic bands are screened out. The results are as follows: Figure 3 shown.
[0042] Step 4: Perform fractional differential transformation on the training set and test set preprocessed in Step 3. This is because fractional differentials have the advantage of being able to refine the information of spectral reflectance and effectively avoid the introduction of noise peaks, which is very beneficial for the prediction model to capture the nonlinear relationship in spectral data. However, although there are multiple fractional orders within the specified range, it becomes a difficult problem to select the order with higher contribution to the target task. Therefore, the electric eel foraging optimization algorithm is introduced to optimize the relationship between the predicted value and the measured value under the partial least squares modeling. Find the order with higher contribution and splice it with the order before transformation to help the inversion model obtain more characteristic information. Specifically, it includes the following steps:
[0043] Step 4.1: Perform fractional differential transformation on the data preprocessed in Step 3. The transformation formula is as follows:
[0044]
[0045] in, is the soil spectral reflectance, represents the fractional order, , is the reference point for approximate calculation, is the step size for fractional differential calculation, n is With point The distance between The discretization representation of represents the function whose fractional derivative is to be found, is the gamma function.
[0046] Step 4.2: The data transformed in Step 4.1 is screened for contribution order using the electric eel foraging optimization algorithm. The optimization process can be expressed as follows:
[0047]
[0048] in, and is a random number between (0,1), It is The suitability of the next candidate position, , is a randomly selected electric eel position from the current population and , n is the population size, is a random vector in (0,1), and are the upper and lower limits respectively. Under the electric eel foraging optimization algorithm, the number of occurrences of each order is as follows Figure 4 In order to achieve content prediction under multi-element conditions, the intersection of the orders of arsenic, nickel and chromium is selected and their number is counted to obtain the best order group. The results are shown in Figure 5 Then, the most frequent order and the second most frequent order were combined with the original spectral data for GA-PLE modeling, and four experiments were performed to determine the coefficients. As an order evaluation index. Figure 5 It can be observed that the two orders of 0.9 and 0.2 make great contributions to the prediction of arsenic, nickel, and chromium. Finally, the spectral data of the 0.9-order and 0.2-order fractional order transformations are spliced with the preprocessed original spectral data to obtain the three-channel input data.
[0049] Step 5: Although traditional DNN and CNN can capture nonlinear relationships in spectral data, they do not have a dedicated task balancing module under multi-element prediction conditions, so task imbalance is prone to occur. In order to solve the above problems, the present invention proposes a new multi-element soil content prediction architecture GA-PLE. For each task, this model architecture has its own expert network that can learn the unique information in each task. In addition, each task also has a gating network that can obtain more useful information from the shared expert network. This architecture can not only adapt to different numbers of tasks, but also adaptively adjust the weight of each task under multi-task conditions to prevent the occurrence of task imbalance, that is, the prediction performance of a certain task is excellent while the prediction performance of another task is poor. The present invention achieves this goal by improving the loss function.
[0050] Specifically:
[0051]
[0052] in, Indicates the predicted content quantity, represents the predicted value of the i-th task, It is The observed value of a task, It is a The parameters that can be learned in each task. In order to reflect the role of the loss function in the balance model task in this example, the traditional MSE loss function is used as the control experimental group. All models are built using the Pytorch deep learning framework and Python 3.7. The optimizer used in all networks is Adam, with a learning rate of 0.001. Each model is trained 500 times and As an evaluation indicator, save the best model. There are several processes for model establishment:
[0053] 1. The input training data dimensions of all models are (120, 85, 3), where 120 represents a total of 120 training data, 85 represents 85 spectral data features, and 3 represents the number of channels. Each channel is the original spectral data after preprocessing, the data after 0.2-order differentiation, and the data after 0.9-order differentiation.
[0054] 2. In each iteration, the predicted values of arsenic, nickel and cadmium obtained by the model are compared with their respective measured values. Calculation, finally saved The model with the largest model weight is the best model.
[0055] Among them, the GA-PLE model architecture of the present invention is as follows Figure 6 shown.
[0056] Step 6: Use the multi-channel data spliced in Step 4 to test the model in Step 5 and calculate the predicted and observed values of the model's multiple soil contents on the test set. , and interquartile range deviation ratio ( ), in order to comprehensively evaluate the prediction performance of the model. The closer it is to 1, The closer it is to 1, the better the prediction effect of the model. The data distribution can be well explained by the interquartile range. When , the model achieves excellent accuracy. When , the model provides an approximate estimate of accuracy, and when The estimated performance of the model is considered to be general. The modeling results of different models under different loss functions are shown in Table 1:
[0057]
[0058] Table 1: Modeling results of different models
[0059] From the perspective of loss function, after using the task adaptation loss function, the prediction accuracy of all models for different elements has been improved. The above results show that the improved loss function has the effect of balancing various tasks. In addition, from the perspective of the model, GA-PLE achieves the best prediction index for different elements when other models use the same loss function. It can be seen that GA-PLE can balance various tasks well. The scatter plot of the measured values and predicted values of the test set under the condition of multi-element content of GA-PLE of the present invention is shown in Figure 7 As shown, all points are denormalized.
[0060] The above example results show the effectiveness of the improved GA-PLE, and it can predict multiple soil contents at a time, which improves the efficiency of soil quantitative prediction and has practical application value.
[0061] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.
Claims
1. A method for predicting soil element content based on fractional order multi-channel, characterized by: Step 1: Collect soil samples and measure the visible near-infrared spectrum data and soil element content of each soil sample; Step 2: Use statistical sampling methods to divide the obtained spectral data and soil element content into training sets and test sets in proportion; Step 3: Preprocess the obtained training set and test set and screen the characteristic bands; Step 4: Perform fractional differential transformation on the training set and test set that have been screened by the characteristic bands, and screen the contribution order in combination with the electric eel foraging optimization algorithm. Then, the preprocessed training set and test set are spliced with the training set and test set that have undergone fractional differential transformation in the channel dimension to form multi-channel input data. Step 5: Use fractional-order multi-channel adaptive progressive hierarchical extraction network to build a soil multi-element content prediction model; Step 6: Input the multi-channel input data into the soil element content prediction model to complete the soil element content prediction; The Step 4 is specifically as follows: Step 4.1: Perform fractional differential transformation on the training set and test set after feature band screening. The transformation formula is as follows: ; in, is the soil spectral reflectance, represents the fractional order, , is the reference point for approximate calculation, is the step size for fractional differential calculation, n is With point The distance between The discretization representation of represents the function whose fractional derivative is to be found, is the gamma function; Step 4.2: The transformed training set and test set are screened for contribution order using the electric eel foraging optimization algorithm. The optimization process is as follows: ; in, is the moment, C is the constant used to adjust the step size, and is a random number between (0,1), It is The suitability of the next candidate position, , is a randomly selected electric eel position from the current population and , is the mean position of all individual electric eels, It is an electric eel At the new time position, n is the population size, is a random vector in (0,1), and are the upper and lower limits respectively; In the fractional differential transformation process, the order range is first determined, and the order range is incremented with a fixed step size to finally obtain the results of several orders, and then the results of the several orders are respectively input into the electric eel foraging optimization algorithm. In the iterative process of the optimization algorithm, the predicted contents of arsenic, nickel and chromium are respectively obtained by using the partial least squares regression algorithm, and finally the root mean square errors of the arsenic, nickel and chromium contents and the measured values are calculated, and the average values are taken to minimize the root mean square error of the average value to obtain the final order group; The Step 5 is specifically as follows: first, the fractional-order multi-channel adaptive progressive hierarchical extraction network fuses the fractional-order multi-channel and the task adaptation loss function with the progressive hierarchical extraction network. The fractional-order multi-channel realizes the diversity of features to promote the learning of the prediction model. The task adaptation loss function is adjusted by the learnable parameters, and its formula is as follows: ; in, Indicates the predicted content quantity, represents the predicted value of the i-th task, It is The observed value of a task, It is a The parameters that can be learned by each task; The model is then trained using the multi-channel input data, and finally the model is constructed according to the size of the loss function.
2. The method for predicting soil element content based on fractional order multi-channel according to claim 1 is characterized in that: The soil element content includes arsenic, nickel and chromium.
3. The method for predicting soil element content based on fractional order multi-channel according to claim 1 is characterized in that: The Step 3 is specifically as follows: SG smoothing cascade standard normal transformation is used to denoise the visible near-infrared spectral data of the training set and the test set respectively, and then the near-infrared spectral data of the training set and the test set are respectively normalized to the maximum and minimum, and finally the Pearson correlation coefficient method is used to extract the characteristic bands of the preprocessed training set and the test set.
4. The method for predicting soil element content based on fractional order multi-channel according to claim 1 is characterized in that: The Step 6 is specifically as follows: load the constructed prediction model, input the test set into the model, calculate the determination coefficient, root mean square error and interquartile range deviation ratio based on the actual soil element content, and comprehensively evaluate the prediction model based on the three evaluation indicators of determination coefficient, root mean square error and interquartile range deviation ratio to complete the model's prediction of arsenic, nickel and chromium.
Citation Information
Patent Citations
Method for simultaneously predicting multiple soil attributes in soil wet state
CN114004147A
Lithium ion battery parameter identification method based on improved suburb wolf optimization algorithm
CN117192381A