Rapid soil heavy metal pollution detection method based on spectrum technology
Through the rapid detection method of soil heavy metals based on spectral technology, the dual-band spectral reflectivity data and temperature and humidity parameters are used for feature compensation and dimensionality reduction treatment, combined with the CNN-RF hybrid model, the problems of high cost and time-consuming detection of traditional soil heavy metals are solved, and fast and accurate detection of soil heavy metal pollution on-site is achieved.
Patent Information
- Application Number
- CN202510393280.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-03-31
AI Technical Summary
The existing soil heavy metal detection technology is costly, time-consuming and difficult to meet the needs of rapid on-site inspection. The traditional method requires laboratory environment and professional personnel to operate, and the sample preprocessing is complex and easy to introduce errors.
A rapid detection method based on spectral technology is adopted, by obtaining the dual-band spectral reflectivity data and temperature and humidity parameters, spectral feature compensation and dimensionality reduction processing are performed, soil heavy metal pollution detection is carried out in-situ scanning using hyperspectral imaging equipment with integrated temperature and humidity sensors, non-destructive rapid detection is achieved.
Effectively reduce interference from environmental factors, improve detection efficiency and accuracy, be able to timely identify heavy metal pollution in soil, and ensure soil environmental safety.
Smart Images

Figure CN120253719A_ABST
Abstract
Description
Background Art
[0002] Soil, as a key resource for human survival, occupies a crucial position in human production and life. However, with the acceleration of industrialization and the continuous advancement of urbanization, the problem of soil pollution has become increasingly prominent, and heavy metal pollution has become the focus of global attention. Once heavy metal elements 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 lead to a series of health problems such as impaired organ function and nervous system disorders in the human body. Therefore, it has become an urgent task to effectively monitor and control heavy metals in soil.
[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 and require a dedicated laboratory environment and professional technical personnel for operation and maintenance, which greatly increases the detection cost and limits their application in large-scale soil pollution surveys and on-site rapid detections. On the other hand, the sample pretreatment process of these methods is complex and cumbersome. Usually, soil samples need to be pretreated such as digestion, which not only takes a long time but also easily introduces errors, affecting the accuracy and timeliness of detection results, and it is difficult to meet the requirements of on-site real-time monitoring and rapid decision-making.
[0004] Therefore, it is urgent to provide a technical solution to solve the above problems. Summary of the Invention
[0005] To solve the above technical problems, the present invention provides a rapid detection method for soil heavy metal pollution based on spectral technology.
[0006] In the first aspect, the present invention provides a rapid detection method for soil heavy metal pollution based on spectral technology, and the technical solution of this method is as follows:
[0007] Obtain the dual-band spectral reflectance data and temperature and humidity parameters of the soil to be measured, 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] Extract spectral feature parameters from the target spectral curve, and reduce the dimension of the spectral feature parameters and the environmental compensation parameter through principal component analysis to construct a multi-dimensional spectral feature matrix;
[0009] Input the multi-dimensional spectral feature matrix into the 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.
[0010] Further, the steps of obtaining the double-band spectral reflectance data and temperature-humidity parameters of the soil to be tested include:
[0011] Use a hyperspectral imaging device integrated with temperature-humidity sensors to perform in-situ scanning on the soil to be tested, and obtain the double-band spectral reflectance data and the temperature-humidity parameters of the soil to be tested.
[0012] Further, the steps of performing spectral feature compensation processing on the double-band spectral reflectance data based on the temperature-humidity parameters to generate a target spectral curve and obtain environmental compensation parameters include:
[0013] Based on the temperature-humidity parameters, perform baseline drift correction and noise suppression on the double-band original spectral reflectance data through an adaptive Kalman filter algorithm to generate the target spectral curve, and output the environmental compensation parameters including the baseline offset correction value and the noise suppression gain coefficient from the adaptive Kalman filter algorithm.
[0014] Further, the spectral feature parameters include: double-band spectral reflectance values, absorption characteristic peak positions and morphological parameters; the steps of extracting spectral feature parameters from the target spectral curve include:
[0015] Extract the double-band spectral reflectance values and the corresponding double-band spectral wavelengths from the target spectral curve; the double-band spectral wavelengths are used to determine the heavy metal sensitive band range;
[0016] Perform a first derivative transformation on the target spectral curve, and within the heavy metal sensitive band range corresponding to the double-band spectral wavelengths, determine the absorption characteristic peak positions through a local minimum detection algorithm; the absorption characteristic peak positions include: the center wavelength of the absorption valley and the full width at half maximum;
[0017] Obtain the morphological parameters by calculating the spectral morphological parameters and the spatial morphological parameters of the target spectral curve.
[0018] Further, the spectral morphological parameters are: spectral curve symmetry and spectral curvature; the spatial morphological parameters are: soil surface texture characteristics; the steps of obtaining the morphological parameters by calculating the spectral morphological parameters and the spatial morphological parameters of the target spectral curve include:
[0019] 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.
[0020] Further, 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;
[0021] Wherein, the input unit is used to: convert the multi-dimensional spectral feature matrix into a target three-dimensional tensor; the convolution unit is used to: perform convolution processing on the target three-dimensional tensor to obtain a target feature map; the feature fusion unit is used to: perform flattening processing on the target feature map to obtain a one-dimensional feature vector and input it into a random forest model, perform feature ranking by calculating Gini importance, screen out the sensitive band combinations associated with heavy metals, and assign 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 is used 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 includes: the predicted value of heavy metal concentration and the heat map of heavy metal pollution distribution; specifically, the output unit is used to:
[0023] Input the weighted feature vector into the fully connected regression layer for linear weighted calculation to obtain the predicted value of heavy metal concentration, and map the concentration predicted value to a two-dimensional space based on the spatial coordinate information of the target spectral curve to generate the heat map of heavy metal pollution distribution.
[0024] In a second aspect, the present invention provides a rapid detection system for soil heavy metal pollution based on spectral technology, and the technical solution of the system is as follows:
[0025] An acquisition module, configured to obtain the dual-band spectral reflectance data and temperature and humidity parameters of the soil to be measured, 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;
[0026] A construction module, configured to extract spectral feature parameters from the target spectral curve, and perform dimensionality reduction on the spectral feature parameters and the environmental compensation parameters through principal component analysis to construct a multi-dimensional spectral feature matrix;
[0027] 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; wherein, the trained soil heavy metal pollution detection model is obtained by iteratively training a pre-trained CNN-RF hybrid model.
[0028] In a third aspect, a technical solution of an electronic device according to the present invention is as follows:
[0029] It includes a memory, a processor, and a program stored on the memory and running on the processor. When the processor executes the program, it implements the steps of the method for rapid detection of soil heavy metal pollution based on spectral technology according to the present invention.
[0030] In a fourth aspect, a technical solution of a computer-readable storage medium provided by the present invention is as follows:
[0031] Instructions are stored in the computer-readable storage medium. When the computer-readable storage medium reads the instructions, it causes the computer-readable storage medium to execute the steps of the method for rapid detection of soil heavy metal pollution based on spectral technology according to the present invention.
[0032] The present invention realizes in-situ non-destructive and rapid detection of soil heavy metals through dual-band spectroscopy and environmental dynamic compensation technology, effectively reducing the interference of environmental factors on spectral measurement, improving the detection efficiency, and accurately identifying the pollution situation of heavy metals in the soil through the CNN-RF hybrid model, improving the reliability and accuracy of soil heavy metal pollution, and helping to take corresponding treatment measures in time to ensure soil environmental safety.
[0033] Other advantages, objectives, and features of the present invention will be described to some extent in the subsequent specification, and to some extent, will be obvious to those skilled in the art based on the study of the following text, or can be taught from the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0035] Figure 1 It is a schematic flowchart of an embodiment of the method for rapid detection of soil heavy metal pollution based on spectral technology according to the present invention;
[0036] Figure 2 It is a schematic structural diagram of a trained soil heavy metal pollution detection model;
[0037] Figure 3 This is a schematic structural diagram of an embodiment of a rapid detection system for soil heavy metal pollution based on spectral technology according to the present invention;
[0038] Figure 4 This is a schematic structural diagram of an embodiment of an electronic device according to the present invention. Detailed implementation manners
[0039] Next, the technical solutions in the embodiments of the present invention will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0040] Figure 1 It shows a schematic flow chart of an embodiment of a rapid detection method for soil heavy metal pollution based on spectral technology provided by the present invention. As Figure 1 shown, the method includes the following steps:
[0041] S1. Obtain the dual-band spectral reflectance data and temperature and humidity parameters of the soil to be measured, 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.
[0042] Among them, the soil to be measured is the soil for which heavy metal pollution detection is required in this embodiment, and the scenario where the soil is located is not limited here. The dual-band refers to the visible-near infrared band (400-2500 nm) and the short-wave infrared band (1300-2500 nm). The dual-band spectral reflectance data refers to the ratio data of the light intensity reflected by the soil surface to the light intensity reflected by the standard white board within the two wavelength ranges of visible-near infrared and short-wave infrared. The temperature and humidity parameters are the surface temperature (°C) of the soil to be measured and the environmental humidity (%RH).
[0043] In S1, the step of obtaining the dual-band spectral reflectance data and temperature and humidity parameters of the soil to be measured includes: in-situ scanning the soil to be measured by using a hyperspectral imaging device integrated with a temperature and humidity sensor to obtain the dual-band spectral reflectance data and the temperature and humidity parameters of the soil to be measured.
[0044] Among them, the hyperspectral imaging device is a portable hyperspectral imaging device already available on the market, such as Headwall Nano-Hyperspec, Specim IQ, etc. Its characteristics are lightweight and suitable for field operations, and it can collect spectral data in the visible light-near infrared range. The principle of in-situ scanning refers to directly scanning the soil surface without laboratory digestion treatment, breaking through the limitation of traditional hyperspectral devices relying on laboratory sample preparation. The hyperspectral imaging device in this embodiment is integrated with temperature and humidity sensors for synchronously obtaining 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 obtain environmental compensation parameters 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 parameters including the baseline offset correction value and the noise suppression gain coefficient from the adaptive Kalman filtering algorithm.
[0046] Among them, the adaptive Kalman filtering algorithm is a filtering algorithm that dynamically adjusts parameters and is used to correct environmental interference in real time. Baseline drift correction refers to eliminating the overall offset of the spectral baseline caused by temperature changes. The target spectral curve refers to the optimized spectral data curve based on the dual-band spectral reflectance data after environmental interference correction and noise suppression. Its core function is to eliminate data deviations introduced by factors such as temperature and humidity changes and equipment noise in field detection, thereby improving the accuracy and reliability of subsequent analysis. The environmental compensation parameters include dynamic correction factors: the baseline offset correction value (ΔB) and the noise suppression gain coefficient (G). The environmental compensation parameters and the temperature and humidity parameters are jointly used to characterize the quantitative characteristics of environmental interference.
[0047] It should be noted that: ① Since temperature changes will cause an overall offset of the spectral reflectance (for example, when the temperature rises by 10 °C, the baseline moves up by 0.1-0.3 units as a whole), in this embodiment, the baseline drift correction is performed through the adaptive Kalman filtering algorithm, taking the temperature and humidity parameters as inputs, dynamically calculating the baseline offset correction value (ΔB), and compensating the original dual-band spectral reflectance data. The specific formula is: R 校正 =R 原始 +ΔB(T, H); R 原始 is the dual-band spectral reflectance data, R 校正is the spectral data after baseline drift correction, T is the temperature, H is the humidity, and ΔB is iteratively updated through the Kalman filtering algorithm. ② Due to high-frequency fluctuations of the spectral curve caused by equipment electronic noise, environmental light interference, etc., the noise suppression in this embodiment uses the prediction-update mechanism of the Kalman filter and combines the noise suppression gain coefficient (G) to smooth the spectral data. The specific formula is: R 平滑 = G × R 校正 + (1 - G) × R 预测 ; R 平滑 is the target spectral curve, and R 预测 is the reflectance value predicted based on historical data. For example, for the soil detection of an industrial polluted site, the environmental temperature is 40 °C and the humidity is 85%. The high temperature causes the overall reflectance of the dual-band spectral reflectance data to be high (offset ΔB = +0.25), and the high-frequency fluctuations caused by humidity (signal-to-noise ratio SNR = 12 dB); after baseline correction (ΔB = -0.25 compensation) and noise suppression (G = 0.9), the spectral curve is restored to the true reflectance level, and the signal-to-noise ratio is increased to SNR = 28 dB, making the spectral curve clearer.
[0048] S2. Extract spectral feature parameters from the target spectral curve, and reduce the dimensionality of the spectral feature parameters and the environmental compensation parameters through principal component analysis to construct a multi-dimensional spectral feature matrix.
[0049] Among them, 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 features, physical features, and environmental compensation parameters, and the matrix dimension is N × 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 during the in-situ scanning of the soil surface. Each sample corresponds to a pixel or a set of adjacent pixels in the hyperspectral image (such as a 3×3 pixel block), representing an independent spatial detection point. The number of principal components refers to the number of principal components retained after dimensionality reduction through principal component analysis (PCA), and its value is automatically determined by the PCA algorithm according to the variance contribution rate (>95%) and is used to characterize the effective dimensions of the chemical, physical, and environmental compensation features retained 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 to ensure that the spatial coverage density meets the requirements of pollution distribution analysis. The number of principal components M is not fixed. For example, when the original feature dimension is 200, M may be compressed to 10 - 15 to achieve a balance between computational 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 specifically determined according to the type of heavy metal. For example, in this embodiment, the heavy metals to be detected are defaulted to lead, cadmium, and mercury, so the number of spectral feature parameters is three, and the number of multi-dimensional spectral feature matrices is also three. Principal component analysis retains spectral feature information by maximizing variance and is applicable to the compression of high-dimensional spectral data.
[0051] In S2, the step of extracting spectral feature parameters from the target spectral curve includes:
[0052] Extract the dual-band spectral reflectance value and the corresponding dual-band spectral wavelength from the target spectral curve.
[0053] Among them, the dual-band spectral wavelength is used to determine the heavy metal sensitive band range. The dual-bands in the target spectral curve include: ① 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 absorption peaks of heavy metal-organic complexes. Specifically, segment the target spectral curve by band to extract data: the first-band spectral reflectance data set (including 2101 first-band spectral reflectance values) and the second-band spectral reflectance data set (including 1201 second-band spectral reflectance values), and each dual-band spectral reflectance value R λ The unique dual-band spectral wavelength λ.
[0054] Perform a first derivative transformation on the target spectral curve, and within the sensitive band range of the corresponding heavy metal (each heavy metal) of the dual-band spectral wavelength, determine the absorption characteristic peak position through a local minimum detection algorithm.
[0055] Among them, the heavy metal sensitive band range includes: the lead sensitive band (1400 - 1600 nm), the cadmium sensitive band (2200 - 2400 nm), and the mercury sensitive band (2450 - 2500 nm) range. The absorption characteristic peak position includes: the center wavelength of the absorption valley and the full width at half maximum. The role of performing a first derivative transformation on the target spectral curve is to enhance the edge characteristics of the absorption valley in the spectral curve, facilitating the accurate determination of the absorption characteristic peak position. After performing the first derivative transformation, the derivative curve can also be smoothed twice (such as moving average filtering) to reduce high-frequency noise interference.
[0056] Among them, the heavy metals in this embodiment are defaulted to lead, cadmium, and mercury. Align the first derivative curve of the target spectral curve with the dual-band spectral wavelengths, and use the local minimum detection algorithm to locate the center wavelength (λpeak) and full width at half maximum (FWHM) of the absorption valley on the derivative curve. The specific process is as follows: ① Traverse all wavelength points within the sensitive band. If the spectral reflectance value of any wavelength point is less than the spectral reflectance values of the adjacent wavelength points before and after, then take this wavelength point as a candidate minimum point until all candidate minimum points are obtained. ② According to the derivative threshold, only retain the candidate minimum points with spectral reflectance values less than the derivative threshold. ③ Among the retained candidate minimum points, select the wavelength corresponding to the minimum derivative value as the center wavelength (λpeak) of the absorption valley. ④ With the center wavelength of the absorption valley as the center, expand to both sides until the derivative value rises to half of the minimum value (λpeak×1 / 2), and the wavelength difference between the two sides is the full width at half maximum (FWHM).
[0057] It should be noted that each heavy metal corresponds to its own center wavelength of the absorption valley and full width at half maximum.
[0058] By calculating the spectral morphological parameters and spatial morphological parameters of the target spectral curve, the morphological parameters are obtained.
[0059] Among them, the spectral morphological parameters are: spectral curve symmetry and spectral curvature. The spatial morphological parameters are: soil surface texture characteristics. Specifically: calculate the spectral curve symmetry and the spectral curvature of the target spectral curve, and extract the soil surface texture characteristics based on the spatial resolution of the target spectral curve.
[0060] Among them, the spectral curve symmetry S = area of the left half peak / area of the right half peak; the spectral curvature K = extreme value of the second derivative. The soil surface texture characteristics include: energy, contrast, entropy value, and fractal dimension of the gray-level co-occurrence matrix. The fractal dimension is a parameter used to quantify the soil surface roughness (for example, 2.1 indicates relatively smooth, and 2.5 indicates relatively rough). The gray-level co-occurrence matrix (GLCM) analyzes the soil texture. A high energy value indicates uniform texture, and a 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 dimension of the spectral feature parameters and the environmental compensation parameters through principal component analysis to construct a multi-dimensional spectral feature matrix include:
[0063] Dimensionality reduction is performed on the reflectivity value, the center wavelength of the absorption valley, the full width at half maximum, the morphological parameter, and the environmental compensation parameter through principal component analysis (PCA) to construct a multi-dimensional spectral feature matrix containing chemical features, physical features, and environmental compensation parameters, with the matrix dimension being 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 dimension of the multi-dimensional spectral feature matrix corresponding to lead is N×M Pb ), and the dimension of the multi-dimensional spectral feature matrix corresponding to cadmium is N×M Cd ), and the dimension of the multi-dimensional 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 result of the soil to be tested.
[0066] Among them, the trained soil heavy metal pollution detection model is obtained by iteratively training a pre-trained CNN-RF hybrid model. The heavy metal pollution detection result includes: the predicted value of the heavy metal concentration and the heat map of the 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 respectively input into the trained soil heavy metal pollution detection model to obtain the pollution detection result of each heavy metal in the soil to be tested.
[0068] In S3, as Figure 2 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 in sequence. The input unit is used to: convert the multi-dimensional spectral feature matrix into a target three-dimensional tensor; the convolution unit is used to: perform convolution processing on the target three-dimensional tensor to obtain a target feature map; the feature fusion unit is used to: perform flattening processing on the target feature map to obtain a one-dimensional feature vector and input it into a random forest model, perform feature ranking by calculating Gini importance, screen out the sensitive band combinations associated with heavy metals, and assign dynamic weight coefficients to each band in the sensitive band combinations based on the feature importance ranking result to obtain a weighted feature vector; the output unit is used to: input the weighted feature vector into a fully connected regression layer to obtain the heavy metal pollution detection result.
[0069] Among them, taking any one heavy metal as an example: ① The dimension of the multi-dimensional spectral feature matrix is N×M, and the dimension of the target three-dimensional tensor is N×M×1. The 1 in the target three-dimensional tensor represents a single channel. For example, N = 1000 and M = 12, then the size of the target three-dimensional tensor is 1000×12×1. The spectral feature matrix is simulated as a "space-channel" structure to facilitate the convolutional layer to extract local band correlations (such as the non-linear relationship between adjacent principal components). ② The convolutional unit includes two convolutional layers, namely: the first convolutional layer and the second convolutional layer. The input of the first convolutional layer is the target three-dimensional tensor, and a 5×5 convolutional kernel is used for spatial convolution operation, and the output feature map size is N×(M - 4)×32. The input of the second convolutional layer is the output feature map of the first convolutional layer, and a 3×3 convolutional kernel is used to deepen feature extraction, and the output feature map size is N×(M - 6)×64, and the ReLU activation function and the max pooling layer are connected. After pooling, the feature map size is compressed to N×((M - 6) / 2)×64, that is, the target feature map. ③ The dimension of the one-dimensional feature vector is N×D, D = ((M - 6) / 2)×64. The input of the random forest model is the one-dimensional feature vector, and the contribution degree of each feature to the heavy metal concentration prediction (that is, the Gini importance of each feature) is calculated through the random forest model (RF model). In this embodiment, by default, the bands ranked in the top 10% of the contribution degree (Gini importance) are selected as the sensitive band combination, which can also be adjusted according to the actual situation and is not limited here. The formula for assigning the dynamic weight coefficient is: w i is the dynamic weight of the i-th band in the sensitive band combination, f i is the Gini importance of the i-th band in the sensitive band combination, f max is the Gini importance of the maximum value in the sensitive band combination, α is a smoothing constant, defaulting to 0.01, which is used to avoid zero weights. 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] Among them, taking any one heavy metal as an example, the formula for linear weighted calculation is: C is the predicted value of heavy metal concentration, and b is the bias term. By combining the concentration prediction value with the weights of sensitive bands, the pollution degree of high - contribution areas is highlighted. Specifically: ① For each pixel point (x, y), calculate its weighted concentration value C(x, y) represents the predicted value of heavy metal concentration at point (x, y), and w i (x, y) represents the dynamic weight of the i - th band in the sensitive band combination corresponding to point (x, y). ② Normalize C weighted (x, y) to the interval [0, 1] to adapt to color mapping. The specific formula is: ③ According to the magnitude of C weighted (x, y), divide the red - yellow - green color distribution to generate a heat map of heavy metal pollution distribution. ④ By using the Sobel operator to calculate the gradient of the concentration field, draw arrows every N pixels (such as 50 pixels) on the heat map of heavy metal pollution distribution, with the direction consistent with the gradient direction and the length proportional to the gradient amplitude. For example, the gradient arrow points to the lower right, and the length = 0.32. It should be noted that each generated heat map of heavy metal pollution distribution can be smoothed for color transition through Gaussian filtering to reduce noise interference. For example, taking the cadmium pollution detection in a certain industrial area (scanning area 5m×5m, resolution 1cm / pixel) as an example: ① The input data is the predicted value of cadmium concentration (matrix) C Cd : 500×500, range [0.02, 1.5] mg / kg; the cadmium weight matrix W Cd : the weight of the 2350nm sensitive band = 1.0, others = 0.1. ② In the generated heat map of cadmium pollution distribution, in the core pollution area (x = 200, y = 300), C norm,Cd = 0.98 corresponds to dark red, and in the edge area (x = 450, y = 100), C norm,Cd == 0.35 corresponds to light green. ③ The gradient in the core area arrow points to the east - south. ④ The spatial distribution consistency between the heat map of cadmium pollution distribution and the laboratory sampling results reaches 93%, and the pollution boundary positioning error is ±3cm.
[0073] The technical solution of this embodiment realizes the in - situ non - destructive and rapid detection of soil heavy metals through dual - band spectroscopy and environmental dynamic compensation technology, effectively reducing the interference of environmental factors on spectral measurement, improving the detection efficiency, and accurately identifying the pollution situation of heavy metals in soil through the CNN - RF hybrid model, improving the reliability and accuracy of soil heavy metal pollution, which helps to take corresponding treatment measures in time to ensure soil environmental safety.
[0074] Figure 3 The structural schematic diagram of an embodiment of a rapid soil heavy metal pollution detection system 200 provided by the present invention is shown. AsFigure 3 As shown in Figure 3 , the system 200 includes: a collection module 210, a construction module 220, and a detection module 230;
[0075] The collection module 210 is configured to obtain dual-band spectral reflectance data and temperature and humidity parameters of the soil to be measured, 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 environmental compensation parameters;
[0076] The construction module 220 is configured to extract spectral feature parameters from the target spectral curve, and reduce the dimensionality of the spectral feature parameters and the environmental compensation parameters through principal component analysis to 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 the 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.
[0078] In an alternative manner, the collection module 210 is specifically configured to:
[0079] Use a hyperspectral imaging device integrated with temperature and humidity sensors to perform in-situ scanning on the soil to be measured to obtain the dual-band spectral reflectance data and the temperature and humidity parameters of the soil to be measured.
[0080] In an alternative manner, the collection module 210 is specifically configured to:
[0081] Based on the temperature and humidity parameters, perform baseline drift correction and noise suppression on the dual-band original spectral reflectance data through an adaptive Kalman filter algorithm to generate the target spectral curve, and output the environmental compensation parameters including the baseline offset correction value and the noise suppression gain coefficient from the adaptive Kalman filter algorithm.
[0082] In an alternative manner, the spectral feature parameters include: dual-band spectral reflectance values, absorption characteristic peak positions and morphological parameters; the construction module 220 is specifically configured to:
[0083] Extract the dual-band spectral reflectance values and the corresponding dual-band spectral wavelengths from the target spectral curve; the dual-band spectral wavelengths are used to determine the heavy metal sensitive band range;
[0084] Perform a first derivative transformation on the target spectral curve, and determine the absorption characteristic peak positions within the heavy metal sensitive band range corresponding to the dual-band spectral wavelengths through a local minimum detection algorithm; the absorption characteristic peak positions include: the center wavelength of the absorption valley and the full width at half maximum;
[0085] The morphological parameters are obtained by calculating the spectral morphological parameters and the spatial morphological parameters of the target spectral curve.
[0086] In an alternative manner, the spectral morphological parameters are: spectral curve symmetry and spectral curvature; the spatial morphological parameters are: soil surface texture features; the building block 220 is specifically configured to:
[0087] Calculate the spectral curve symmetry and the 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: energy, contrast, entropy value and fractal dimension of the gray-level co-occurrence matrix.
[0088] In an alternative manner, the trained soil heavy metal pollution detection model includes: an input unit, a convolutional unit, a feature fusion unit and an output unit which are connected in sequence;
[0089] Wherein, the input unit is configured to: convert the multi-dimensional spectral feature matrix into a target three-dimensional tensor; the convolutional unit is configured to: perform convolutional 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 it into a random forest model, perform feature ranking by calculating the Gini importance, screen out the sensitive band combinations associated with heavy metals, and assign dynamic weight coefficients to each band in the sensitive band combinations based on the feature importance ranking result to obtain a weighted feature vector; 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 alternative manner, the heavy metal pollution detection result includes: a heavy metal concentration prediction value and a heavy metal pollution distribution heat map; 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 the 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 rapid soil heavy metal pollution detection system 200 based on spectral technology provided in the above embodiments are the same as those of the rapid soil heavy metal pollution detection method based on spectral technology, and will not be elaborated here. In addition, when the system provided in the above embodiments realizes its functions, only the division of the above function modules is used as an example for illustration. In practical applications, the above functions can be allocated to different function modules according to needs, that is, the system can be divided into different function modules according to the actual situation to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be seen in the method embodiments, which will not be elaborated here.
[0093] Among them, the rapid soil heavy metal pollution detection system based on spectral technology of the present invention can be a computer program (including program code) running in a computer device. For example, the rapid soil heavy metal pollution detection system based on spectral technology of the present invention is an application software, which can be used to execute the corresponding steps in the rapid soil heavy metal pollution detection method based on spectral technology of the present invention.
[0094] In some embodiments, the rapid soil heavy metal pollution detection system based on spectral technology of the present invention can be implemented in a combination of software and hardware. As an example, the rapid soil heavy metal pollution detection system based on spectral technology of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the rapid soil heavy metal pollution detection method based on spectral technology of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.
[0095] Among them, the modules involved in the embodiments of the present invention can be implemented by software or by hardware. Among them, the name of the module does not constitute a limitation to the module itself in some cases.
[0096] An electronic device according to an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any one of the above-mentioned rapid detection methods for soil heavy metal pollution based on spectral technology. That is to say, an electronic device according to an embodiment of the present invention may include, but is not limited to: a processor and a memory; the memory is used to store the computer program; the processor is used to execute the rapid detection method for soil heavy metal pollution based on spectral technology shown in any embodiment of the present invention by calling the computer program.
[0097] In an alternative embodiment, an electronic device is provided, as Figure 4 shown Figure 4 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. Among them, the processor 4001 and the memory 4003 are connected, such as connected through a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, and the transceiver 4004 may be used for data interaction between the electronic device and other electronic devices, such as data sending and / or data receiving, etc. It should be noted that in actual applications, 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 invention.
[0098] The processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (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 logic blocks, modules, and circuits described in connection with the disclosure of the present invention. The processor 4001 may also be a combination that implements computing functions, such as a combination including one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0099] The bus 4002 may include a path for transmitting information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4In the figure, the bus 4002 is represented by only a thick line, but it does not mean that there is only one bus or one type of bus.
[0100] The memory 4003 can be a ROM (Read Only Memory), or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory), or other types of dynamic storage devices that can store information and instructions. It can also be an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and 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 implementing the solution of the present invention and is controlled by the processor 4001 for execution. The processor 4001 is used to execute the application program code stored in the memory 4003 to implement the content shown in the foregoing method embodiments.
[0102] Among them, the electronic device can also be a terminal device. The terminal device can be any terminal device that can install an application and access a web page 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 TV, and a smart vehicle-mounted device.
[0103] It should be noted that Figure 4 The electronic device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0104] A computer-readable storage medium according to an embodiment of the present invention has a computer program stored thereon. When the computer program is executed by a processor, it implements any one of the above-mentioned rapid detection methods for soil heavy metal pollution based on spectral technology.
[0105] Optionally, the computer-readable storage medium can be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0106] In an exemplary embodiment, a computer program product or a computer program is further provided. The computer program product or the computer program includes computer instructions that are stored in a computer-readable storage medium. A processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the above-mentioned rapid detection method for soil heavy metal pollution based on spectral technology.
[0107] It should be understood that the flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combinations of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that executes the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0108] The computer-readable storage medium provided by the embodiments of the present invention may be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0109] The above-mentioned computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device is caused to execute the method shown in the above embodiments.
[0110] The above description is only a preferred embodiment of the present invention and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present invention is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present invention.
[0111] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and represent a limitation on a specific order or sequence. In appropriate cases, the order of use of similar objects can be interchanged so that the embodiments of the present application described here can be implemented in an order other than the illustrated or described order.
[0112] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present invention can be specifically implemented in the following forms: it can be completely hardware, can also be completely software (including firmware, resident software, microcode, etc.), or can also be a combination of hardware and software, generally referred to as "circuit", "module" or "system" in this article. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, which contains computer-readable program code.
[0113] Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those of ordinary skill in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A rapid detection method for soil heavy metal pollution based on spectral technology, characterized in that, Including: Obtain the dual-band spectral reflectance data and temperature-humidity parameters of the soil to be measured, and perform spectral feature compensation processing on the dual-band spectral reflectance data based on the temperature-humidity parameters to generate a target spectral curve and obtain environmental compensation parameters; Extract spectral feature parameters from the target spectral curve, and reduce the dimensionality of the spectral feature parameters and the environmental compensation parameters through principal component analysis to construct a multi-dimensional spectral feature matrix; Input the multi-dimensional spectral feature matrix into the trained soil heavy metal pollution detection model to obtain the 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.
2. The rapid detection method for soil heavy metal pollution based on spectral technology according to claim 1, wherein The steps of obtaining the dual-band spectral reflectance data and temperature-humidity parameters of the soil to be measured include: Use a hyperspectral imaging device integrated with a temperature-humidity sensor to perform in-situ scanning on the soil to be measured to obtain the dual-band spectral reflectance data and the temperature-humidity parameters of the soil to be measured.
3. The rapid detection method for soil heavy metal pollution based on spectral technology according to claim 1, characterized in that The steps of performing spectral feature compensation processing on the dual-band spectral reflectance data based on the temperature-humidity parameters to generate a target spectral curve and obtain environmental compensation parameters include: Based on the temperature-humidity parameters, perform baseline drift correction and noise suppression on the dual-band original spectral reflectance data through an adaptive Kalman filter algorithm to generate the target spectral curve, and output the environmental compensation parameters including the baseline offset correction value and the noise suppression gain coefficient from the adaptive Kalman filter algorithm.
4. The rapid detection method for soil heavy metal pollution based on spectral technology according to claim 1, characterized in that, The spectral feature parameters include: dual-band spectral reflectance values, absorption characteristic peak positions and morphological parameters; the steps of extracting spectral feature parameters from the target spectral curve include: Extract the dual-band spectral reflectance values and the corresponding dual-band spectral wavelengths from the target spectral curve; the dual-band spectral wavelengths are used to determine the heavy metal sensitive band range; Perform a first derivative transformation on the target spectral curve, and determine the absorption characteristic peak positions within the heavy metal sensitive band range corresponding to the dual-band spectral wavelengths through a local minimum detection algorithm; the absorption characteristic peak positions include: the center wavelength of the absorption valley and the full width at half maximum; Obtain the morphological parameters by calculating the spectral morphological parameters and the spatial morphological parameters of the target spectral curve.
5. The rapid detection method for soil heavy metal pollution based on spectral technology according to claim 4, wherein The spectral morphological parameters are: spectral curve symmetry and spectral curvature; the spatial morphological parameters are: soil surface texture features; The steps of obtaining the morphological parameters by calculating the spectral morphological parameters and the spatial morphological parameters of the target spectral curve include: Calculate the spectral curve symmetry and the 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 rapid detection method for soil heavy metal pollution based on spectral technology according to any one of claims 1 to 5, characterized in that, 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; Among them, the input unit is used to: convert the multi-dimensional spectral feature matrix into a target three-dimensional tensor; the convolution unit is used to: perform convolution processing on the target three-dimensional tensor to obtain a target feature map; the feature fusion unit is used to: perform flattening processing on the target feature map to obtain a one-dimensional feature vector and input it into a random forest model, perform feature ranking by calculating Gini importance, screen out sensitive band combinations associated with heavy metals, and assign 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 is used to: input the weighted feature vector into a fully connected regression layer to obtain the heavy metal pollution detection result.
7. The rapid detection method for soil heavy metal pollution 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; specifically, the output unit is used to: 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.
8. A rapid detection system for soil heavy metal pollution based on spectral technology, characterized in that, It includes: a collection module, which is used to obtain the dual-band spectral reflectance data and temperature and humidity parameters of the soil to be measured, 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; a construction module, which is used to extract spectral feature parameters from the target spectral curve, and reduce the dimension of the spectral feature parameters and the environmental compensation parameter through principal component analysis to construct a multi-dimensional spectral feature matrix; a detection module, which is used to 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 measured; among them, the trained soil heavy metal pollution detection model is obtained by iteratively training a pre-trained CNN-RF hybrid model.
9. An electronic device, characterized in that, The electronic device includes a processor, the processor is coupled with a memory, and at least one computer program is stored in the memory. The at least one computer program is loaded and executed by the processor so that the electronic device implements the rapid detection method for soil heavy metal pollution based on spectral technology according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, At least one computer program is stored in the computer-readable storage medium. The at least one computer program is loaded and executed by a processor so that the computer-readable storage medium implements the rapid detection method for soil heavy metal pollution 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
Soil heavy metal content inversion method fusing multi-source environment variables and spectral information
CN114814167A
Environment monitoring method and device based on multispectral image processing
CN119086464A
Air-ground integrated mining area environment monitoring method and system based on hyperspectral imaging
CN119147481A
Intelligent sewage detection method and system for municipal construction
CN119643485A
Cited By
Soil detection-oriented sample pretreatment method and system
CN121164006A
Agricultural soil heavy metal detection method and system based on laser-induced breakdown spectroscopy
CN121347491A
Method, equipment and system for rapidly detecting heavy metal pollution of land
CN121762597A