A rapid detection method for heavy metal pollution in soil based on spectral technology
By employing a rapid detection method for heavy metal pollution in soil based on spectral technology, and utilizing dual-band spectral and temperature/humidity parameter compensation processing and a CNN-RF hybrid model, in-situ non-destructive rapid detection is achieved. This solves the problems of high cost and long time consumption of traditional detection methods, and improves detection efficiency and accuracy.
Patent Information
- Application Number
- CN202510393280.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2045-03-31
AI Technical Summary
Existing soil heavy metal detection technologies are costly, time-consuming, and difficult to meet the needs of rapid on-site detection. Traditional methods require laboratory environments and professional personnel, and the sample pretreatment is complex, affecting the accuracy and timeliness of the test results.
A rapid detection method for heavy metal pollution in soil based on spectral technology is proposed. By acquiring dual-band spectral reflectance data and temperature and humidity parameters, spectral feature compensation processing is performed to construct a multi-dimensional spectral feature matrix. Then, a CNN-RF hybrid model is used for detection to achieve in-situ non-destructive rapid detection.
It effectively reduces interference from environmental factors, improves detection efficiency and accuracy, and can promptly identify heavy metal pollution in soil, ensuring soil environmental safety.
Smart Images

Figure CN120253719B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of soil detection, and particularly relates to a soil heavy metal pollution rapid detection method based on spectral technology. BACKGROUND
[0002] Soil, as a key resource for human survival, plays a vital role in human production and life. However, with the acceleration of industrialization and the continuous advancement of urbanization, soil pollution problems have become increasingly prominent, and heavy metal pollution has become a global focus. Once heavy metals such as lead, cadmium, and mercury enter the soil environment, they are difficult to decompose and degrade through natural processes, and have strong persistence and bioaccumulation. These heavy metals will gradually accumulate along the food chain and eventually enter the human body, posing a serious threat to human health. For example, long-term intake of agricultural products with excessive heavy metals may cause damage to human organ function, nervous system disorders, and a series of health problems. Therefore, effective monitoring and control of heavy metals in soil have become a top priority.
[0003] In existing soil heavy metal detection technologies, traditional laboratory analysis methods such as atomic absorption spectrometry and inductively coupled plasma mass spectrometry can provide high-precision detection results, but these methods have many limitations. On the one hand, these devices are usually expensive, require specialized laboratory environments and professional technicians for operation and maintenance, which significantly increases the cost of detection and limits their application in large-scale soil pollution surveys and on-site rapid detection. On the other hand, the sample pretreatment process of these methods is complex and tedious, usually requiring soil samples to be pretreated by digestion, which not only takes a long time but also easily introduces errors, affecting the accuracy and timeliness of the detection results, making it difficult to meet the needs of real-time monitoring and rapid decision-making on site.
[0004] Therefore, there is an urgent need to provide a technical solution to solve the above problems. SUMMARY
[0005] To solve the above technical problems, the present application provides a soil heavy metal pollution rapid detection method based on spectral technology.
[0006] In a first aspect, the present application provides a soil heavy metal pollution rapid detection method based on spectral technology, and the technical scheme of the method is as follows:
[0007] Obtain the dual-band spectral reflectance data and temperature and humidity parameters of the soil to be detected, and perform spectral feature compensation processing on the dual-band spectral reflectance data based on the temperature and humidity parameters to generate a target spectral curve and obtain an environmental compensation parameter;
[0008] extracting a spectral feature parameter from the target spectral curve, and reducing dimensions of the spectral feature parameter and the environmental compensation parameter through principal component analysis to construct a multi-dimensional spectral feature matrix;
[0009] inputting the multi-dimensional spectral feature matrix into a trained soil heavy metal pollution detection model to obtain a heavy metal pollution detection result of the soil to be measured; wherein the trained soil heavy metal pollution detection model is obtained by iteratively training a pre-trained CNN-RF hybrid model.
[0010] Further, the step of obtaining the dual-band spectral reflectance data and the temperature and humidity parameters of the soil to be measured comprises:
[0011] The dual-band spectral reflectance data and the temperature and humidity parameters of the soil to be measured are obtained by in-situ scanning of the soil to be measured using a hyperspectral imaging device integrated with a temperature and humidity sensor.
[0012] Further, the step of performing spectral feature compensation processing on the dual-band spectral reflectance data based on the temperature and humidity parameters to generate a target spectral curve and obtain an environmental compensation parameter comprises:
[0013] Based on the temperature and humidity parameters, baseline drift correction and noise suppression are performed on the dual-band original spectral reflectance data through an adaptive Kalman filtering algorithm to generate the target spectral curve, and the environmental compensation parameter including a baseline offset correction value and a noise suppression gain coefficient is output from the adaptive Kalman filtering algorithm.
[0014] Further, the spectral feature parameter comprises a dual-band spectral reflectance value, an absorption feature peak position and a shape parameter; the step of extracting a spectral feature parameter from the target spectral curve comprises:
[0015] The dual-band spectral reflectance value and the corresponding dual-band spectral wavelength are extracted from the target spectral curve; the dual-band spectral wavelength is used to determine a heavy metal sensitive waveband range;
[0016] The target spectral curve is subjected to first derivative transformation, and the absorption feature peak position is determined through a local minimum value detection algorithm within the heavy metal sensitive waveband range corresponding to the dual-band spectral wavelength; the absorption feature peak position comprises an absorption valley center wavelength and a half-height width;
[0017] The shape parameter is obtained by calculating the spectral shape parameter and the spatial shape parameter of the target spectral curve.
[0018] Further, the spectral form parameters are spectral curve symmetry and spectral curvature, and the spatial form parameters are soil surface texture features; the step of calculating the spectral form parameters and the spatial form parameters of the target spectral curve comprises:
[0019] The spectral curve symmetry and the spectral curvature of the target spectral curve are calculated, and the soil surface texture features are extracted based on the spatial resolution of the target spectral curve; wherein the soil surface texture features comprise energy, contrast, entropy value and fractal dimension of a gray level co-occurrence matrix.
[0020] Further, the trained soil heavy metal pollution detection model comprises an input unit, a convolution unit, a feature fusion unit and an output unit connected in sequence;
[0021] The input unit is configured to convert the multi-dimensional spectral feature matrix into a target three-dimensional tensor; the convolution unit is configured to perform convolution processing on the target three-dimensional tensor to obtain a target feature map; the feature fusion unit is configured to perform flattening processing on the target feature map to obtain a one-dimensional feature vector and input the one-dimensional feature vector into a random forest model, perform feature sorting by calculating Gini importance, filter out a sensitive band combination associated with heavy metals, and assign a dynamic weight coefficient to each band in the sensitive band combination based on the feature importance sorting result to obtain a weighted feature vector; and the output unit is configured to input the weighted feature vector into a fully connected regression layer to obtain the heavy metal pollution detection result.
[0022] Further, the heavy metal pollution detection result comprises a heavy metal concentration prediction value and a heavy metal pollution distribution heat map; and the output unit is specifically configured to:
[0023] input the weighted feature vector into the fully connected regression layer for linear weighted calculation to obtain the heavy metal concentration prediction value, and map the concentration prediction value to a two-dimensional space based on spatial coordinate information of the target spectral curve to generate the heavy metal pollution distribution heat map.
[0024] In a second aspect, the present application provides a soil heavy metal pollution rapid detection system based on spectral technology, and the technical scheme of the system is as follows:
[0025] The acquisition module is configured to acquire double-band spectral reflectance data and temperature and humidity parameters of the soil to be measured, perform spectral feature compensation processing on the double-band spectral reflectance data based on the temperature and humidity parameters, generate a target spectral curve and acquire an environment compensation parameter;
[0026] A construction module is configured to extract spectral feature parameters from the target spectral curve, and to construct a multi-dimensional spectral feature matrix by reducing dimensions of the spectral feature parameters and the environmental compensation parameters through principal component analysis.
[0027] A detection module is configured to input the multi-dimensional spectral feature matrix into a trained soil heavy metal pollution detection model to obtain a heavy metal pollution detection result of the soil to be detected.
[0028] In a third aspect, a technical solution of an electronic device according to the present application is as follows:
[0029] The electronic device includes a memory, a processor, and a program stored in the memory and running on the processor, and the processor implements the steps of the soil heavy metal pollution rapid detection method based on spectral technology according to the present application when executing the program.
[0030] In a fourth aspect, a technical solution of a computer readable storage medium according to the present application is as follows:
[0031] The computer readable storage medium stores instructions, and when the computer readable storage medium reads the instructions, the computer readable storage medium executes the steps of the soil heavy metal pollution rapid detection method based on spectral technology according to the present application.
[0032] The present application realizes in-situ non-destructive rapid detection of soil heavy metals through dual-band spectral technology and environmental dynamic compensation technology, effectively reduces the interference of environmental factors on spectral measurement, improves the detection efficiency, and accurately identifies the pollution of heavy metals in soil through a CNN-RF hybrid model, thereby improving the reliability and precision of soil heavy metal pollution, helping to take corresponding control measures in time, and ensuring the safety of the soil environment.
[0033] Other advantages, objects, and features of the present application will be set forth in part in the following specification, and in part will become apparent to those skilled in the art from the following specification, or can be learned from practice of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0035] Figure 1A flowchart of an embodiment of a soil heavy metal pollution rapid detection method based on spectral technology according to the present application is shown in the figure.
[0036] Figure 2 A structural diagram of a trained soil heavy metal pollution detection model is shown in the figure.
[0037] Figure 3 A structural diagram of an embodiment of a soil heavy metal pollution rapid detection system based on spectral technology according to the present application is shown in the figure.
[0038] Figure 4 A structural diagram of an embodiment of an electronic device according to the present application is shown in the figure. DETAILED DESCRIPTION
[0039] The technical solutions in the embodiments of the present application will be described clearly and completely below. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0040] Figure 1 A flowchart of an embodiment of a soil heavy metal pollution rapid detection method based on spectral technology according to the present application is shown in the figure. As shown in the figure, the method comprises the following steps: Figure 1
[0041] S1, obtaining double-band spectral reflectance data and temperature and humidity parameters of the soil to be measured, and performing spectral feature compensation processing on the double-band spectral reflectance data based on the temperature and humidity parameters, generating a target spectral curve and obtaining an environmental compensation parameter.
[0042] In the embodiment, the soil to be measured is the soil that needs to be detected for heavy metal pollution, and the scene where the soil is located is not limited. Double-band refers to the visible-near infrared band (400-2500 nm) and the short-wave infrared band (1300-2500 nm). Double-band spectral reflectance data refers to the ratio data of the light intensity reflected by the soil surface to the light intensity reflected by a standard white board in the visible-near infrared and short-wave infrared band ranges. The temperature and humidity parameters are the surface temperature (℃) of the soil to be measured and the environmental humidity (%RH).
[0043] In S1, the step of obtaining the double-band spectral reflectance data and the temperature and humidity parameters of the soil to be measured comprises: using a hyperspectral imaging device integrated with a temperature and humidity sensor to scan the soil to be measured in situ, and obtaining the double-band spectral reflectance data and the temperature and humidity parameters of the soil to be measured.
[0044] The hyperspectral imaging device is a portable hyperspectral imaging device currently available on the market, such as Headwall Nano-Hyperspec, Specim IQ, and the like, and has the characteristics of lightweight and field operation, and can collect spectral data in the visible light-near infrared range. The principle of in-situ scanning is to directly scan the soil surface without laboratory digestion treatment, which breaks through the limitation of traditional hyperspectral equipment relying on laboratory sample preparation. The hyperspectral imaging device in the embodiment is integrated with a temperature and humidity sensor for synchronously acquiring temperature and humidity parameters.
[0045] In S1, the step of performing spectral feature compensation processing on the dual-band spectral reflectance data based on the temperature and humidity parameters to generate a target spectral curve and acquire an environmental compensation parameter includes: based on the temperature and humidity parameters, performing baseline drift correction and noise suppression on the dual-band original spectral reflectance data through an adaptive Kalman filtering algorithm to generate the target spectral curve, and outputting the environmental compensation parameter containing a baseline offset correction value and a noise suppression gain coefficient from the adaptive Kalman filtering algorithm.
[0046] The adaptive Kalman filtering algorithm is a filtering algorithm that dynamically adjusts parameters and is used for real-time correction of environmental interference. Baseline drift correction refers to eliminating the overall baseline shift of the spectrum caused by temperature changes. The target spectral curve refers to the optimized spectral data curve after environmental interference correction and noise suppression based on the dual-band spectral reflectance data, and its core function is to eliminate the data deviation introduced by factors such as temperature and humidity changes, equipment noise, and the like in field detection, thereby improving the accuracy and reliability of subsequent analysis. The environmental compensation parameter contains dynamic correction factors: baseline offset correction value (ΔB) and noise suppression gain coefficient (G). The environmental compensation parameter and the temperature and humidity parameter are used together to represent the quantitative characteristics of environmental interference.
[0047] It should be noted that: ① Since temperature changes will cause overall shift of spectral reflectance (e.g., for every 10℃ increase in temperature, the baseline overall moves 0.1-0.3 units), the baseline drift correction in the embodiment uses the temperature and humidity parameters as inputs to dynamically calculate the baseline offset correction value (ΔB) through the adaptive Kalman filtering algorithm, and compensates the original dual-band spectral reflectance data, and the specific formula is: 校正 R 原始 + ΔB(T, H); R 原始 is the dual-band spectral reflectance data, R 校正For the baseline drift corrected spectral data, T is the temperature, H is the humidity, and AB is updated iteratively by the Kalman filter algorithm. Due to high-frequency fluctuations of the spectral curve caused by device electronic noise, environmental light interference, etc., the noise suppression in this embodiment uses the prediction-update mechanism of the Kalman filter combined with a noise suppression gain coefficient (G) to smooth the spectral data. The specific formula is: 平滑 R 校正 = G x R 预测 + (1-G) x R 平滑 ; R 预测 is the target spectral curve, R 2 is the reflectance value predicted from historical data. For example, in soil detection of an industrial pollution site, the environmental temperature is 40°C and the humidity is 85%. High temperature causes the overall reflectance of the dual-band spectral reflectance data to be high (offset AB = +0.25), and high humidity causes high-frequency fluctuations (signal-to-noise ratio SNR = 12 dB). After baseline correction (AB = -0.25 compensation) and noise suppression (G = 0.9), the spectral curve returns to the true reflectance level, the signal-to-noise ratio is improved to SNR = 28 dB, and the spectral curve is more clear.
[0048] S2, extract spectral feature parameters from the target spectral curve, and reduce the spectral feature parameters and the environmental compensation parameters by principal component analysis to construct a multi-dimensional spectral feature matrix.
[0049] wherein the target spectral curve is stored in the form of a digital signal. The spectral feature parameters include dual-band spectral reflectance values, absorption characteristic peak positions, and morphological parameters. The multi-dimensional spectral feature matrix is a feature matrix containing chemical characteristics, physical characteristics, and environmental compensation parameters, and the matrix dimension is N x M (N is the number of samples, and M is the number of principal components). The number of samples refers to the number of independent detection units collected when scanning the soil surface in situ, and each sample corresponds to a pixel or a set of adjacent pixels (such as a 3 x 3 pixel block) in a hyperspectral image, representing an independent spatial detection point. The number of principal components refers to the number of principal components retained after principal component analysis (PCA) dimension reduction, which is automatically determined by the PCA algorithm according to the variance contribution rate (> 95%) and is used to represent the effective dimensions of the retained chemical, physical, and environmental compensation characteristics in the multi-dimensional feature matrix. For example, if the resolution of the hyperspectral imaging device is 0.1 mm / pixel, then 1 m 2 of the soil surface corresponds to N = 10 4 samples, ensuring that the spatial coverage density meets the pollution distribution analysis requirements. The number of principal components M is not fixed, for example, when the original feature dimension is 200, M can be compressed to 10-15, achieving a balance between calculation efficiency and information retention.
[0050] It should be noted that the number of spectral feature parameters extracted from the target spectral curve is multiple, which is determined according to the type of heavy metal, such as the heavy metal to be detected in the embodiment is lead, cadmium and mercury by default, the number of spectral feature parameters is three, and the number of multi-dimensional spectral feature matrix is also three. Principal component analysis is suitable for compression of high-dimensional spectral data by maximizing variance to preserve spectral feature information.
[0051] In S2, the step of extracting spectral feature parameters from the target spectral curve comprises:
[0052] The double-band spectral reflectance value and the corresponding double-band spectral wavelength are extracted from the target spectral curve.
[0053] The double-band spectral wavelength is used to determine the heavy metal sensitive band range. The double-band in the target spectral curve includes: ① the first band: visible-near infrared band (400-2500 nm), covering the electronic transition and molecular vibration characteristics of heavy metals; ② the second band: short-wave infrared band (1300-2500 nm), enhancing the capture of heavy metal-organic compound absorption peaks. Specifically, the target spectral curve is divided by band to extract data: the first band spectral reflectance data set (containing 2101 first band spectral reflectance values) and the second band spectral reflectance data set (containing 1201 second band spectral reflectance values), each double-band spectral reflectance value R λ The unique double-band spectral wavelength λ.
[0054] The target spectral curve is subjected to first derivative transformation, and the absorption characteristic peak position is determined by a local minimum value detection algorithm within the heavy metal (each heavy metal) sensitive band range corresponding to the double-band spectral wavelength.
[0055] The heavy metal sensitive band range includes: lead sensitive band (1400-1600 nm), cadmium sensitive band (2200-2400 nm), and mercury sensitive band (2450-2500 nm) range. The absorption characteristic peak position includes the absorption valley center wavelength and the half-height width. The first derivative transformation of the target spectral curve enhances the edge features of the absorption valley in the spectral curve, facilitating accurate absorption characteristic peak position. After the first derivative transformation, the derivative curve can also be subjected to secondary smoothing (such as moving average filtering) to reduce high-frequency noise interference.
[0056] Wherein, the heavy metals in the embodiment are lead, cadmium and mercury by default. The first derivative curve of the target spectrum curve is aligned with the dual-band spectrum wavelength, and the local minimum value detection algorithm is used to locate the absorption valley center wavelength (λpeak) and the full width at half maximum (FWHM) on the derivative curve. The specific process is: ① Traverse all wavelength points in the sensitive band, if the spectral reflectance value of any wavelength point is less than the spectral reflectance value of the adjacent wavelength point, then the wavelength point is taken as a candidate minimum value point, until all candidate minimum value points are obtained. ② According to the derivative threshold, only the candidate minimum value points with spectral reflectance values less than the derivative threshold are retained. ③ Among the retained candidate minimum value points, the wavelength corresponding to the minimum derivative value is selected as the absorption valley center wavelength (λpeak). ④ Taking the absorption valley center wavelength as the center, expand to both sides to half of the minimum value (λpeak×1 / 2) when the derivative value rises, and the wavelength difference on both sides is the full width at half maximum (FWHM).
[0057] It should be noted that each heavy metal corresponds to its own absorption valley center wavelength and half width.
[0058] By calculating the spectral shape parameters and spatial shape parameters of the target spectrum curve, the morphological parameters are obtained.
[0059] Wherein, the spectral shape parameters are: spectral curve symmetry and spectral curvature. The spatial shape parameters are: soil surface texture characteristics. Specifically: calculate the spectral curve symmetry and the spectral curvature of the target spectrum curve, and extract the soil surface texture characteristics based on the spatial resolution of the target spectrum curve.
[0060] Wherein, the spectral curve symmetry S = left half peak area / right half peak area; the spectral curvature K = second derivative extreme value. The soil surface texture characteristics include: energy, contrast, entropy value and fractal dimension of the gray level co-occurrence matrix. Fractal dimension is a parameter for quantifying soil surface roughness (such as 2.1 indicating relatively smooth, 2.5 indicating relatively rough). The gray level co-occurrence matrix (GLCM) analyzes soil texture, and high energy value indicates uniform texture and high entropy value indicates high complexity.
[0061] It should be noted that each heavy metal corresponds to its own spectral curve symmetry, spectral curvature and soil surface texture characteristics.
[0062] In S2, the steps of reducing the spectral feature parameters and the environmental compensation parameters by principal component analysis to construct a multi-dimensional spectral feature matrix include:
[0063] The reflectance value, the absorption valley center wavelength, the full width at half maximum (FWHM), the morphological parameters, and the environmental compensation parameters are reduced in dimensionality using principal component analysis (PCA) to construct a multi-dimensional spectral feature matrix containing chemical features, physical features, and environmental compensation parameters. The matrix dimension is N×M (N is the number of samples, and M is the number of principal components).
[0064] It should be noted that each heavy metal corresponds to its own multi-dimensional spectral feature matrix. For example, the multi-dimensional spectral feature matrix for lead has dimensions N×M. Pb The dimension of the multidimensional spectral feature matrix corresponding to cadmium is N×M. Cd The dimension of the multidimensional spectral feature matrix corresponding to mercury is N×M. Hg ).
[0065] S3. Input the multi-dimensional spectral feature matrix into the trained soil heavy metal pollution detection model to obtain the heavy metal pollution detection results of the soil to be tested.
[0066] The trained soil heavy metal pollution detection model is obtained through iterative training of a pre-trained CNN-RF hybrid model. The heavy metal pollution detection results include: predicted heavy metal concentrations and a heatmap of heavy metal pollution distribution.
[0067] It should be noted that in this embodiment, the multi-dimensional spectral feature matrix corresponding to each heavy metal is input into the trained soil heavy metal pollution detection model to obtain the pollution detection results of each heavy metal in the soil to be tested.
[0068] In S3, such as Figure 2 As shown, the trained soil heavy metal pollution detection model includes an input unit, a convolution unit, a feature fusion unit, and an output unit connected sequentially. The input unit converts the multi-dimensional spectral feature matrix into a target three-dimensional tensor. The convolution unit performs convolution processing on the target three-dimensional tensor to obtain a target feature map. The feature fusion unit flattens the target feature map to obtain a one-dimensional feature vector, inputs it into a random forest model, ranks the features by calculating Gini importance, selects sensitive band combinations associated with heavy metals, and assigns dynamic weight coefficients to each band in the sensitive band combination based on the feature importance ranking result to obtain a weighted feature vector. The output unit inputs the weighted feature vector into a fully connected regression layer to obtain the heavy metal pollution detection result.
[0069] Wherein, taking any one heavy metal as an example: ① The dimension of the multi-dimensional spectral feature matrix is N x M, and the dimension of the target three-dimensional tensor is N x M x 1. The 1 in the target three-dimensional tensor represents a single channel. For example, N = 1000 and M = 12, and the size of the target three-dimensional tensor is 1000 x 12 x 1. The spectral feature matrix is simulated as a "space-channel" structure, which facilitates the convolution layer to extract local band correlation (such as the nonlinear relationship between adjacent principal components). ② The convolution unit includes two convolution layers, namely: a first convolution layer and a second convolution layer. The input of the first convolution layer is the target three-dimensional tensor, which is subjected to spatial convolution operation by using a 5 x 5 convolution kernel, and the size of the output feature map is N x (M-4) x 32. The input of the second convolution layer is the output feature map of the first convolution layer, which is subjected to deep feature extraction by using a 3 x 3 convolution kernel, and the size of the output feature map is N x (M-6) x 64. The output feature map is connected with a ReLU activation function and a maximum pooling layer, and the size of the feature map after pooling is compressed to N x ((M-6) / 2) x 64, that is, the target feature map. ③ The dimension of the one-dimensional feature vector is N x D, and D = ((M-6) / 2) x 64. The input of the random forest model is the one-dimensional feature vector, and the contribution degree (i.e., the Gini importance of each feature) of each feature to the prediction of the heavy metal concentration is calculated by the random forest model (RF model). In this embodiment, the top 10% of the wave bands with the highest contribution degree (Gini importance) are selected as the sensitive wave band combination by default, and the selection can be adjusted according to the actual situation, which is not limited herein. The formula for assigning the dynamic weight coefficient is: w i is the dynamic weight of the i-th wave band in the sensitive wave band combination, f i is the Gini importance of the i-th wave band in the sensitive wave band combination, f max is the maximum value of the Gini importance in the sensitive wave band combination, and a is a smoothing constant, which is 0.01 by default, and is used to avoid zero weight. The weighted feature vector F weighted is: F weighted = [w1·f1, w2·f2, …, w k ·f k ].
[0070] In an optional manner, the output unit is specifically configured to:
[0071] input the weighted feature vector into the fully connected regression layer for linear weighted calculation to obtain the heavy metal concentration prediction value, and map the concentration prediction value to a two-dimensional space based on the spatial coordinate information of the target spectral curve to generate the heavy metal pollution distribution heat map.
[0072] Wherein, taking any one heavy metal as an example, the formula for linear weighted calculation is: C is the heavy metal concentration prediction value, and b is the bias term. The concentration prediction value is combined with the weight of the sensitive band to highlight the pollution degree of the high contribution area. Specifically: ① for each pixel point (x, y), the weighted concentration value of the pixel point is calculated C(x,y) represents the heavy metal concentration prediction value of the point (x, y), w i (x,y) represents the dynamic weight of the i-th band in the sensitive band combination corresponding to the point (x, y). ② C weighted (x,y) is normalized to the interval [0, 1] to adapt the color mapping, and the specific formula is: ③ According to the size of C weighted (x,y), the red, yellow and green color distribution is divided, and the heavy metal pollution distribution heat map is generated. ④ By using the Sobel operator to calculate the gradient of the concentration field, an arrow is drawn on the heavy metal pollution distribution heat map every N pixels (such as 50 pixels), the direction is consistent with the gradient direction, and the length is proportional to the gradient amplitude. For example, the gradient The arrow points to the right and down, and the length = 0.32. It should be noted that each heavy metal pollution distribution heat map generated can be smoothed by Gaussian filtering to reduce noise interference. For example, taking the cadmium pollution detection (scanning area 5m*5m, resolution 1cm / pixel) of an industrial area as an example: ① the input data is the cadmium concentration prediction value (matrix) C Cd : 500*500, range [0.02, 1.5] mg / kg; the cadmium weight matrix W Cd : 2350nm sensitive band weight = 1.0, and others = 0.1. ② In the generated cadmium pollution distribution heat map, the core pollution area (x = 200, y = 300), C norm,Cd = 0.98 corresponds to dark red, and the edge area (x = 450, y = 100), C norm,Cd = 0.35 corresponds to light green. ③ The gradient The arrow points to the east and south. ④ The spatial distribution consistency of the cadmium pollution distribution heat map and the laboratory sampling result reaches 93%, and the pollution boundary positioning error is ±3cm.
[0073] The technical scheme of the embodiment realizes in-situ non-destructive rapid detection of soil heavy metals through double-band spectrum and environmental dynamic compensation technology, effectively reduces the interference of environmental factors on spectrum measurement, improves the detection efficiency, and accurately identifies the pollution of heavy metals in soil through the CNN-RF hybrid model, improves the reliability and precision of soil heavy metal pollution, helps to take corresponding treatment measures in time, and safeguards the safety of soil environment.
[0074] Figure 3 An embodiment of a soil heavy metal pollution rapid detection system 200 based on a spectrum technology provided by the application is shown in a structural schematic diagram. As shown inFigure 3 As shown, the system 200 comprises: an acquisition module 210, a construction module 220 and a detection module 230;
[0075] The acquisition module 210 is configured to acquire double-band spectral reflectance data and temperature and humidity parameters of a soil to be tested, perform spectral feature compensation processing on the double-band spectral reflectance data based on the temperature and humidity parameters, generate a target spectral curve, and acquire an environmental compensation parameter;
[0076] The construction module 220 is configured to extract a spectral feature parameter from the target spectral curve, and perform dimension reduction on the spectral feature parameter and the environmental compensation parameter by principal component analysis, and construct a multi-dimensional spectral feature matrix.
[0077] The detection module 230 is configured to input the multi-dimensional spectral feature matrix into a trained soil heavy metal pollution detection model to obtain a heavy metal pollution detection result of the soil to be tested; wherein the trained soil heavy metal pollution detection model is obtained by iteratively training a pre-trained CNN-RF hybrid model.
[0078] In an optional manner, the acquisition module 210 is specifically configured to:
[0079] The hyperspectral imaging device integrated with the temperature and humidity sensor is used to perform in-situ scanning on the soil to be tested, and the double-band spectral reflectance data and the temperature and humidity parameters of the soil to be tested are acquired.
[0080] In an optional manner, the acquisition module 210 is specifically configured to:
[0081] Based on the temperature and humidity parameters, baseline drift correction and noise suppression are performed on the double-band original spectral reflectance data by using an adaptive Kalman filtering algorithm, the target spectral curve is generated, and the environmental compensation parameter including a baseline offset correction value and a noise suppression gain coefficient is output from the adaptive Kalman filtering algorithm.
[0082] In an optional manner, the spectral feature parameter comprises a double-band spectral reflectance value, an absorption feature peak position and a form parameter; and the construction module 220 is specifically configured to:
[0083] The double-band spectral reflectance value and a corresponding double-band spectral wavelength are extracted from the target spectral curve; the double-band spectral wavelength is used to determine a heavy metal sensitive waveband range;
[0084] The target spectral curve is subjected to first derivative transformation, and the absorption feature peak position is determined by using a local minimum value detection algorithm in the heavy metal sensitive waveband range corresponding to the double-band spectral wavelength; the absorption feature peak position comprises an absorption valley center wavelength and a half-height width.
[0085] obtaining the morphological parameters by calculating spectral morphological parameters and spatial morphological parameters of the target spectral curve.
[0086] In an optional manner, the spectral morphological parameters are spectral symmetry and spectral curvature, and the spatial morphological parameters are soil surface texture features; the construction module 220 is specifically configured to:
[0087] calculate the spectral symmetry and the spectral curvature of the target spectral curve, and extract the soil surface texture features based on a spatial resolution of the target spectral curve; wherein the soil surface texture features include energy, contrast, entropy value and fractal dimension of a gray level co-occurrence matrix.
[0088] In an optional manner, the trained soil heavy metal pollution detection model includes an input unit, a convolution unit, a feature fusion unit and an output unit connected in sequence.
[0089] The input unit is configured to convert the multi-dimensional spectral feature matrix into a target three-dimensional tensor; the convolution unit is configured to perform convolution processing on the target three-dimensional tensor to obtain a target feature map; the feature fusion unit is configured to perform flattening processing on the target feature map to obtain a one-dimensional feature vector and input the one-dimensional feature vector into a random forest model, perform feature sorting by calculating Gini importance, filter out a sensitive band combination associated with heavy metals, assign a dynamic weight coefficient to each band in the sensitive band combination based on the feature importance sorting result, and obtain a weighted feature vector; and the output unit is configured to input the weighted feature vector into a fully connected regression layer to obtain the heavy metal pollution detection result.
[0090] In an optional manner, the heavy metal pollution detection result includes a heavy metal concentration prediction value and a heavy metal pollution distribution heat map; and the output unit is specifically configured to:
[0091] input the weighted feature vector into the fully connected regression layer for linear weighted calculation to obtain the heavy metal concentration prediction value, and map the concentration prediction value to a two-dimensional space based on spatial coordinate information of the target spectral curve to generate the heavy metal pollution distribution heat map.
[0092] It should be noted that the beneficial effects of the soil heavy metal pollution rapid detection system 200 based on the spectrum technology provided in the above embodiments are the same as those of the soil heavy metal pollution rapid detection method based on the spectrum technology, which will not be repeated here. In addition, when the system provided in the above embodiments implements its functions, only the division of the above functional modules is exemplified, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the system is divided into different functional modules according to actual conditions to complete all or part of the above described functions. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is described in the method embodiments, which will not be repeated here.
[0093] In some embodiments, the soil heavy metal pollution rapid detection system based on the spectrum technology can be implemented in a computer program (including program codes) running in a computer device. For example, the soil heavy metal pollution rapid detection system based on the spectrum technology is an application software, which can be used to execute corresponding steps in the soil heavy metal pollution rapid detection method based on the spectrum technology.
[0094] In some embodiments, the soil heavy metal pollution rapid detection system based on the spectrum technology can be implemented in a computer program (including program codes) running in a computer device. For example, the soil heavy metal pollution rapid detection system based on the spectrum technology is an application software, which can be used to execute corresponding steps in the soil heavy metal pollution rapid detection method based on the spectrum technology.
[0095] In some embodiments, the soil heavy metal pollution rapid detection system based on the spectrum technology can be implemented in a computer program (including program codes) running in a computer device. For example, the soil heavy metal pollution rapid detection system based on the spectrum technology is an application software, which can be used to execute corresponding steps in the soil heavy metal pollution rapid detection method based on the spectrum technology.
[0096] The electronic device of the embodiment of the present application comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements any of the above soil heavy metal pollution rapid detection methods based on spectral technology when executing the computer program, that is, the electronic device of the embodiment of the present application can include but is not limited to: a processor and a memory; the memory is used for storing a computer program; and the processor is used for executing the soil heavy metal pollution rapid detection method based on spectral technology shown in any of the embodiments of the present application by calling the computer program.
[0097] In an optional embodiment, an electronic device is provided, as shown in Figure 4 , and as shown in Figure 4 The electronic device 4000 shown in the embodiment of the present application comprises a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, through a bus 4002. Optionally, the electronic device 4000 can further comprise a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception, etc. It should be noted that in actual application, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation to the embodiments of the present application.
[0098] The processor 4001 can be a CPU (Central Processing Unit, central processor), a general-purpose processor, a DSP (Digital Signal Processor, data signal processor), an ASIC (Application Specific Integrated Circuit, application specific integrated circuit), an FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logical blocks, modules and circuits described in combination with the present disclosure. The processor 4001 can also be a combination of computing functions, such as one or more microprocessor combinations, combinations of DSP and microprocessor, etc.
[0099] The bus 4002 can include a path for transmitting information between the above-mentioned components. The bus 4002 can be a PCI (Peripheral Component Interconnect, peripheral component interconnect) bus or an EISA (Extended Industry Standard Architecture, extended industry standard architecture) bus, etc. The bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, Figure 4Only one bus 4002 is shown, but it could also be comprised of several buses. Bus 4002 is used to transmit and receive electrical, acoustic and / or optical signals, which enable the exchange of information between the various elements attached thereto.
[0100] The memory 4003 can be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions; a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions; an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, a magnetic disk storage or other magnetic storage devices or any other medium capable of storing desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
[0101] The memory 4003 is used to store the application program code (computer program) for executing the scheme of the present application, and is controlled by the processor 4001 to execute. The processor 4001 is used to execute the application program code stored in the memory 4003 to realize the content shown in the foregoing method embodiments.
[0102] The electronic device can also be a terminal device, which can be any terminal device that can install an application and access a webpage through the application, including at least one of a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a smart television, and a smart vehicle device.
[0103] It should be noted that, Figure 4 The electronic device shown is only an example and should not limit the functions and use range of the embodiments of the present application.
[0104] The computer readable storage medium of the embodiments of the present application, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to realize any one of the above-mentioned soil heavy metal pollution rapid detection methods based on spectrum technology.
[0105] Alternatively, the computer readable storage medium can be a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), a magnetic tape, a floppy disk and an optical data storage device, etc.
[0106] In an example embodiment, a computer program product or computer program is also provided, which includes computer instructions stored in a computer readable storage medium. A processor of an electronic device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the electronic device to perform the above-mentioned method for rapid detection of soil heavy metal pollution based on spectral technology.
[0107] It should be understood that the flow and block diagrams in the drawings show possible architectures, functional and operation of methods and computer program products according to various embodiments of the present application. In this regard, each block in the flow and block diagrams can represent a module, a segment, or a portion of code that comprises one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or combinations of hardware and software.
[0108] The computer readable storage medium of the embodiments of the present application can be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0109] The above-mentioned computer readable storage medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the method shown in the above-mentioned embodiments.
[0110] The above description is only the preferred embodiment of the present application and the explanation of the applied technical principles. It should be understood by those skilled in the art that the disclosed range of the present application is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the disclosed concept. For example, the technical solutions formed by the mutual replacement of the above features and the technical features with similar functions disclosed in the present application (but not limited to) can be used.
[0111] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application are used to distinguish similar objects, and represent a specific order or sequence. The order of use of similar objects can be interchanged in appropriate cases, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described.
[0112] Those skilled in the art know that the present application can be implemented as a system, a method or a computer program product, so the present application can be specifically implemented as follows: it can be a complete hardware, a complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" in this paper. In addition, in some embodiments, the present application can also be implemented as a computer program product in one or more computer readable media, which contains computer readable program code.
[0113] Although the embodiments of the present application have been shown and described above, it should be understood that the above embodiments are exemplary and cannot be understood as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present application.
Claims
1. A rapid detection method for heavy metal pollution in soil based on spectral technology, characterized in that, The method comprises the following steps: Obtain the dual-band spectral reflectance data and the temperature and humidity parameters of the soil to be tested, and perform spectral feature compensation processing on the dual-band spectral reflectance data based on the temperature and humidity parameters, generate a target spectral curve, and obtain an environmental compensation parameter; Extract spectral feature parameters from the target spectral curve, and reduce the dimensions of the spectral feature parameters and the environmental compensation parameter through principal component analysis to construct a multi-dimensional spectral feature matrix; Input the multi-dimensional spectral feature matrix into a trained soil heavy metal pollution detection model to obtain the heavy metal pollution detection result of the soil to be tested; wherein the trained soil heavy metal pollution detection model is obtained by iteratively training a pre-trained CNN-RF hybrid model.
2. The method for rapid detection of heavy metal pollution in soil based on spectral technology according to claim 1, characterized in that, The step of obtaining the dual-band spectral reflectance data and the temperature and humidity parameters of the soil to be tested comprises: Use a hyperspectral imaging device integrated with a temperature and humidity sensor to scan the soil to be tested in situ, and obtain the dual-band spectral reflectance data and the temperature and humidity parameters of the soil to be tested.
3. The method for rapid detection of heavy metal pollution in soil based on spectral technology according to claim 1, characterized in that, The step of performing spectral feature compensation processing on the dual-band spectral reflectance data based on the temperature and humidity parameters, generating a target spectral curve, and obtaining an environmental compensation parameter comprises: Based on the temperature and humidity parameters, baseline drift correction and noise suppression are performed on the dual-band spectral reflectance data through an adaptive Kalman filtering algorithm to generate the target spectral curve, and the environmental compensation parameter containing the baseline offset correction value and the noise suppression gain coefficient is output from the adaptive Kalman filtering algorithm.
4. The method for rapid detection of heavy metal pollution in soil based on spectral technology according to claim 1, characterized in that, The spectral feature parameters include dual-band spectral reflectance values, absorption feature peak positions, and morphological parameters; the step of extracting spectral feature parameters from the target spectral curve comprises: Extract the dual-band spectral reflectance values and corresponding dual-band spectral wavelengths from the target spectral curve; the dual-band spectral wavelengths are used to determine the heavy metal sensitive waveband range; Perform first derivative transformation on the target spectral curve, and determine the absorption feature peak positions in the heavy metal sensitive waveband range corresponding to the dual-band spectral wavelengths through a local minimum value detection algorithm; the absorption feature peak positions include absorption valley center wavelengths and half-height widths; Calculate the spectral morphological parameters and spatial morphological parameters of the target spectral curve to obtain the morphological parameters.
5. The method for rapid detection of heavy metal pollution in soil based on spectral technology according to claim 4, characterized in that, The spectral morphological parameters are spectral curve symmetry and spectral curvature; the spatial morphological parameters are soil surface texture features; The step of calculating the spectral morphological parameters and spatial morphological parameters of the target spectral curve to obtain the morphological parameters comprises: Calculate the spectral curve symmetry and spectral curvature of the target spectral curve, and extract the soil surface texture features based on the spatial resolution of the target spectral curve; wherein the soil surface texture features include the energy, contrast, entropy value, and fractal dimension of the gray level co-occurrence matrix.
6. The method for rapid detection of heavy metal pollution in soil based on spectral technology according to any one of claims 1 to 5, characterized in that, The trained soil heavy metal pollution detection model comprises an input unit, a convolution unit, a feature fusion unit, and an output unit connected in sequence; The input unit is configured to convert the multi-dimensional spectral feature matrix into a target three-dimensional tensor; the convolution unit is configured to perform convolution processing on the target three-dimensional tensor to obtain a target feature map; the feature fusion unit is configured to perform flattening processing on the target feature map to obtain a one-dimensional feature vector and input the one-dimensional feature vector into a random forest model, perform feature sorting by calculating Gini importance, filter out a sensitive band combination associated with heavy metals, and assign a dynamic weight coefficient to each band in the sensitive band combination based on a feature importance sorting result to obtain a weighted feature vector; and the output unit is configured to input the weighted feature vector into a fully connected regression layer to obtain the heavy metal pollution detection result.
7. The method for rapid detection of heavy metal pollution in soil based on spectral technology according to claim 6, characterized in that, The heavy metal pollution detection result includes a heavy metal concentration prediction value and a heavy metal pollution distribution heat map; and the output unit is specifically configured to: input the weighted feature vector into the fully connected regression layer to perform linear weighting calculation to obtain the heavy metal concentration prediction value, and map the heavy metal concentration prediction value to a two-dimensional space based on spatial coordinate information of the target spectral curve to generate the heavy metal pollution distribution heat map.
8. A rapid detection system for heavy metal pollution in soil based on spectroscopy technology, characterized in that, The method comprises: a collection module configured to acquire double-band spectral reflectance data and temperature and humidity parameters of a soil to be measured, perform spectral feature compensation processing on the double-band spectral reflectance data based on the temperature and humidity parameters, generate a target spectral curve, and acquire an environment compensation parameter; a construction module configured to extract spectral feature parameters from the target spectral curve, and perform principal component analysis dimension reduction on the spectral feature parameters and the environment compensation parameter to construct a multi-dimensional spectral feature matrix; a detection module configured to input the multi-dimensional spectral feature matrix into a trained soil heavy metal pollution detection model to obtain a heavy metal pollution detection result of the soil to be measured; and the trained soil heavy metal pollution detection model is obtained by iteratively training a pre-trained CNN-RF hybrid model.
9. An electronic device, comprising: The electronic device comprises a processor coupled with a memory, and the memory stores at least one computer program, which is loaded and executed by the processor to enable the electronic device to implement the soil heavy metal pollution rapid detection method based on spectral technology according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores at least one computer program, which is loaded and executed by the processor to enable the computer readable storage medium to implement the soil heavy metal pollution rapid detection method based on spectral technology according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for constructing soil heavy metal environmental risk prediction model
CN111220554A
Air-ground integrated mining area environment monitoring method and system based on hyperspectral imaging
CN119147481A