An xrf metal detection analysis method for soil heavy metal pollution

By combining XRF devices with multilayer perceptron networks, a multi-output regression model is constructed to identify the valence state distribution of heavy metal elements in soil. This solves the problem that existing XRF devices cannot distinguish valence states, and achieves efficient and low-cost risk assessment of soil heavy metal pollution.

CN121167678BActive Publication Date: 2026-02-17SICHUAN QINGYANG ENVIRONMENTAL CONSULTING SERVICES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511700815.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-02-17
Estimated Expiration
2045-11-19

AI Technical Summary

Technical Problem

In existing technologies, XRF equipment has difficulty distinguishing the different valence states of heavy metal elements in soil, leading to distorted environmental risk assessment results. Furthermore, existing high-precision detection methods, such as ultraviolet spectrophotometers and X-ray absorption structure spectrometers, are complex to operate or costly, making them unsuitable for rapid large-area soil heavy metal pollution investigation.

Method used

By combining XRF detection with a multilayer perceptron network, information such as the main peak energy value, X-ray intensity value and pH value of heavy metals in soil is collected. A multi-output regression model is constructed to identify co-occurring elements and calculate the X-ray intensity ratio, thereby enabling the prediction of the valence state distribution of heavy metal elements.

Benefits of technology

It enables efficient differentiation of the valence state of heavy metal elements without changing the hardware structure of XRF equipment, improving detection efficiency and accuracy, reducing costs, and is suitable for rapid assessment of the toxicity of heavy metal pollution in soil.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121167678B_ABST
    Figure CN121167678B_ABST
Patent Text Reader

Abstract

The application discloses an XRF metal detection analysis method for soil heavy metal pollution, and relates to the technical field of detection, and comprises the following steps: S1, collecting the main peak energy value, X-ray intensity value and main peak half-height width value of each metal element; S2, picking out an indicator element, obtaining an X-ray intensity value ratio, and collecting the PH value and water content average value of the detected soil; S3, constructing a multi-output regression model based on a multilayer perception network; S4, generating a predicted distribution value of each valence state distribution by using the multi-output regression model; and S5, when the target detection soil is labeled as unknown pollution, returning to step S2 to replace the indicator element and then re-executing detection. Compared with the prior art, the application adopts XRF in-situ detection combined with a machine learning algorithm modeling, avoids complex extraction and color development steps in traditional valence state analysis, realizes second-level valence state prediction, has the advantages of reducing cost and use threshold, and has the beneficial effects of obviously improving the soil heavy metal pollution detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of detection technology, and specifically to an XRF metal detection and analysis method for heavy metal pollution in soil. Background Technology

[0002] Soil is the material foundation upon which human beings depend for survival and development. With the rapid advancement of industrialization and urbanization, soil heavy metal pollution poses a serious threat to the ecological environment and human health. Among existing technologies, X-ray fluorescence spectroscopy (XRF) is the most common, especially handheld XRF analyzers, which have become an important tool for on-site screening of heavy metals in soil due to their advantages of speed, portability, and relatively low cost. This technology can rapidly determine the total amount of various heavy metal elements such as arsenic (As), chromium (Cr), lead (Pb), and cadmium (Cd), playing a crucial role in the preliminary assessment of the scope and extent of pollution.

[0003] However, in using XRF technology to assess soil contaminated with multiple heavy metals, the commonly used XRF equipment, based on the energy level transitions of inner-shell electrons, can only identify the type and total amount of elements, but cannot distinguish between different valence states of the same element. This "valence state detection blind spot," combined with the complex matrix characteristics of soil, can lead to serious distortions in environmental risk assessment results. For example, in the detection of chromium (Cr): in soil, trivalent chromium (Cr(III)) has low toxicity and is relatively stable in the soil environment; while hexavalent chromium (Cr(VI)) has extremely high mobility and toxicity and is a known carcinogen. XRF testing can only provide the "total chromium" content and cannot identify the proportion of highly toxic Cr(VI). If the total chromium content of a soil exceeds the standard, but it is mainly composed of Cr(III), the XRF data may lead to unnecessary remediation costs; conversely, if the total chromium content does not exceed the standard, but the proportion of Cr(VI) is high, conventional XRF screening will seriously underestimate its actual environmental and health risks.

[0004] If using techniques other than XRF to detect heavy metals with different valence states in soil, current technologies mainly employ ultraviolet spectrophotometry and X-ray absorption structure spectrometry. The disadvantages of ultraviolet spectrophotometry include the need for sample pretreatment such as extraction and color development, making the operation process more complex than XRF and potentially leading to longer detection times. X-ray absorption structure spectrometry, on the other hand, is extremely expensive, significantly larger and heavier than portable XRF equipment, complex to operate, requiring specialized data analysis skills, and incurring high labor and time costs. While both of these detection methods offer high accuracy, they are not suitable for quickly identifying areas with soil contaminated with multiple heavy metals.

[0005] Because soil heavy metal pollution investigations are typically conducted in large-scale areas near residential areas, toxicity assessments of soils known to contain multiple types of heavy metals require efficient toxicity testing to quickly classify and screen soil areas for heavy metal contamination. Current technologies for investigating multiple heavy metal contamination in soil lack efficient mechanisms and valence distribution assessments. Furthermore, methods for detecting multiple valence states of heavy metals also suffer from sampling and detection efficiency issues, making it difficult to rapidly and effectively assess the toxicity of soils with complex heavy metal contamination. Summary of the Invention

[0006] This invention provides an XRF metal detection and analysis method for heavy metal pollution in soil, which solves the problem that existing methods are inefficient in detecting the distribution of different valence elements in outdoor soils with known complex heavy metal pollution, making it difficult to quickly detect and assess the relative levels of toxicity in the soil.

[0007] This invention is achieved through the following technical solution:

[0008] An XRF metal detection and analysis method for heavy metal pollution in soil, the method comprising:

[0009] Step S1: Use the initial XRF detection process to detect all metal elements in the target soil, collect the main peak energy value, X-ray intensity value and main peak half width value for each metal element, and screen out the target elements with valence state differences;

[0010] Step S2: Select the co-occurring elements of the target detection element from all metal elements and label them as indicator elements. Calculate the ratio of the X-ray intensity values ​​of the target detection element and the indicator element, and collect the average pH value and water content of the target detection soil.

[0011] Step S3: Construct a multi-output regression model based on a multilayer perceptron network, and set the main peak energy value, main peak half width at half maximum value, X-ray intensity ratio, pH value and mean water content as the input signals of the multi-output regression model;

[0012] Step S4: Use a multi-output regression model to generate predicted distribution values ​​representing the valence distribution of each target detection element, construct a valence assessment strategy, and use the valence assessment strategy to label the target detection soil detection results based on the predicted distribution values;

[0013] Step S5: The detection results of the target soil are screened into high pollution, low pollution and unknown pollution. When the target soil is marked as unknown pollution, step S1 is repeated and the indicator element is replaced before the detection is repeated.

[0014] Furthermore, the process of selecting indicator elements includes: using partial correlation analysis to calculate the partial correlation coefficient between candidate co-occurrence elements and target detection elements, and performing a significance test on the partial correlation coefficient to obtain a significance test value;

[0015] A significance threshold is set for the partial correlation coefficient. When the significance test value of the partial correlation coefficient exceeds the significance threshold, it is determined that the degree of partial correlation has reached significance, and it is determined that the symbiosis between the candidate symbiotic element and the target detection element is affected by the acidity or alkalinity of the target detection soil. At this time, the candidate symbiotic element is replaced. When the significance test value of the partial correlation coefficient does not exceed the significance threshold, it is determined that there is no partial correlation phenomenon, and the current candidate symbiotic element is determined to meet the indicator element.

[0016] Furthermore, based on the Pearson correlation coefficient, the partial correlation coefficient is calculated using partial correlation analysis and labeled as the Pearson partial correlation coefficient. The process includes:

[0017] Let the Pearson correlation coefficients between the candidate symbiotic element and the target element, between the candidate symbiotic element and pH value, and between the target element and pH value be represented as the first Pearson coefficient λ1, the second Pearson coefficient λ2, and the third Pearson coefficient λ3, respectively; let the Pearson partial correlation coefficient be represented as λe.

[0018] The formula for calculating the Pearson partial correlation coefficient is as follows: .

[0019] Furthermore, the calculation process for the significance test value of the partial correlation coefficient is set as follows:

[0020] Let the significance test value be denoted as Z, then the formula for calculating the significance test value is: ,

[0021] In the formula, p represents the total number of observed samples, q represents the total number of control variables, (pq-2) represents the degrees of freedom term in the significance test process, and (1-λe) represents the total number of control variables. 2 ) represents the variance compensation term of the Pearson partial correlation coefficient.

[0022] Furthermore, the configuration of the multilayer perceptron network includes:

[0023] Input layer: Normalize the peak energy value, peak half-width at half-maximum value, X-ray intensity ratio, pH value, and average water content. Receive the peak energy value, peak half-width at half-maximum value, and X-ray intensity ratio as input signals, wherein the number of nodes in the input layer is equal to the total dimension of the input signal.

[0024] Hidden layer: Several neurons are labeled as control gate units, and the gating weight coefficients are output through the Sigmoid activation function. The gating weight coefficients are multiplied with the input signals of the other neurons in an element-wise weighted manner to calculate the feature response value representing the gating modulation. The feature response value is processed by the ReLU activation function and then passed to the output layer.

[0025] Output layer: A loss function is constructed based on the main peak energy value, main peak half width at half maximum value, X-ray intensity ratio, pH value and average water content of the input signal. The loss function is used to calculate the predicted distribution value of each valence state of the output target detection element. The number of nodes in the output layer is equal to the number of valence state types of the target detection element, and the error value is passed back to the input layer.

[0026] The control gate unit receives the input feature of the average water content and sets a gate threshold for the average water content. When the average water content is higher than the gate threshold, the gate factor of the control gate unit is turned on, and the hidden layer emphasizes the valence state migration feature. When the average water content is lower than the gate threshold, the gate factor of the control gate unit is turned off, and the hidden layer emphasizes the valence state stability feature.

[0027] Furthermore, a loss function is constructed using the mean squared error method, which includes:

[0028] Let θ represent the instantaneous model parameter set in the multilayer perceptron network; let N represent the total number of element samples for target detection, and let i represent the sample ordinal number; let J represent the total number of valence states for target detection, and let k represent the ordinal number of the valence states; let y1 represent the reference distribution value and the predicted distribution value of the i-th sample in the k-th valence state in the target detection soil. ik and y2 ik Let the loss constraint term be Le, and the loss function be L(θ).

[0029] The loss function L(θ) is then expressed as: .

[0030] Furthermore, the loss constraint term Le satisfies the following calculation formula: ,

[0031] Where γ in the formula represents the constraint weight coefficient, and in the formula... This represents the squared penalty term for prediction bias.

[0032] Furthermore, the main peak energy value, main peak half-width at half-maximum value, X-ray intensity ratio, pH value, and average water content are represented as Ei, Wi, Ri, pHi, and Mi, respectively; the model mapping function of the multilayer perceptron network is set as f. k Define the reference distribution value y1 ik and predicted distribution value y2 ikAll conform to the model mapping function f k Set the model mapping function f k The input feature vector is represented as x i ,

[0033] Set the model mapping function f k Represented as f k =(x i ; θ),

[0034] Wherein, the input feature vector x i Satisfy x i =[Ei, Wi, Ri, pHi, Mi].

[0035] Furthermore, a confidence interval is used to represent the predicted distribution value of the valence state distribution of each element. The process of generating the confidence interval includes: setting the confidence level of the confidence interval based on the predicted distribution value, obtaining the activation value of the hidden layer neurons in the multilayer perceptron, and determining the confidence boundary of each valence state distribution based on the activation value and the confidence level to complete the confidence interval.

[0036] Furthermore, the process of obtaining the activation value includes: finding the historical predicted values ​​of the predicted distribution in the training sample space of the multilayer perceptron network, making the distribution of the historical predicted values ​​Gaussian, and calculating the activation value based on the historical predicted values ​​using the Monte Carlo method.

[0037] Furthermore, the process of calculating activation values ​​using the Monte Carlo method includes: calculating the mean of historical predicted values ​​for each valence state of the target detection element; randomly sampling and generating a number of simulated prediction samples using the Monte Carlo method, obtaining the predicted values ​​generated by Monte Carlo sampling and labeling them as sampled predicted values; and using the mean of historical predicted values ​​and sampled predicted values ​​to obtain the activation value corresponding to each simulated prediction sample in the hidden layer neuron.

[0038] Furthermore, the content of the price assessment strategy includes:

[0039] Based on soil environmental standards, a pollution threshold is set for the confidence interval of each valence state of the target element, where the pollution threshold represents the distribution content; the predicted distribution value of each valence state of the target element is taken, and the predicted distribution value is used to represent the confidence interval.

[0040] For any highly toxic pollutant valence state of the target element, if the lower confidence boundary of the confidence interval is greater than the pollution threshold, the target element is judged to be highly polluted in the target soil; if the upper confidence boundary of the confidence interval is less than the pollution threshold, the target element is judged to be low polluted in the target soil; if the pollution threshold is within the range of the confidence interval, the judgment result is marked as unknown pollution.

[0041] Furthermore, the pollution threshold is set to be obtained by weighted summation of the threshold of the soil environmental standard and the statistical threshold; the statistical threshold is set based on the mean of historical prediction data.

[0042] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0043] 1. By adopting XRF in-situ detection combined with machine learning algorithm modeling, the complex extraction and color development steps in traditional valence state analysis are avoided, achieving high-precision valence state prediction. The detection efficiency is significantly improved compared with the laboratory method. At the same time, an automatic backtracking mechanism for unknown contamination is set up to improve the robustness and fault tolerance of the model under complex soil conditions and avoid misjudgment.

[0044] 2. By integrating XRF main peak parameters, symbiotic element intensity ratio, pH value and water content into the neural network model, the system can achieve valence state differentiation and quantitative estimation without changing the XRF hardware structure. This effectively makes up for the blind spot of valence state detection in existing XRF equipment, and realizes the reduction of cost and usage threshold and the scientification of risk assessment.

[0045] 3. By using a multi-output regression model to jointly model spectral parameters such as main peak energy, full width at half maximum (FWHM), and intensity ratio with soil environmental parameters, and by introducing the intensity ratio of symbiotic "indicator elements", a mapping relationship between valence state and environmental signal is established, thereby realizing pollution risk assessment at the element valence state level and significantly improving the correlation between detection results and actual environmental toxicity. Attached Figure Description

[0046] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings:

[0047] Figure 1 This is a flowchart of the present invention. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.

[0049] Example 1, such as Figure 1 As shown in the figure, this embodiment is an XRF metal detection and analysis method for heavy metal pollution in soil. The method includes:

[0050] Step S1: Use the initial XRF detection process to detect all metal elements in the target soil, collect the main peak energy value, X-ray intensity value and main peak half width value for each metal element, and screen out the target elements with valence state differences;

[0051] Step S2: Select the co-occurring elements of the target detection element from all metal elements and label them as indicator elements. Calculate the ratio of the X-ray intensity values ​​of the target detection element and the indicator element, and collect the average pH value and water content of the target detection soil.

[0052] Step S3: Construct a multi-output regression model based on a multilayer perceptron network, and set the main peak energy value, main peak half width at half maximum value, X-ray intensity ratio, pH value and mean water content as the input signals of the multi-output regression model;

[0053] Step S4: Use a multi-output regression model to generate predicted distribution values ​​representing the valence distribution of each target detection element, construct a valence assessment strategy, and use the valence assessment strategy to label the target detection soil detection results based on the predicted distribution values;

[0054] Step S5: The detection results of the target soil are screened into high pollution, low pollution and unknown pollution. When the target soil is marked as unknown pollution, step S1 is repeated and the indicator element is replaced before the detection is repeated.

[0055] In soil heavy metal pollution investigations, heavy metal elements with different valence states, such as chromium (Cr), arsenic (As), manganese (Mn), iron (Fe), and selenium (Se), exhibit different chemical activities and toxicological characteristics. Currently, commonly used detection methods include handheld XRF instruments or benchtop X-ray fluorescence spectrometers, both rapid and non-destructive methods. However, these methods can only determine the total amount of the element and cannot assess the distribution of different valence states. This "indistinguishability of valence states" can lead to a series of negative impacts in the actual assessment of soil heavy metal pollution, resulting in distorted assessment results, incorrect risk judgments, and ineffective remediation decisions. Heavy metals with different valence states vary greatly in toxicity, mobility, and bioavailability. For example, chromium (Cr(VI) – hexavalent) – is highly toxic and highly mobile, while Cr(III) – trivalent – ​​is relatively stable and significantly less toxic. Similarly, arsenic (pentavalent) is more stable and less toxic than its trivalent form. When the test results only provide the total content, it is impossible to determine the actual risk level of the target soil area. If the proportion of highly toxic valence states of the target element is low, but the total amount of highly toxic valence metals exceeds the standard, the target soil area may be misjudged as highly polluted, potentially leading to over-treatment. Conversely, if the proportion of highly toxic valence states is high, but the total amount of highly toxic valence metals is within the normal range, the target soil area may be missed as a safe soil area, potentially masking the true risk. Furthermore, in target soils potentially contaminated with heavy metals, the selection of environmental management and remediation measures also depends on the valence state of the heavy metals. For example, hexavalent chromium (Cr(VI)) requires strong reducing agents or solidification measures, while trivalent chromium (Cr(III)) is primarily reducing and can be naturally oxidized and decayed, with far lower toxicity than hexavalent chromium. If the degree of toxic pollution is misjudged due to the inability to distinguish valence states during testing, over-treatment may occur, wasting remediation funds and time; or under-treatment may occur, failing to detect higher levels of highly toxic valence states, leading to persistent risk, ultimately resulting in mismatched remediation plans, poor remediation effects, and low resource utilization efficiency. Currently, commonly used methods for accurate detection of valence states mainly rely on laboratory retesting, such as X-ray absorption spectroscopy or spectrophotometry. However, in the detection of heavy metal pollution in soil, these methods suffer from drawbacks such as long sample transportation and experimental analysis cycles, significantly increased manpower, material resources, and testing costs, and the inability to obtain timely information on on-site risk distribution. Ultimately, this leads to a prolonged investigation cycle and low on-site response efficiency. Therefore, this embodiment primarily addresses and improves upon the aforementioned shortcomings of existing technologies.

[0056] An initial XRF detection process is performed on the soil sample for target detection. For example, a portable X-ray fluorescence spectrometer is used to obtain the spectral information of all metal elements in the soil sample, directly extracting the main peak energy value, main peak X-ray intensity value, and main peak half-width at half-maximum (FWHM) of each element. The initial XRF process refers to the first standardized spectral detection procedure using a portable XRF instrument (i.e., X-ray fluorescence spectrometer), including equipment calibration, energy scale correction, integration time setting, and background subtraction. Target elements with valence state differences are screened out. This means that among all metal elements obtained through the initial XRF detection, those elements that can coexist in different chemical valence states or oxidation states in the natural soil environment, and whose different valence states have significantly different environmental toxicity or migration characteristics, are selected as the focus of subsequent detection and analysis. That is, elements whose valence state changes have a significant impact on the environment are identified, such as chromium (Cr), arsenic (As), manganese (Mn), iron (Fe), copper (Cu), and selenium (Se), while elements that are insensitive to valence states or have no significant toxicological differences, such as lead (Pb) and zinc (Zn), are excluded. In practice, the screening method can directly compare the list of elements detected by XRF with an element database. In practice, the target detection element can be one or multiple; the number selected depends on the availability of technical resources. Selecting multiple target detection elements means that they are detected and screened simultaneously.

[0057] From all metallic elements, symbiotic elements of the target element are selected and labeled as indicator elements. Specifically, elements that coexist with, interact with, or influence the target element in the soil are selected. Elements that represent the environmental redox conditions or chemical state from these symbiotic elements are defined as indicator elements. There may be one or more candidate indicator elements; the candidate symbiotic element that has the greatest impact on the toxicity and valence state of the target element through redox reactions is selected as the indicator element. For example, when there is sufficient oxygen in the soil pores, the soil is under oxidizing conditions, and ferric iron (Fe3+)... 3+ tetravalent manganese Mn 4+ The content of chromium increases in the form of metal oxides, which can simultaneously oxidize trivalent chromium (Cr(III)) in the soil, easily leading to an increase in hexavalent chromium (Cr(VI)) content; when the amount of reducing organic matter is high, the soil is under reducing conditions, and trivalent iron (Fe) increases. 3+ tetravalent manganese Mn 4+ Reduced to Fe 2+ Mn 2+These low-valence substances, acting as reducing agents, conversely reduce hexavalent chromium (Cr(VI)) to trivalent chromium (Cr(III),) thus decreasing the Cr(VI) content. At this point, iron and manganese can be identified as indicator elements for chromium; the valence changes of Fe and Mn are consistent with the valence changes of Cr, reflecting environmental redox trends. In practical implementation, geochemical symbiosis knowledge can be used to directly prioritize elements that are frequently coexisting or chemically reacting with the target element in natural geology and pollution sources. Alternatively, XRF detection can be used to identify elements with significantly different main peaks from the target element.

[0058] The multi-output regression model based on a multilayer perceptron network (MPB) refers to a multi-output regression model that uses an MPB as its machine learning framework. Specifically, it employs a feedforward neural network structure consisting of an input layer, at least one hidden layer, and an output layer, with the predicted distribution values ​​corresponding to each valence state serving as the multi-output regression target. The MPB receives multidimensional input data containing spectral and environmental features and learns the functional relationship between the input and the target valence state content through nonlinear mapping in the hidden layers. In this embodiment, the multidimensional input data includes the main peak energy value, the main peak half-width at half-maximum (FWHM), the ratio of X-ray intensity values, the pH value, and the average water content. The model training principle involves using training sample data containing known valence state contents and adjusting the network weights through backpropagation to make multiple predicted outputs approximate the corresponding target valence state contents. This multi-output regression model based on the MPB can simultaneously learn the correlations of multiple valence states, improving prediction accuracy. In the screening of indicator elements, as a specific application, when the number of candidate symbiotic elements is small, or when all candidate symbiotic elements in the target soil lack significant correlation with the target element, it is determined that the indicator element has little impact on the multi-output regression model analysis process. Since the remaining chemical elements still have an impact on soil environmental parameters, in order to maintain the integrity of the calculation process of the multi-output regression model, the indicator element needs to be retained. At this time, any candidate symbiotic element can be set as the indicator element.

[0059] The main peak energy value represents the inner-shell electronic energy level state of an element, and can be interpreted as a small chemical shift related to the valence state. This subtle shift in the main peak energy value is a key input feature for distinguishing valence state differences. The chemical shift indicates that XRF technology emits characteristic X-rays based on inner-shell electron transitions. Elements with different valence states exhibit energy level differences due to variations in electron cloud density. For example, hexavalent chromium (Cr(VI)) has a higher effective nuclear charge than trivalent chromium (Cr(III),) resulting in a slightly higher Kα peak energy, approximately on the order of 1–3 eV. The X-ray intensity value represents the peak height of the characteristic spectrum obtained from XRF detection, indicating the element's content in the sample or its signal response intensity. The full width at half maximum (FWHM) of the main peak reflects the electronic transition energy distribution in a data mapping manner; a higher degree of valence mixing results in a larger FWHM. The X-ray intensity ratio represents a characteristic quantity reflecting the relative signal relationship between the target element and the indicator element, obtained by calculating the ratio of their peak intensities. The relative intensity ratio of coexisting elements is used to correct matrix effects, improving the accuracy of valence state identification. Matrix effect correction theory partially offsets differences in matrix absorption, achieving signal normalization and helping the model eliminate interference from different soil matrices on X-ray intensity. The soil pH value reflects the acidity or alkalinity of the soil solution and is a key environmental parameter affecting the stability and migration of metal valence states. In acidic environments, highly oxidized metal ions are more easily reduced; in alkaline environments, oxidized valence states are more stable and their solubility is enhanced. The average soil moisture content represents the average moisture content of the sampling area or points, used to characterize soil moisture status, and is also related to redox reactions, ion migration, and valence state transition rates. Physically, high moisture content absorbs some incident X-rays, affecting fluorescence intensity; chemically, a humid environment promotes redox reactions and dissolution migration, altering valence state ratios. The mean moisture content serves as both a signal correction parameter and an environmental factor for valence state evolution, helping the model correct systematic biases in valence state prediction. In practice, the pH value of the target soil can be obtained using a portable pH sensor or rapid measuring instrument; the mean moisture content of the target soil can be obtained using an infrared moisture meter. If multiple pH values ​​differ, they are averaged.

[0060] A multilayer perceptron (MLP) is a feedforward neural network model that simulates the connection methods of biological neurons by weighting, nonlinearly transforming, and hierarchically mapping input signals to approximate complex input-output mapping relationships. In this embodiment, the MLP network is used as a nonlinear function approximator to transform complex spectral feature patterns into predicted valence state distributions. The model uses the main peak energy value, full width at half maximum (FWHM) value, X-ray intensity ratio of the target element to the indicator element, and the average pH and moisture content of the target soil as input signals. By performing nonlinear mapping on the input signals, it outputs predicted distribution values ​​of different valence states of the target element. The model can adaptively learn the correspondence between different valence state distributions and spectral and environmental characteristics based on training samples, enabling rapid prediction of the valence state composition of heavy metals in soil. The multilayer perceptron network uses the main peak energy value, main peak half-width at half-maximum value, X-ray intensity ratio, pH value, and average water content as input features. Through multilayer nonlinear feature mapping and gating modulation processing, a nonlinear mapping relationship is established between the input features and the valence state distribution of the target detection element. The network output layer generates the predicted value of the corresponding valence state distribution based on the response intensity of each valence state node, and normalizes the output distribution through valence state conservation constraints, thereby obtaining the distribution prediction results of the target detection element under different valence states.

[0061] The predicted distribution value represents the relative content distribution or probability of occurrence of a target element in different valence states, obtained by using a multi-output regression model. This value indicates the relative content or proportion of the target element in each valence state within the soil sample. Specifically, the multi-output regression model outputs a vector, where each component corresponds to a value representing a valence state. This vector constitutes the predicted distribution of the target element's valence states. Each output node corresponds to a valence state of the target element, and the output value can be the concentration, proportion, or normalized weight of each valence state. All outputs collectively constitute the distribution characteristics of the target element in different valence states. Based on these distribution characteristics, the proportion of highly toxic valence states in the target soil can be further calculated for pollution level determination and risk assessment. As a specific implementation method, the process can be set as follows: a multi-output regression model based on a multilayer perceptron network is trained under supervision using a large number of soil samples known to contain heavy metals, and a corresponding training loss function and learning rate are used; then, the features extracted from the XRF detection parameters and soil environmental parameters are received, and the model is transformed to express the mapping relationship, including the nonlinear shift between peak energy change and valence state, the coupling effect between X-ray intensity ratio and valence state composition, and the influence of pH value and soil moisture content on valence state stability, etc. The functional relationship between the input features and the valence state distribution of the target detection element is obtained through supervised learning; in the form of a multi-node structure, each node corresponds to a valence state, and the predicted distribution value of each valence state of the target detection element is normalized using the Softmax function to reflect the estimated relative content of different valence state components in the soil.

[0062] The valence assessment strategy is used to comprehensively judge the pollution risk of target elements based on the valence prediction distribution generated by the multi-output regression model. As a feasible implementation, in specific applications, the valence assessment strategy is set as follows: based on national or industry limits, a valence concentration threshold is set for the predicted distribution value generated by the multi-output regression model, and the detection results are labeled as high pollution, low pollution, or unknown pollution according to a preset score or interval threshold. When the detection result is labeled as unknown pollution, the system triggers a verification mechanism, re-collects the corresponding element data and soil data, re-selects the indicator element, obtains a new X-ray intensity ratio, and performs a new round of detection to improve the reliability of the results. In specific implementation, as a special case, if the result is still unknown pollution after several re-selections of the indicator element, or if there are no more applicable indicator elements, it can be determined that the current detection method is no longer applicable to the target soil. In specific applications, the situations that produce unknown pollution judgment results can include environmental factors and system factors. Environmental factors may include: The average pH and moisture content collected from the soil environment in this embodiment contradict the theoretical prediction results, indicating that other potential environmental factors may affect the element valence state. For example, the model predicts a high Cr(VI) content, but the pH test indicates a strongly acidic environment. Since a strongly acidic environment is theoretically unstable for Cr(VI), this suggests that the mapping prediction process lacks unknown specific environmental parameters for the currently tested soil, requiring specialized soil testing. System factors may include: When some necessary parameters are missing during data collection, such as the full width at half maximum (FWHM) of the main peak or pH detection failure, the system determines it as unknown pollution and prompts for retesting or selection of other detection methods; when the results of two consecutive tests on the same sample differ beyond a set deviation threshold (e.g., the deviation between the two predicted valence state ratios exceeds 15%), the system automatically identifies the second test result as unknown pollution and prompts for retesting or selection of other methods.

[0063] Example 2: In this example, the process of selecting indicator elements includes: using partial correlation analysis to calculate the partial correlation coefficient between candidate co-occurrence elements and target detection elements, and performing a significance test on the partial correlation coefficient to obtain a significance test value.

[0064] A significance threshold is set for the partial correlation coefficient. When the significance test value of the partial correlation coefficient exceeds the significance threshold, it is determined that the degree of partial correlation has reached significance, and it is determined that the symbiosis between the candidate symbiotic element and the target detection element is affected by the acidity or alkalinity of the target detection soil. At this time, the candidate symbiotic element is replaced. When the significance test value of the partial correlation coefficient does not exceed the significance threshold, it is determined that there is no partial correlation phenomenon, and the current candidate symbiotic element is determined to meet the indicator element.

[0065] The partial correlation coefficient represents the degree of closeness of the relationship between two elements in a system composed of multiple elements when studied individually. The numerical result obtained is the partial correlation coefficient. Calculating the partial correlation coefficient is to eliminate the influence of common environmental factors such as soil pH and water content, and to assess whether a true symbiotic or coupled relationship still exists between the candidate element and the target element when these conditions remain unchanged, thus avoiding the target detection element and the indicator element being driven by specific soil environments. The significance threshold represents the critical value used to determine whether the partial correlation relationship is statistically significant when performing a significance test on the partial correlation coefficient. In specific implementations, the significance threshold can be set using existing techniques based on sample statistical tests of the coexistence correlation between corresponding two elements or laboratory data from the chemical field.

[0066] Furthermore, as a feasible implementation method, the partial correlation coefficient is calculated using partial correlation analysis based on the Pearson correlation coefficient and labeled as the Pearson partial correlation coefficient. The process includes:

[0067] Let the Pearson correlation coefficients between the candidate symbiotic element and the target element, between the candidate symbiotic element and pH value, and between the target element and pH value be represented as the first Pearson coefficient λ1, the second Pearson coefficient λ2, and the third Pearson coefficient λ3, respectively; let the Pearson partial correlation coefficient be represented as λe.

[0068] The formula for calculating the Pearson partial correlation coefficient is as follows: .

[0069] This embodiment describes the Pearson partial correlation coefficient λe as a measure of the residual linear correlation strength between candidate symbiotic elements and target detection elements under the condition of keeping the pH value constant. In other words, after eliminating the influence of pH value, it quantifies the true linear correlation strength between candidate symbiotic elements and target detection elements in the form of a statistical index. The partial correlation analysis method used in this embodiment is based on the Pearson correlation coefficient, and the net linear correlation between two variables after controlling for specific variables is obtained through the mathematical relationship of the Pearson correlation coefficient. In this embodiment, soil pH value is introduced as an influencing factor. In the formula, (λ1-λ2∙λ3) represents the portion caused by the common control variable removed from the first Pearson coefficient λ1 of the main correlation, and λ2∙λ3 represents the contribution indirectly generated by pH value. Partial standardization was used to keep the Pearson partial correlation coefficient λe within the [-1,1] range, consistent with the data characteristics of the ordinary Pearson correlation coefficient. Soil pH was incorporated into the Pearson partial correlation coefficient calculation because soil pH affects the solubility, migration, and valence distribution of metal elements. Acidic soils may promote the dissolution of certain heavy metal ions, increasing their exchangeable states; alkaline soils may cause the precipitation of certain metal elements, thus altering the detection signal. Without considering pH, the correlation between candidate symbiotic elements and the target element might be a spurious correlation, generated solely by the combined effects of soil acidity and alkalinity. Using pH as a control variable in the partial correlation calculation allows for the measurement of the true symbiotic relationship between the target and candidate elements under fixed pH conditions, representing a net correlation. This more accurately reflects the intrinsic connections between elements, rather than a surface correlation driven by environmental conditions.

[0070] In practical implementation, as a feasible approach, λ1, λ2, and λ3 are all calculated using a set of variables (X, Y), and correspondingly represented as (X1, Y1), (X2, Y2), and (X3, Y3). The first Pearson coefficient λ1, the second Pearson coefficient λ2, and the third Pearson coefficient λ3 can all be calculated using the general Pearson formula, which is expressed as:

[0071] Let λ XY ={λ1, λ2, λ3}, X={X1,X2,X3}, Y={Y1,Y2,Y3}.

[0072] in This represents the mean of variable X. Let λ represent the mean of variable Y, m represent the total number of variable samples, and k represent the ordinal number of variable samples. As a feasible application, the variables of λ1 are set as candidate symbiotic element concentration data X1 and target detection element concentration data X2, the variables of λ2 are set as candidate symbiotic element X-ray intensity value X2 and soil pH data X2, and the variables of λ3 are set as soil pH data X3 and target detection element X-ray intensity value X3.

[0073] Furthermore, as a feasible implementation method, the calculation process for the significance test value of the partial correlation coefficient is set as follows:

[0074] Let the significance test value be denoted as Z, then the formula for calculating the significance test value is: ,

[0075] In the formula, p represents the total number of observed samples, q represents the total number of control variables, (pq-2) represents the degrees of freedom term in the significance test process, and (1-λe) represents the total number of control variables. 2 ) represents the variance compensation term of the Pearson partial correlation coefficient.

[0076] In this embodiment, the total observed sample size *p* represents the total number of metal element categories, and the total control variable size *q* represents the pH value. The degrees of freedom term represents the number of effective observations that can be used to estimate the correlation, or it can represent the amount of data change. *(pq-2)* represents the amount of data change obtained after deducting the number of control variables (i.e., the pH value) and the two variables (candidate co-occurring elements and target detection elements) in the significance test calculation; this is the degrees of freedom term. Since the partial correlation test requires controlling one variable, i.e., the pH value in this embodiment, the total degrees of freedom term for partial correlation is reduced by 3, which can be recorded as (p−3) in the specific calculation. (1−λe) 2 The part representing the variance compensation term of the Pearson partial correlation coefficient is used to standardize the correlation strength of λe, avoiding statistical bias in cases of high correlation. When the sample size p of the total metal element is large, the significance test is more sensitive; when λe is large, the Z-value increases, making it easier to determine significance; when |λe| is close to 1, the denominator decreases, and the Z-value increases, indicating a highly significant correlation. By standardizing the partial correlation coefficient, the obtained test value can be compared with the distribution to determine whether the partial correlation reaches a statistically significant level. This significance test can screen out indicator elements that still have a significant symbiotic relationship with the target element after controlling soil pH, thereby improving the reliability of the model input parameters and the accuracy of detection and evaluation.

[0077] Example 3: In this example, the configuration of the multilayer perceptron network includes:

[0078] Input layer: Normalize the peak energy value, peak half-width at half-maximum value, X-ray intensity ratio, pH value, and average water content. Receive the peak energy value, peak half-width at half-maximum value, and X-ray intensity ratio as input signals, wherein the number of nodes in the input layer is equal to the total dimension of the input signal.

[0079] Hidden layer: Several neurons are labeled as control gate units, and the gating weight coefficients are output through the Sigmoid activation function. The gating weight coefficients are multiplied with the input signals of the other neurons in an element-wise weighted manner to calculate the feature response value representing the gating modulation. The feature response value is processed by the ReLU activation function and then passed to the output layer.

[0080] Output layer: A loss function is constructed based on the main peak energy value, main peak half width at half maximum value, X-ray intensity ratio, pH value and average water content of the input signal. The loss function is used to calculate the predicted distribution value of each valence state of the output target detection element. The number of nodes in the output layer is equal to the number of valence state types of the target detection element, and the error value is passed back to the input layer.

[0081] The control gate unit receives the input feature of the average water content and sets a gate threshold for the average water content. When the average water content is higher than the gate threshold, the gate factor of the control gate unit is turned on, and the hidden layer emphasizes the valence state migration feature. When the average water content is lower than the gate threshold, the gate factor of the control gate unit is turned off, and the hidden layer emphasizes the valence state stability feature.

[0082] The multilayer perceptron network comprises an input layer, a hidden layer, and an output layer. The input layer normalizes the peak energy, full width at half maximum (FWHM), X-ray intensity ratio, pH value, and mean water content of the target soil sample, using these as the input signal. In the hidden layer, some neurons are configured as control gate units, generating gate weight coefficients using the sigmoid function. These coefficients are then weighted element-wise with the input signals of the remaining neurons to form a gated modulation feature response, which is processed by the ReLU function and passed to the output layer. The output layer constructs a loss function based on the input signal, calculates the predicted distribution values ​​of each valence state of the target element, and updates the weights through backpropagation. The control gate units receive the mean water content input and adjust the feature extraction direction according to a gate threshold: when the water content is higher than the threshold, the gate factor is turned on to strengthen valence state migration features; when the water content is lower than the threshold, the gate factor is turned off to strengthen valence state stability features. This network structure enables the model to adaptively adjust its internal feature extraction method according to environmental water conditions, thereby improving the accuracy and stability of valence state prediction.

[0083] The number of nodes in the input layer is set to be equal to the total dimension of the input signal. This ensures that the input layer can serve as a complete projection layer of the multidimensional data vector, allowing the network to obtain the nonlinear correlation between all features through weighted combination in the first layer computation. Since valence prediction is a multi-output, multi-factor coupled regression problem, an equal-dimensional input layer allows the model to form a complete vector representation in the feature space, providing a sufficient input foundation for subsequent hidden layer learning. In a typical multilayer perceptron network, each neuron simply receives the input signal and outputs the result after linear weighting and nonlinear activation. In this embodiment, the control gate unit is a special type of neuron whose task is not to directly extract features, but to control the intensity of signals from other neurons. The weights output by the sigmoid function determine the proportion of the input signal passing through the control gate unit. In this embodiment, the input to the control gate unit is the average soil moisture content. The motivation for its construction lies in the fact that moisture content affects the migration and stability of heavy metal valence states. The network needs to select different feature extraction paths under different moisture conditions, and the control gate unit enables the network to automatically learn this environmental adaptation mechanism. When the water content is high, the Sigmoid output is close to 1, at which point the gating weight is large and the network emphasizes the valence state transition feature; when the water content is low, the Sigmoid output is close to 0, at which point the gating weight is small and the network emphasizes the valence state stability feature.

[0084] The element-wise weighted product represents the input signal received by each hidden layer neuron from the previous layer, including encoded feature vectors such as peak energy, full width at half maximum (FWHM), intensity ratio, and pH. The water content-driven control gate unit outputs a gate weight coefficient between 0 and 1. This input signal and the gate weight coefficient are multiplied element-wise. When the gate weight coefficient is close to 1, the input signal is almost completely transmitted; when it is close to 0, the input signal is suppressed. The gated signal is then passed through a ReLU function, which sets negative signals to zero, suppresses invalid or noise features, and retains positive and significant signals. In this embodiment, the input signal represents the detected element and environmental features, and the gate weight represents the intensity of water content-related environmental regulation of valence state migration features. The multilayer perceptron network can dynamically adjust the passage of feature streams; that is, under high water content conditions, it enhances signals reflecting redox migration features; under low water content conditions, it suppresses these features and emphasizes valence state stability. The error value is passed back to the input layer to calculate the error between the predicted and true values, allowing the model to learn how to reduce errors.

[0085] Furthermore, as a feasible implementation method, a loss function is constructed using the mean squared error method, the contents of which include:

[0086] Let θ represent the instantaneous model parameter set in the multilayer perceptron network; let N represent the total number of element samples for target detection, and let i represent the sample ordinal number; let J represent the total number of valence states for target detection, and let k represent the ordinal number of the valence states; let y1 represent the reference distribution value and the predicted distribution value of the i-th sample in the k-th valence state in the target detection soil. ik and y2 ik Let the loss constraint term be Le, and the loss function be L(θ).

[0087] The loss function L(θ) is then expressed as: .

[0088] The reference distribution value y1 ik represents the true distribution mean of the k-th valence state in the i-th sample, which can be obtained from domestic soil heavy metal standard values ​​or historical soil monitoring data, providing a reference distribution for target soil samples lacking experimental data. The 1 / N ratio is used to average the constraint errors of the N samples, ensuring that the constraint term values ​​do not expand with the increase in the number of samples, thus keeping the loss function stable under different data volumes. θ represents all trainable parameters in the neural network, including the weight matrices from the input layer to the hidden layer, from the hidden layer to the output layer, and the bias terms of each layer. The predicted distribution value y2... ikThe model's prediction accuracy is improved by minimizing the error between predicted and actual values ​​through adjusting θ, which is entirely dependent on θ. The error is calculated separately for each valence state in the loss function and accumulated into the total loss, ensuring the network simultaneously considers the prediction accuracy of multiple valence states. N represents the total number of heavy metal samples to be detected in the soil, and is a natural number greater than 0. The loss function represents the mean squared error of all samples and valence states, used to measure the degree of difference between the model's predicted and actual values. The loss constraint term Le is used to embed prior knowledge, control model complexity, prevent overfitting, or reinforce specific patterns. (y1) ik -y2 ik ) 2 This represents the squared error of the i-th sample at the k-th valence state, used to measure the degree of deviation between the predicted value and the true value. The squared term has a higher penalty for large errors.

[0089] Furthermore, as a feasible implementation, the loss constraint term Le satisfies the following calculation formula:

[0090] ,

[0091] Where γ in the formula represents the constraint weight coefficient, and in the formula... This represents the squared penalty term for prediction bias.

[0092] The constraint weight coefficient γ represents an adjustable scalar parameter used to control the weight of the constraint terms in the total loss function L(θ), enabling the network to balance prediction accuracy and physical plausibility. A larger γ results in stronger penalties for deviations from 1 in the total predicted output, with the model more strictly adhering to the price state conservation constraint; a smaller γ weakens the emphasis on the constraint, with the model focusing more on prediction accuracy. 1 / N is the average of the constraint errors across N samples. The squared penalty term represents the predicted distribution value y2 for the i-th sample. ik The deviations from 1 are summed to measure whether the predicted total valence state conforms to the physical constraints. The prediction deviation is squared to ensure that the deviation is positive, while increasing the penalty for deviation to strengthen the punishment effect on deviations from the conservation constraints. Summing over samples N represents the accumulation of constraint deviations over all samples i, ensuring that the constraint term works for every sample in the training set, not just a single sample. In multi-valence state distribution prediction, to prevent the sum of valence state proportions output by the model from deviating from the physical conservation constraints, a penalty term is introduced into the loss constraint term. This ensures that while the model learns the influence of peak energy, full width at half maximum, X-ray intensity ratio, pH value, and mean water content on the valence state distribution, the sum of the proportions of each valence state should be close to 1. The loss constraint term ensures that the multi-valence state prediction not only numerically fits the samples but also conforms to the chemical laws of soil heavy metals, avoiding non-physical predictions in the network such as excessively high individual valence states or sums exceeding reality.

[0093] Furthermore, as a feasible implementation method, the main peak energy value, main peak half-width at half-maximum value, X-ray intensity ratio, pH value, and average water content are represented as Ei, Wi, Ri, pHi, and Mi, respectively; the model mapping function of the multilayer perceptron network is set as f. k Define the reference distribution value y1 ik and predicted distribution value y2 ik All conform to the model mapping function f k Set the model mapping function f k The input feature vector is represented as x i ,

[0094] Set the model mapping function f k Represented as f k =(x i ; θ),

[0095] Wherein, the input feature vector x i Satisfy x i =[Ei, Wi, Ri, pHi, Mi].

[0096] Model mapping function f k This indicates that the multilayer perceptron network responds to the input feature x. i The mapping outputs the predicted distribution value y2 of the k-th valence state of the target element. ik This achieves a nonlinear mapping from spectral characteristics and soil environmental parameters to the distribution of various valence states. In the model mapping function f... k The independent variable θ is inserted to determine how the model maps input features to output predictions. During training, the network minimizes the reference distribution value y1. ik and predicted distribution value y2 ik The error is used to optimize θ, enabling the model to accurately predict the valence distribution of unknown soil samples. Elemental spectral characteristics are fused with soil environmental parameters to ensure that the model input includes both physical signals and environmental information; the model mapping function f... k By implementing complex nonlinear mapping through a multilayer perceptron network, the coupling relationship between spectral features and soil conditions on valence distribution can be captured, realizing multi-valence nonlinear prediction based on spectral features and soil environmental parameters. It balances accuracy and environmental adaptability and is suitable for rapid on-site detection and risk assessment of heavy metals in soil.

[0097] Example 4: In this example, a confidence interval is used to represent the predicted distribution value of the valence state distribution of each element. The process of generating the confidence interval includes: setting the confidence level of the confidence interval based on the predicted distribution value, obtaining the activation value of the hidden layer neurons in the multilayer perceptron, and determining the confidence boundary of each valence state distribution based on the activation value and the confidence level to complete the confidence interval.

[0098] The initial confidence level is set based on the predicted distribution value, and can be adjusted to, for example, 90%, 95%, or 99%, representing the probability that the predicted value falls within the confidence interval. A higher confidence level results in a wider confidence interval; a lower confidence level results in a narrower interval. Preset confidence levels allow users to choose an appropriate level based on their risk tolerance, balancing prediction accuracy and conservatism. Hidden layer activation values ​​reflect the nonlinear mapping of input features within the network and are crucial intermediate information for the prediction results. By analyzing the activation distribution of the hidden layers, the sources of prediction uncertainty can be quantified. Using the distribution characteristics of the hidden layer activation values, such as variance or covariance, the uncertainty of the output prediction is estimated, and the boundary values ​​of the confidence interval are adjusted to obtain the confidence interval for each price state prediction, providing a quantified uncertainty indicator.

[0099] Furthermore, as a feasible implementation, the process of obtaining the activation value includes: finding the historical predicted values ​​of the predicted distribution in the training sample space of the multilayer perceptron network, making the historical predicted values ​​distributed as Gaussian, and calculating the activation value based on the historical predicted values ​​using the Monte Carlo method.

[0100] The historical predicted values ​​represent the set of predicted distribution values ​​generated for the same input sample or similar samples during the training or validation process of the multilayer perceptron. This includes the network's prediction results for the same input under different training iterations or different random initialization conditions; different historical predicted values ​​reflect the output fluctuations of the model when facing the same input. Modeling the historical predicted value distribution as a Gaussian distribution allows the estimation of activation values ​​to be handled using probabilistic statistical methods, without relying on single prediction results. Random sampling is performed multiple times on the historical predicted values ​​of the Gaussian distribution to simulate the possible activation states of the network output. Each sampling yields a hidden layer activation value, forming an activation value distribution set. This random sampling can reflect the output fluctuations of the network under different input perturbations and training conditions, providing a probabilistic basis for the confidence interval of the predicted values. Using the activation value distribution generated by Monte Carlo, the upper and lower bounds of each output valence state are calculated. The uncertainty of the output is directly reflected by the hidden layer features, improving the reliability of the confidence interval.

[0101] Furthermore, the process of calculating activation values ​​using the Monte Carlo method includes: calculating the mean of historical predicted values ​​for each valence state of the target detection element; randomly sampling and generating a number of simulated prediction samples using the Monte Carlo method, obtaining the predicted values ​​generated by Monte Carlo sampling and labeling them as sampled predicted values; and using the mean of historical predicted values ​​and sampled predicted values ​​to obtain the activation value corresponding to each simulated prediction sample in the hidden layer neuron.

[0102] The mean of the historical predicted values ​​for each valence state of the target detection element is calculated. This mean reflects the network's average prediction result for the same input in the training or validation sample space and serves as the basic reference value for Monte Carlo sampling. Quantifying the central tendency of historical predicted values ​​helps capture the network's overall behavior under changes in input features and training conditions. The simulated predicted values ​​generated by each Monte Carlo sampling are used for subsequent calculation of hidden layer activation values, realizing the mapping from output distribution to internal activation states. Sampled predicted values ​​provide multi-dimensional simulated samples, enhancing the network's ability to analyze nonlinearity and sensitivity to input perturbations. Using the mean of historical predicted values ​​and each sampled predicted value as input, the activation values ​​of the corresponding hidden layer neurons are calculated in reverse. These activation values ​​reflect the network's internal response strength to input features and sampled predicted values. Utilizing multiple sampling and the hidden layer activation distribution makes the confidence interval more stable and the judgment under abnormal predictions or rare conditions more reliable.

[0103] Furthermore, as a feasible implementation method, the price state evaluation strategy includes:

[0104] Based on soil environmental standards, a pollution threshold is set for the confidence interval of each valence state of the target element, where the pollution threshold represents the distribution content; the predicted distribution value of each valence state of the target element is taken, and the predicted distribution value is used to represent the confidence interval.

[0105] For any highly toxic pollutant valence state of the target element, if the lower confidence boundary of the confidence interval is greater than the pollution threshold, the target element is judged to be highly polluted in the target soil; if the upper confidence boundary of the confidence interval is less than the pollution threshold, the target element is judged to be low polluted in the target soil; if the pollution threshold is within the range of the confidence interval, the judgment result is marked as unknown pollution.

[0106] The pollution threshold is a standard limit for a specific valence state of a target element. In practical applications, it can be derived from soil environmental standards, such as national or local soil heavy metal standards. It indicates that if the content of that valence state exceeds the threshold, a potential environmental risk is considered to exist. The pollution threshold provides a reference for comparing confidence intervals with standard values, transforming continuous predicted distributions into operational classification indicators. Even considering uncertainty, when pollution is determined to be high pollution, the lower boundary pollution threshold of the confidence interval for highly toxic valence states means that the actual content of that valence state still has a high probability of exceeding the standard, thus classifying it as high pollution. When pollution is determined to be low pollution, the upper boundary pollution threshold of the confidence interval indicates that the content of that valence state is still lower than the standard, or the proportion of elements with low toxic valence states is significantly higher, thus classifying it as low pollution. When pollution is determined to be unknown pollution, the pollution threshold lies within the confidence interval. The prediction of this valence state has significant uncertainty, and the degree of toxicity pollution cannot be clearly determined; it needs to be labeled as "unknown pollution," and further testing or sampling may be required. Combining confidence intervals with standardized pollution indicators achieves the scientific classification of predicted values. It considers not only the average forecast but also the uncertainty of the forecast, thereby improving the robustness of decision-making.

[0107] More specifically, the pollution threshold is set to be obtained by weighted summation of the threshold of the soil environmental standard and the statistical threshold; the statistical threshold is set based on the mean of historical prediction data.

[0108] The threshold values ​​in the soil environmental standards represent limits stipulated by national or local soil environmental standards, such as the maximum allowable concentration or proportion of a certain element in soil. The statistical threshold values ​​represent the average limit values ​​calculated from the historical predicted data or other statistical indicators of the target soil sample. When the threshold values ​​in the soil environmental standards have a greater weight, it indicates that the pollution threshold is more dependent on environmental standards, resulting in stricter judgments, suitable for high-risk areas or scenarios with stringent regulatory requirements. When the statistical threshold values ​​have a greater weight, it indicates that the pollution threshold is more dependent on historical data, resulting in judgments that better reflect the actual conditions of the target soil sample, suitable for large-scale initial screening or areas with complex environmental backgrounds. Weighting and summing the two threshold values ​​to obtain the pollution threshold balances scientific standards and sample characteristics, achieving robustness and flexibility in judgment; it avoids over- or under-judgment due to a single, fixed standard threshold, improving the reliability of rapid screening; and it can flexibly adapt to different screening scenarios or policy requirements, better accommodating the distribution differences of different soil samples, achieving a balance between high-risk or large-area rapid screening.

[0109] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An XRF metal detection and analysis method for heavy metal pollution in soil, characterized in that, The method includes: Step S1: Use the initial XRF detection process to detect all metal elements in the target soil, collect the main peak energy value, X-ray intensity value and main peak half width value for each metal element, and screen out the target elements with valence state differences; Step S2: Select the co-occurring elements of the target detection element from all metal elements and label them as indicator elements. Calculate the ratio of the X-ray intensity values ​​of the target detection element and the indicator element, and collect the average pH value and water content of the target detection soil. Step S3: Construct a multi-output regression model based on a multilayer perceptron network, and set the main peak energy value, the main peak half width at half maximum value, the ratio of X-ray intensity values, the pH value and the mean water content as the input signals of the multi-output regression model; Step S4: Use a multi-output regression model to generate predicted distribution values ​​representing the valence distribution of each target detection element, construct a valence assessment strategy, and use the valence assessment strategy to label the target detection soil detection results based on the predicted distribution values; Step S5: The detection results of the target soil are screened into high pollution, low pollution and unknown pollution. When the target soil is marked as unknown pollution, step S1 is repeated and the indicator element is replaced before the detection is repeated. The process of selecting indicator elements includes: using partial correlation analysis to calculate the partial correlation coefficient between candidate co-occurrence elements and target detection elements, and performing a significance test on the partial correlation coefficient to obtain the significance test value; A significance threshold is set for the partial correlation coefficient. When the significance test value of the partial correlation coefficient exceeds the significance threshold, it is determined that the degree of partial correlation has reached significance, and it is determined that the symbiosis between the candidate symbiotic element and the target detection element is affected by the acidity or alkalinity of the target detection soil. At this time, the candidate symbiotic element is replaced. When the significance test value of the partial correlation coefficient does not exceed the significance threshold, it is determined that there is no partial correlation phenomenon, and the current candidate symbiotic element is determined to meet the indicator element. The partial correlation coefficient is calculated using partial correlation analysis based on the Pearson correlation coefficient and labeled as the Pearson partial correlation coefficient. The process includes: Let the Pearson correlation coefficients between the candidate symbiotic element and the target element, between the candidate symbiotic element and pH value, and between the target element and pH value be represented as the first Pearson coefficient λ1, the second Pearson coefficient λ2, and the third Pearson coefficient λ3, respectively; let the Pearson partial correlation coefficient be represented as λe. The formula for calculating the Pearson partial correlation coefficient is as follows: 。 2. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 1, characterized in that, The calculation process for the significance test value of the partial correlation coefficient is set as follows: Let the significance test value be denoted as Z, then the formula for calculating the significance test value is: , In the formula, p represents the total number of observed samples, q represents the total number of control variables, (pq-2) represents the degrees of freedom term in the significance test process, and (1-λe) represents the total number of control variables. 2 ) represents the variance compensation term of the Pearson partial correlation coefficient.

3. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 1, characterized in that, The configuration of the multilayer perceptron network includes: Input layer: Normalize the peak energy value, peak half-width at half-maximum value, X-ray intensity ratio, pH value, and average water content. Receive the peak energy value, peak half-width at half-maximum value, and X-ray intensity ratio as input signals, wherein the number of nodes in the input layer is equal to the total dimension of the input signal. Hidden layer: Several neurons are labeled as control gate units, and the gating weight coefficients are output through the Sigmoid activation function. The gating weight coefficients are multiplied with the input signals of the other neurons in an element-wise weighted manner to calculate the feature response value representing the gating modulation. The feature response value is processed by the ReLU activation function and then passed to the output layer. Output layer: A loss function is constructed based on the main peak energy value, main peak half width at half maximum value, X-ray intensity ratio, pH value and average water content of the input signal. The loss function is used to calculate the predicted distribution value of each valence state of the output target detection element. The number of nodes in the output layer is equal to the number of valence state types of the target detection element, and the error value is passed back to the input layer. The control gate unit receives the input feature of the average water content and sets a gate threshold for the average water content. When the average water content is higher than the gate threshold, the gate factor of the control gate unit is turned on, and the hidden layer emphasizes the valence state migration feature. When the average water content is lower than the gate threshold, the gate factor of the control gate unit is turned off, and the hidden layer emphasizes the valence state stability feature.

4. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 3, characterized in that, The loss function is constructed using the mean squared error method, and its contents include: Let θ represent the instantaneous model parameter set in the multilayer perceptron network; let N represent the total number of element samples for target detection, and let i represent the sample ordinal number; let J represent the total number of valence states for target detection, and let k represent the ordinal number of the valence states; let y1 represent the reference distribution value and the predicted distribution value of the i-th sample in the k-th valence state in the target detection soil. ik and y2 ik Let the loss constraint term be Le, and the loss function be L(θ). The loss function L(θ) is then expressed as: 。 5. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 4, characterized in that, The loss constraint term Le satisfies the following calculation formula: , Where γ in the formula represents the constraint weight coefficient, and in the formula... This represents the squared penalty term for prediction bias.

6. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 4, characterized in that, The main peak energy, main peak half-width at half-maximum, X-ray intensity ratio, pH value, and mean water content are represented as Ei, Wi, Ri, pHi, and Mi, respectively; the model mapping function of the multilayer perceptron network is set as f. k Define the reference distribution value y1 ik and predicted distribution value y2 ik All conform to the model mapping function f k Set the model mapping function f k The input feature vector is represented as x i , Set the model mapping function f k Represented as f k =(x i ; θ), Wherein, the input feature vector x i Satisfy x i =[Ei, Wi, Ri, pHi, Mi].

7. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 4, characterized in that, The confidence interval is used to represent the predicted distribution value of the valence state distribution of each element. The process of generating the confidence interval includes: setting the confidence level of the confidence interval based on the predicted distribution value, obtaining the activation value of the hidden layer neurons in the multilayer perceptron, and determining the confidence boundary of each valence state distribution based on the activation value and the confidence level to complete the confidence interval.

8. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 7, characterized in that, The process of obtaining the activation value includes: finding the historical predicted values ​​of the predicted distribution in the training sample space of the multilayer perceptron network, making the distribution of the historical predicted values ​​Gaussian, and using the Monte Carlo method to calculate and obtain the activation value based on the historical predicted values.

9. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 8, characterized in that, The process of calculating activation values ​​using the Monte Carlo method includes: calculating the mean of historical predicted values ​​for each valence state of the target detection element; randomly sampling and generating a number of simulated prediction samples using the Monte Carlo method, obtaining the predicted values ​​generated by Monte Carlo sampling and labeling them as sampled prediction values; and using the mean of historical predicted values ​​and sampled prediction values ​​to obtain the activation value corresponding to each simulated prediction sample in the hidden layer neuron.

10. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 7, characterized in that, The price assessment strategy includes the following: Based on soil environmental standards, a pollution threshold is set for the confidence interval of each valence state of the target element, where the pollution threshold represents the distribution content; the predicted distribution value of each valence state of the target element is taken, and the predicted distribution value is used to represent the confidence interval. For any highly toxic pollutant valence state of the target element, if the lower confidence boundary of the confidence interval is greater than the pollution threshold, the target element is judged to be highly polluted in the target soil; if the upper confidence boundary of the confidence interval is less than the pollution threshold, the target element is judged to be low polluted in the target soil; if the pollution threshold is within the range of the confidence interval, the judgment result is marked as unknown pollution.

11. The XRF metal detection and analysis method for heavy metal pollution in soil according to claim 10, characterized in that, The pollution threshold is set by weighting and summing the threshold of the soil environmental standard and the statistical threshold; the statistical threshold is set based on the mean of historical prediction data.

Citation Information

Patent Citations

  • X-ray fluorescence spectrum quantitative analysis method based on LM-BP neural network

    CN103792246A

  • Method and system for analyzing content of heavy metal elements in soil based on XRF

    CN119643611A