Soil heavy metal content prediction method and device, electronic equipment and computer readable storage medium

Through spectrometer and deep learning technology, the spectral information of soil samples is decomposed and fused, and the existing detection methods are time-consuming and labor-intensive and difficult to deal with waste liquids, achieving efficient and low-cost soil heavy metal detection.

CN118914108APending Publication Date: 2024-11-08NORTHWEST INST OF NUCLEAR TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411033571.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

The existing soil heavy metal pollutant detection methods are time-consuming and labor-intensive, complex in the detection process, high in detection costs, and the chemical waste left over after the experiment is difficult to deal with.

Method used

The original spectral information of the soil sample was obtained by using a spectrometer, and it was decomposed into trend terms and seasonal terms through the seasonal trend decomposition method. Combined with the multi-layer perceptron model and the time-domain attention mechanism, data characteristics were obtained and fused to finally predict the heavy metal content of soil.

Benefits of technology

It realizes simple, efficient and low-cost soil heavy metal content detection, avoids the generation of chemical waste liquid, and improves detection accuracy and result accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118914108A_ABST
    Figure CN118914108A_ABST
Patent Text Reader

Abstract

The invention provides a soil heavy metal content prediction method and device, electronic equipment and a computer readable storage medium. The technical problems that an existing detection method wastes time and labor, the detection process is complex, the detection cost is high, chemical waste liquid left after an experiment is difficult to treat and the like are mainly solved. The soil heavy metal content prediction method comprises the following steps: acquiring original spectrum information of a visible-near infrared spectrum irradiating soil; decomposing the original spectral information into a trend item and a season item; acquiring data features of a trend item and data features of a season item; fusing the data features of the trend item with the data features of the season item to obtain overall data features; and determining a prediction result based on the overall data features. The prediction method does not need chemical reagents and manual operation, the detection process is simple and convenient, the detection speed is high, the detection cost is low, and no chemical waste liquid exists.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to optical detection technology, and in particular to a method, device, electronic device and computer-readable storage medium for predicting heavy metal content in soil. Background Art

[0002] Soil is an important foundation for the growth of plants and animals and the maintenance of the balance of the ecosystem. The study of soil conditions is of great significance to agricultural and industrial production. In order to meet the needs of economic and energy development, heavy metal mining production activities have developed rapidly, but also brought serious soil heavy metal pollution problems. Heavy metal pollutants penetrate into the soil, destroying the normal function of the soil, posing a serious threat to the health of plants and animals, and ultimately affecting the normal life of humans through the spread of the ecological chain.

[0003] With the development of modern science and technology and the in-depth study of heavy metal pollution prediction methods, the detection technology of soil heavy metal pollutants has achieved rapid development. At present, the main soil heavy metal pollutant detection technologies used by researchers include chemical extraction, inductively coupled plasma, atomic absorption spectroscopy, etc. This type of method can predict a variety of soil heavy metal pollutants, and has high detection accuracy, which can meet the detection requirements of different tasks. However, there are also many defects, including time-consuming and labor-intensive, complex detection process, high detection cost, and difficult to handle chemical waste liquid left after the experiment. Summary of the invention

[0004] The purpose of the present invention is to provide a method, device, electronic device and computer-readable storage medium for predicting the heavy metal content in soil, mainly to solve the technical problems that the existing detection methods are time-consuming and labor-intensive, the detection process is complicated, the detection cost is high, and the chemical waste liquid left after the experiment is difficult to handle.

[0005] To achieve the above purpose, the technical solution of the present invention is as follows:

[0006] A method for predicting heavy metal content in soil, which is special in that it includes the following steps:

[0007] S1. Use a spectrometer to illuminate the soil sample and obtain the original spectrum information of the soil sample in combination with a standard reflection white plate;

[0008] S2. Decomposing the original spectral information into a trend item and a season item by using a seasonal trend decomposition method; the trend item represents the spectral baseline information of the soil sample, and the season item represents the spectral information of the soil sample after the spectral baseline information is taken out;

[0009] S3. The data features of the trend item are obtained by a multi-layer perceptron model, and the data features of the season item are obtained by using a time-domain attention mechanism; the data features of the trend item include the main component information of the soil sample; the data information of the season item includes the material information with obvious characteristic bands after the main components of the soil sample are taken out;

[0010] S4, fusing the data features of the trend item with the data features of the season item to obtain the overall data features of the soil sample;

[0011] S5. Use a multi-layer perceptron model and combine the overall data characteristics of the soil samples to output the prediction results of the heavy metal content in the soil samples.

[0012] Furthermore, step S1 is specifically to use a spectrometer to illuminate soil samples at different sampling points to obtain the reflected light intensity I at different sampling points; then combine with a standard reflective whiteboard to obtain the reference reflected light intensity S and dark field light intensity D at different sampling points; finally, the formula The reflectance spectrum curve R of different sampling points is calculated, and then the original spectrum information of the soil sample is obtained.

[0013] Furthermore, step S2 specifically includes:

[0014] S201, using a moving average method to calculate the average data value of the original spectrum information within a preset wavelength range;

[0015] S202: Based on the average data value, the original spectral information is decomposed into a trend term and a seasonal term using a seasonal trend decomposition method.

[0016] Furthermore, step S202 also includes a step of normalizing the trend term and the season term so that the trend term and the season term have the same dimension.

[0017] Furthermore, in step S3, the time domain attention mechanism is a self-attention mechanism or a dual-head attention mechanism.

[0018] Furthermore, step S4 specifically includes:

[0019] S401, reducing the dimension of the data features of the trend item and the data features of the season item to 512 respectively;

[0020] S402, the data features of the trend item after dimensionality reduction and the data features of the season item are merged by adding, multiplying or concatenating according to a one-to-one correspondence, so as to obtain the overall characteristic data of the soil sample.

[0021] At the same time, the present invention also provides a soil heavy metal content prediction device, which is used to implement the above soil heavy metal content prediction method, and its special features are:

[0022] It includes an information acquisition module, a decomposition module, a feature extraction module, a feature fusion module and a prediction module which are connected in sequence;

[0023] The information acquisition module is a visible-near infrared spectrometer, which is used to obtain the original spectral information of the soil sample;

[0024] The decomposition module is used to obtain the original spectral information output by the information acquisition module, and decompose the original spectral information into trend items and seasonal items;

[0025] The feature extraction module includes a first feature module and a second feature module, wherein the input ends of the first feature module and the second feature module are respectively connected to the output end of the decomposition module, and the output ends are respectively connected to the input end of the feature fusion module; the first feature module is used to obtain data features of trend items; the second feature module is used to obtain data features of season items;

[0026] The feature fusion module is used to fuse the data features of the trend item and the data features of the season item, and input the fusion result into the prediction module;

[0027] The prediction module is used to obtain the heavy metal content of soil samples.

[0028] Furthermore, the decomposition module is also provided with a normalization module for normalizing the trend term and the seasonal term so that the trend term and the seasonal term have the same dimension.

[0029] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; when the processor executes the computer program, the method for predicting the heavy metal content in soil as described in the present invention is implemented.

[0030] At the same time, the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the soil heavy metal content prediction method of the present invention are implemented.

[0031] Compared with the prior art, the present invention has the following beneficial effects:

[0032] 1. The present invention uses a spectrometer to obtain the original spectral information of the soil sample, and then decomposes the original spectral information into trend items and seasonal items, and determines the data characteristics of the trend items and the data characteristics of the seasonal items; then the data characteristics of the trend items and the data characteristics of the seasonal items are merged to obtain the overall data characteristics of the soil sample; finally, the prediction result of the heavy metal content in the soil is determined. The prediction method uses a spectrometer to irradiate the soil sample and finally predicts the heavy metal content. It does not require chemical reagents and manual operation, and the detection process is simple, the detection speed is fast, the detection cost is low, and there is no chemical waste liquid.

[0033] 2. The present invention uses a seasonal trend decomposition method to decompose the original spectral information into trend terms and seasonal terms, so that the characteristics of each component and its impact on the overall data can be studied independently, and the detection accuracy is higher.

[0034] 3. The present invention obtains the data features of trend items through a multi-layer perceptron model, thereby reducing prediction errors.

[0035] 4. The present invention adopts the time domain attention mechanism to obtain the data features of seasonal items, thereby improving the accuracy of the final prediction results.

[0036] 5. When fusing the data features of trend items with the data features of seasonal items, the present invention adopts a method of first reducing the dimension and then fusing them, which not only improves the detection speed, but also further improves the accuracy of the results.

[0037] 6. The prediction accuracy of the present invention is high and the applicability is strong. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is a flow chart of an embodiment of a method for predicting heavy metal content in soil according to the present invention;

[0039] Figure 2 It is a spectrum diagram of the original spectrum information obtained in step S1 in the embodiment of the method for predicting the heavy metal content in soil of the present invention;

[0040] Figure 3 It is a spectral data diagram of the trend item obtained in step S2 in the embodiment of the method for predicting the heavy metal content in soil of the present invention;

[0041] Figure 4 It is a spectral data diagram of the seasonal item obtained in step S2 in the embodiment of the method for predicting the heavy metal content in soil of the present invention;

[0042] Figure 5 This is a schematic diagram of the self-attention mechanism in step S3 of an embodiment of the method for predicting heavy metal content in soil of the present invention;

[0043] Figure 6 It is a schematic structural diagram of an embodiment of a device for predicting heavy metal content in soil according to the present invention.

[0044] The reference numerals are as follows:

[0045] 501 - information acquisition module, 502 - decomposition module, 503 - first feature module, 504 - second feature module, 505 - feature fusion module, 506 - prediction module. DETAILED DESCRIPTION

[0046] The technical solution of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] like Figure 1 As shown, this embodiment provides a method for predicting soil heavy metal content, comprising the following steps:

[0048] S1. Use a spectrometer to irradiate the soil sample and obtain the original spectral information of the soil sample in combination with a standard reflection white plate.

[0049] The spectrometer used in this embodiment is a portable visible-near infrared spectrometer, the theoretical measurement wavelength range of the spectrometer is 350nm-1000nm, the built-in optical sensor is a charge coupled device (CCD) array sensor, the spectral resolution can be adjusted from 0.1nm to 10nm, and the adjustable integration time is 1ms to 65s; the light source is a 12V DC / 7W halogen lamp light source, and its spectral range is 360nm to 1700nm; the optical fiber probe is a QR400-7-VIS-NIR model Y-type probe, the optical fiber type is VIS-NIR, and visible-near infrared spectral data can be collected.

[0050] When using a visible-near infrared spectrometer to irradiate soil samples, the spectral data collected is the reflected light intensity of each band under a certain background light field. Therefore, standard reflection calibration and dark field calibration are required to obtain the reflectance of the sample in each band. The calibration process requires the use of a standard reflection whiteboard to collect reference light intensity; for example, a standard reflection whiteboard can be used, which can achieve a reflectance of more than 99% in the spectral range of 400nm-1500nm.

[0051] The standard reflective white plate is measured with the light source turned on and off, and the reference light intensity and dark field light intensity can be obtained respectively. Then the light source is turned on, and the spectrometer collects the reflected light intensity curve of the soil sample and calculates the visible-near infrared light reflectance spectrum curve of the soil sample according to the following formula, thereby obtaining the original spectrum information of the soil sample.

[0052]

[0053] Where: R represents the reflection spectrum curve of the soil sample, I represents the reflection light intensity of the soil sample, D represents the dark field light intensity, and S represents the reference reflection light intensity of the standard reflection whiteboard. This embodiment uses a portable visible-near infrared spectrometer, and selects a visible-near infrared spectrum with a wavelength range of 400nm to 950nm to irradiate the soil sample, and selects 1452 sampling points. The spectrum of the obtained raw data is as follows: Figure 2 shown.

[0054] S2, using a seasonal trend decomposition method to decompose the original spectral information into a trend term and a seasonal term; wherein the trend term represents the spectral baseline information of the soil sample; and the seasonal term represents the spectral information of the soil sample after the spectral baseline information is taken out, specifically comprising the following steps:

[0055] S201, using a moving average method to calculate the average data value of the original spectrum information within a preset wavelength range; the calculation formula is as follows:

[0056]

[0057] In the formula, m iλ represents the sliding average of soil sample i at wavelength λ, g represents the size of the sliding window, and x ik Represents the original spectral information of soil sample i at wavelength k.

[0058] S202: Based on the above average data value, the original spectral information is decomposed into a trend term and a seasonal term using a seasonal trend decomposition method.

[0059] Seasonal-Trend Decomposition (STD) is an important method for analyzing time series data. It decomposes time series data into different components to better understand the dynamic changes of data. The core idea of ​​seasonal trend decomposition is to separate the trend term, seasonal term and residual in time series data, so that the characteristics of each component and its impact on the overall data can be studied independently.

[0060] Among them, the trend term represents the overall trend of the original data, which is related to other factors such as the overall composition of the sample, the sample particle size, the ambient light during the experimental collection, and the collection optical path. It reflects the spectral baseline of the sample. The season term represents the sample spectral data after the baseline is removed from the original data. There are many small reflection peaks and troughs distributed in different bands. The season term mainly expresses the spectral characteristics provided by some substances with obvious characteristic bands in the original data.

[0061] This embodiment removes noise and seasonal terms through the following formula, thereby decomposing the trend term:

[0062] xic =AvgPool(Padding(x i ))

[0063] In the formula, x i A sequence sample representing the original spectral information, x ic Represents the trend item. After executing this step, the spectrum of the trend item is obtained as follows Figure 3 shown.

[0064] Afterwards, the trend term (as shown in the following formula) is subtracted from the original spectral information to obtain the seasonal term.

[0065] x is =x i -x ic

[0066] In the formula, x is Represents the seasonal term, and the spectrum of the seasonal term is obtained as follows Figure 4 shown.

[0067] Since there is a large difference between the average value of the seasonal item and the average value of the trend item, the overall data features obtained during the subsequent feature fusion may be more affected by the trend item. Therefore, in order to avoid the above situation, after step S202, a step of normalizing the trend item and the seasonal item is also included so that the trend item and the seasonal item have the same dimension.

[0068] S3. The data features of the trend item are obtained through the multi-layer perceptron model, and the data features of the season item are obtained by using the time domain attention mechanism. The data features of the trend item include the main component information of the soil sample; the data information of the season item includes the material information with obvious characteristic bands after the main components of the soil sample are extracted.

[0069] The Multilayer Perceptron (MLP) model is a neural network structure consisting of multiple fully connected neuron layers, usually including an input layer, one or more hidden layers, and an output layer. The neurons in each layer are connected to all neurons in the next layer through weights, and the input information is processed through activation functions to finally generate outputs. The multilayer perceptron model is trained through the back-propagation algorithm to learn the mapping relationship between input data and output. During the training process, the multilayer perceptron model adjusts the weights and bias terms according to the error between the input data and the label to minimize the prediction error.

[0070] This embodiment adopts a two-layer perceptron model to obtain data features of trend items.

[0071] The attention mechanism is a technique used in deep learning to strengthen the model's attention to relevant parts of the input data. It imitates the behavior of human attention and allows the model to dynamically allocate different degrees of attention to different parts of the sequence when processing input sequence data, so as to eliminate redundant information in the input sequence data and enhance the ability to extract key feature information. In the attention mechanism, the attention weight matrix is ​​used to indicate how much attention the model should allocate to each part of the input sequence data. The attention matrix will continuously learn and update its own parameters during the training process of the overall model to find the optimal allocation scheme of attention weights.

[0072] The attention mechanism includes the time domain attention mechanism and the frequency domain attention mechanism. The time domain attention mechanism is an attention mechanism for sequence data in the time dimension. The frequency domain attention mechanism is an attention mechanism for sequence data in the frequency dimension. Due to its generation mechanism, visible-near infrared spectral data has significant correlation between different bands in the time domain. Therefore, this embodiment is based on the time domain attention mechanism.

[0073] The temporal attention mechanism includes the self-attention mechanism (SA) module and the multi-head self-attention mechanism method (MSA).

[0074] Figure 5 The principle structure diagram of the self-attention mechanism is shown. The self-attention mechanism can assign different attention weights to each band of the input data, thereby capturing the correlation between data in different bands and providing assistance for processing dependencies between long-distance band data.

[0075] The core idea of ​​the self-attention mechanism is to first convert the input data into the Query, Key, and Value spaces, and obtain the matrices Q, K, and V respectively; then multiply the matrix Q by the transposed matrix of the matrix K to obtain the attention score matrix A between the different bands of the input data, and obtain the weight coefficients between different bands after normalization by the softmax function, and then multiply it with the matrix V to obtain the final self-attention weight value vector Z. The calculation formula for the self-attention weight value is as follows:

[0076]

[0077] Q=X·W Q ,K=X·W K ,V=X·W V

[0078] Where, d k Represents the feature dimension of the input data.

[0079] In the calculation process of the self-attention weight value, divided by This is to control the distribution range of the matrix product value to ensure the gradient stability of the softmax function; by multiplying the matrix Q with the transposed matrix of the matrix K, the data on each band in the original spectral data can be fully correlated with the data on all other bands.

[0080] The multi-head attention mechanism uses multiple independent weight matrices W Q , W K With W V Calculate the attention weight values ​​respectively and obtain the corresponding Z1-Z m , and finally Z1-Z m After concatenation, a linear transformation is used to obtain the final attention weight value Z.

[0081] Since the multi-head attention mechanism uses multiple sets of weight matrices to map the input data to the query, key, and value spaces, more feature information of seasonal items can be obtained. Therefore, the use of the multi-head attention mechanism in this method can make the final prediction results more accurate.

[0082] In this embodiment, a dual-headed attention mechanism may be used to obtain data features of seasonal items, or a self-attention mechanism may be used to obtain data features of seasonal items.

[0083] S4. The data features of the trend item are integrated with the data features of the season item to obtain the overall data features of the soil sample.

[0084] S401: Since the data features of the trend item and the data features of the season item obtained above have high dimensions, if they are directly fused, the amount of calculation is too large and the fusion speed is slow. The data features of the trend item and the data features of the season item are reduced in dimension to 512 respectively, which is convenient for subsequent fusion calculation.

[0085] S402, the data features of the trend item after dimensionality reduction and the data features of the season item are merged by adding, multiplying or concatenating according to a one-to-one correspondence, so as to obtain the overall characteristic data of the soil sample.

[0086] The fused overall data features include both the data features of the trend item and the data features of the seasonal item, making the subsequent prediction results using the overall data features more accurate.

[0087] S5. Use a multi-layer perceptron model and combine the overall data characteristics of the soil samples to output the prediction results of the heavy metal content in the soil samples.

[0088] Specifically, the fully connected layer of the multi-layer perceptron model is used to change the overall data features, and the output result is the prediction result of this embodiment.

[0089] The method for predicting the heavy metal content in soil provided in this embodiment uses visible-near infrared spectroscopy to irradiate soil samples, and directly predicts the heavy metal content by processing the raw data of the visible-near infrared spectroscopy obtained, and no longer requires chemical reagents and manual operations. The detection process is simple, the detection speed is fast, the detection cost is low, and there is no chemical waste liquid. At the same time, there is no need to contact heavy metal pollutants, avoiding harm to the human body.

[0090] In the following experiments, soil from the surrounding areas of the uranium mines was used as a substrate and analytically pure uranium oxide powder with a purity of more than 99% was used as a source of heavy metal pollution for sample preparation, and uranium-contaminated soil samples with a mass concentration ranging from 0% to 20% were obtained.

[0091] The soil heavy metal content prediction method provided in this embodiment forms a spectral variable optimization model (Spectra-Variable Optimization Module, SOM). In order to verify whether the soil heavy metal content prediction method provided in this embodiment is effective, the following three comparative models were conducted for ablation experiments.

[0092] The first group of experiments used a fully connected layer instead of the multi-head attention mechanism to extract the data features of the seasonal items; the second group of experiments cancelled the decomposition of the original spectral information and used the original spectral information to replace the trend items and seasonal items for prediction; the third group of experiments used a fully connected layer for complete replacement. In order to ensure that the feature dimensions extracted by the fully connected layer were consistent with those in the SOM model, the number of hidden layer neurons was selected as (512, 512) for modeling.

[0093] The above three groups of models are used to model the spectral data of the same soil samples, and the prediction results are shown in Table 1:

[0094] Table 1 Comparison of prediction results of this embodiment and three models

[0095]

[0096] From the results in Table 1, it can be seen that the prediction errors of the second and third groups on the calibration set and the validation set increased significantly, which verifies the effectiveness of decomposing the original spectral information into trend terms and seasonal terms and the attention mechanism in the SOM model.

[0097] The visible-near infrared spectroscopy data analysis task is highly similar to tasks such as natural language processing and time series prediction in the field of deep learning, so the mature recurrent neural network (RNN) model and long short-term memory (LSTM) model in this field are selected to model the spectral data of heavy metal contaminated soil samples. The soil heavy metal content prediction method proposed in this embodiment is compared with the deep learning method and other models under different modeling schemes, and the results are shown in Table 2:

[0098] Table 2 Comparison of prediction results of this embodiment with other different modeling schemes

[0099]

[0100]

[0101] As can be seen from Table 2, the prediction errors of the RNN model and LSTM model based on deep learning on the calibration set and the validation set are very close, but due to the loss of long-term memory, the overall prediction error of the model is higher than the partial least squares regression (PLS) model and the multilayer perceptron (MLP) model that extract full-band information. In addition, the performance of the PLS model and the MLP model under different preprocessing schemes varies greatly, so a large number of related experiments are needed to analyze the spectral data to cooperate with the modeling work. When the task environment and background change, it is necessary to re-study the spectral data according to the characteristics of the sample and the target substance to find the best modeling solution.

[0102] The SOM model formed by the soil heavy metal content prediction method provided in the present embodiment does not need to carry out complicated data preprocessing experiments. It directly starts from the own characteristics of the raw data of the visible-near infrared spectrum, decomposes the raw data into seasonal items and trend items, and then performs feature extraction and prediction. The prediction errors of the SOM model on the calibration set and the validation set are 0.0040 and 0.0391 respectively, which are significantly better than the PLS model, MLP model and LSTM model and RNN model of deep learning without any preprocessing experiments. Compared with the MLP model after the canonical correlation feature selection (Canonical Correlation Analysis for Features Selection, CARS) feature extraction, the validation set error of the SOM model is reduced by 0.0052. Therefore, the SOM model also has the characteristics of simple preprocessing, strong versatility and high prediction accuracy.

[0103] like Figure 6 As shown, this embodiment also provides a soil heavy metal content prediction device, including an information acquisition module 501, a decomposition module 502, a feature extraction module, a feature fusion module 505 and a prediction module 506 connected in sequence.

[0104] The information acquisition module 501 is a visible-near infrared spectrometer, which is used to obtain the original spectral information of the soil sample. The decomposition module 502 is used to obtain the original spectral information output by the information acquisition module 501, and decompose the original spectral information into a trend item and a seasonal item. The decomposition module 502 is also provided with a normalization module, which is used to normalize the trend item and the seasonal item so that the trend item and the seasonal item have the same dimension.

[0105] The feature extraction module includes a first feature module 503 and a second feature module 504, wherein the input ends of the first feature module 503 and the second feature module 504 are respectively connected to the output ends of the decomposition module 502, and the output ends are respectively connected to the input ends of the feature fusion module 505; the first feature module 503 adopts a multi-layer perceptron model to obtain the data features of the trend item; the second feature module 504 adopts a multi-head attention mechanism to obtain the data features of the seasonal item.

[0106] The feature fusion module 505 is used to fuse the data features of the trend item and the data features of the season item, and input the fusion result into the prediction module 506.

[0107] The prediction module 506 is used to transform the overall data features and thereby obtain the heavy metal content in the soil sample.

[0108] The devices or modules described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are divided into various modules according to their functions and described separately. When implementing the technical solution of the present invention, the functions of each module can be implemented in the same or multiple software and / or hardware. Of course, the module that realizes a certain function can also be implemented by combining multiple sub-modules or sub-units.

[0109] This embodiment also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor; when the processor executes the computer program, the method for predicting the heavy metal content in soil as described in this embodiment is implemented.

[0110] At the same time, this embodiment also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the soil heavy metal content prediction method described in this embodiment are implemented.

[0111] The above-mentioned storage media include but are not limited to random access memory (RAM), read-only memory (ROM), cache, hard disk (HDD) or memory card (Memory Card).

[0112] The above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit the present invention. Although the above embodiments have described the present invention in detail, it should be understood by those skilled in the art that the technical solutions described in the above embodiments can still be modified, or some or all of the technical features can be replaced by equivalents, and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the present invention.

Claims

1. A method for predicting heavy metal content in soil, characterized in that: The following steps are involved: S1. Use a spectrometer to illuminate the soil sample and obtain the original spectrum information of the soil sample in combination with a standard reflection white plate; S2. Decomposing the original spectral information into a trend item and a season item by using a seasonal trend decomposition method; the trend item represents the spectral baseline information of the soil sample, and the season item represents the spectral information of the soil sample after the spectral baseline information is taken out; S3. The data features of the trend item are obtained by a multi-layer perceptron model, and the data features of the season item are obtained by using a time-domain attention mechanism; the data features of the trend item include the main component information of the soil sample; the data information of the season item includes the material information with obvious characteristic bands after the main components of the soil sample are taken out; S4, fusing the data features of the trend item with the data features of the season item to obtain the overall data features of the soil sample; S5. Use a multi-layer perceptron model and combine the overall data characteristics of the soil samples to output the prediction results of the heavy metal content in the soil samples.

2. The method for predicting soil heavy metal content according to claim 1, characterized in that: Step S1 specifically includes: using a spectrometer to illuminate soil samples at different sampling points to obtain the reflected light intensity I at different sampling points; then combining with a standard reflective whiteboard to obtain the reference reflected light intensity S and dark field light intensity D at different sampling points; finally, using the formula The reflectance spectrum curve R of different sampling points is calculated, and then the original spectrum information of the soil sample is obtained.

3. The method for predicting soil heavy metal content according to claim 1 or 2, characterized in that: Step S2 specifically includes: S201, using a moving average method to calculate the average data value of the original spectrum information within a preset wavelength range; S202: Based on the average data value, the original spectral information is decomposed into a trend term and a seasonal term using a seasonal trend decomposition method.

4. The method for predicting soil heavy metal content according to claim 3, characterized in that: Step S202 also includes a step of normalizing the trend term and the season term so that the trend term and the season term have the same dimension.

5. The method for predicting soil heavy metal content according to claim 4, characterized in that: In step S3, the time domain attention mechanism is a self-attention mechanism or a dual-head attention mechanism.

6. The method for predicting soil heavy metal content according to claim 1, characterized in that: Step S4 specifically includes: S401, reducing the dimension of the data features of the trend item and the data features of the season item to 512 respectively; S402, the data features of the trend item after dimensionality reduction and the data features of the season item are merged by adding, multiplying or concatenating according to a one-to-one correspondence, so as to obtain the overall characteristic data of the soil sample.

7. A soil heavy metal content prediction device, used to implement the soil heavy metal content prediction method according to any one of claims 1 to 6, characterized in that: It includes an information acquisition module (501), a decomposition module (502), a feature extraction module, a feature fusion module (505) and a prediction module (506) which are connected in sequence; The information acquisition module (501) is a visible-near infrared spectrometer, which is used to obtain original spectral information of the soil sample; The decomposition module (502) is used to obtain the original spectral information output by the information acquisition module (501), and decompose the original spectral information into trend items and seasonal items; The feature extraction module comprises a first feature module (503) and a second feature module (504), wherein the input ends of the first feature module (503) and the second feature module (504) are respectively connected to the output end of the decomposition module (502), and the output ends are respectively connected to the input end of the feature fusion module (505); the first feature module (503) is used to obtain data features of trend items; the second feature module (504) is used to obtain data features of season items; The feature fusion module (505) is used to fuse the data features of the trend item and the data features of the season item, and input the fusion result into the prediction module (506); The prediction module (506) is used to obtain the heavy metal content of the soil sample.

8. The soil heavy metal content prediction device according to claim 7, characterized in that: The decomposition module (502) is also provided with a normalization module for normalizing the trend term and the season term so that the trend term and the season term have the same dimension.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; characterized in that: When the processor executes the computer program, the method for predicting the heavy metal content in soil as described in any one of claims 1 to 6 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for predicting the heavy metal content in soil as claimed in any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Soil detection method for soil pollution prevention and control

    CN120971373A

  • A soil testing method for soil pollution prevention and control

    CN120971373B