Cultivated land soil environment detection method and system

By calculating the degree of unrecommiability and characteristics of the near -infrared spectrum curve of soil samples, optimize the filtering process, solve the problem of unable to effectively remove interference information and damage key information in existing technologies, and improve the accuracy of the detection of cultivated land soil environment.

CN119375177AActive Publication Date: 2025-01-28黑龙江省农业科学院农业遥感与信息研究所 +1

Patent Information

Application Number
CN202411942742.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-01-28
Estimated Expiration
2044-12-27

AI Technical Summary

Technical Problem

The existing filtering methods cannot effectively remove interference information in the near-infrared spectral curve, and at the same time they will also destroy the key information of heavy metal components, resulting in poor accuracy of soil environmental detection in cultivated land.

Method used

By obtaining the near -infrared spectrum curve of the soil samples in the area of ​​the area to test, calculate the degree of uncomfortableness and characteristics of each wavelength, optimize the filtering process to remove interference information and retain key information.

Benefits of technology

Improve the accuracy of the soil environmental detection of cultivated land, effectively remove the characteristics of soil characteristics, and retain the key information of heavy metal components.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119375177A_ABST
    Figure CN119375177A_ABST
Patent Text Reader

Abstract

The invention relates to the field of soil spectrum analysis, in particular to a farmland soil environment detection method and system. The method comprises the following steps: firstly, analyzing fluctuation characteristics of near infrared spectrum curves of a plurality of soil samples in a preset window of a target wavelength to obtain undisturbed degrees of the near infrared spectrum curves in the target wavelength; fitting spectral data points of the near infrared spectral curve, and obtaining feature retention degrees of the extreme points on the fitted curve according to the difference of fitting absorbance of adjacent extreme points on the fitted curve, the absorbance of each wavelength and the difference of the fitting absorbance and the wavelength distribution of the extreme points on each fitted curve; filtering the spectral data points of the target curve based on the non-interference degree and the feature retention degree to obtain a filtering curve; according to the method, the interference information in the near infrared spectrum curve is removed, the existing key information is reserved as much as possible, and the precision of farmland soil environment detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of soil spectral analysis, and in particular to a method and system for detecting cultivated land soil environment. Background Art

[0002] Excessive heavy metal content in cultivated soil can seriously harm the growth of crops. Therefore, it is necessary to test the content of heavy metal components in cultivated soil to evaluate whether the soil planting environment is safe and avoid the excessive heavy metal content in cultivated soil affecting the growth and quality of crops.

[0003] In the related art, the near-infrared spectral curve of cultivated soil is usually filtered for pre-processing, and the heavy metal components contained in the soil are analyzed based on the filtered near-infrared spectral curve. However, since soil particles will cause interference such as scattering or reflection of near-infrared light, the interference information in the near-infrared spectral curve cannot be effectively removed after processing by the existing filtering method. At the same time, the key information about the heavy metal components in the near-infrared spectral curve will be destroyed, resulting in poor accuracy of cultivated soil environment detection. Summary of the invention

[0004] In order to solve the technical problem that after being processed by the existing filtering method, the interference information in the near-infrared spectrum curve cannot be effectively removed, and the key information about the heavy metal components in the near-infrared spectrum curve is destroyed, resulting in poor accuracy of cultivated land soil environment detection, the purpose of the present invention is to provide a cultivated land soil environment detection method and system, and the technical scheme adopted is as follows: The present invention proposes a method for detecting the soil environment of cultivated land, the method comprising: Acquire a preset number of near-infrared spectrum curves of soil samples in the cultivated land area to be tested, wherein there are a plurality of spectrum data points on the near-infrared spectrum curve, and the spectrum data points are composed of wavelength and absorbance; Taking any wavelength as the target wavelength, taking any near-infrared spectrum curve as the target curve, taking other near-infrared spectrum curves except the target curve as reference curves, and obtaining the undisturbed degree of the target curve at the target wavelength according to the fluctuation of the spectrum data points of each near-infrared spectrum curve in a preset window centered on the target wavelength, and the fluctuation difference of the spectrum data points between the target curve and the reference curve in the preset window; Fitting the spectral data points of each near-infrared spectral curve to obtain a fitting curve, wherein the fitting curve includes a plurality of fitting data points, and the fitting data points are composed of wavelengths and fitting absorbances; on the fitting curve corresponding to the target curve, any extreme point is used as a target fitting extreme point, and two extreme points adjacent to the target fitting extreme point are used as adjacent fitting extreme points; according to the difference in the fitting absorbance between the target fitting extreme point and the adjacent fitting extreme point, the difference between the absorbance of each wavelength between the two adjacent fitting extreme points and the fitting absorbance, and the distribution of the wavelengths of the extreme points related to the target fitting extreme point on the fitting curve corresponding to each reference curve, the characteristic retention degree of the target fitting extreme point is obtained; According to the undisturbed degree of the target curve at the target wavelength and the characteristic retention degree of the target fitting extreme point, the spectral data points on the target curve are filtered to obtain a filtered curve; based on each filtered curve, the heavy metal components contained in the soil sample are detected.

[0005] Further, obtaining the undisturbed degree of the target curve at the target wavelength includes: According to the fluctuation of the spectral data points of the target curve in the preset window and the difference in the fluctuation of the spectral data points in the preset window between the near-infrared spectral curves, the soil interference degree of the target curve at the target wavelength is obtained; Obtaining local absorbance similarity between the target curve and each reference curve at a target wavelength according to the distance between the extreme points in the preset window between the target curve and each reference curve, the deviation of the absorbance of the extreme points in the preset window of each near-infrared spectrum curve relative to the overall level of absorbance of all spectrum data points in the preset window, and the difference in fluctuation of the spectrum data points in the preset window between the target curve and each reference curve; Performing negative correlation mapping on the soil disturbance degree to obtain a first undisturbed factor of the target curve at the target wavelength; analyzing the overall level of the local absorbance similarity between the target curve and all reference curves at the target wavelength to obtain a second undisturbed factor of the target curve at the target wavelength; The first undisturbed factor and the second undisturbed factor are integrated to obtain the undisturbed degree of the target curve at the target wavelength.

[0006] Further, obtaining the soil interference degree of the target curve at the target wavelength includes: Analyzing the discrete degree of absorbance of all spectral data points of the target curve in the preset window to obtain the local fluctuation degree of the target curve at the target wavelength; Analyzing the discrete degree of the local fluctuation degree of all near-infrared spectral curves at the target wavelength to obtain the fluctuation difference degree of the target wavelength; The local fluctuation degree and the fluctuation difference degree are combined to obtain the soil interference degree of the target curve at the target wavelength.

[0007] Further, obtaining the local absorbance similarity between the target curve and each reference curve at the target wavelength includes: Analyze the overall level of absorbance of all spectral data points of each near-infrared spectral curve in the preset window to obtain the overall absorbance of each near-infrared spectral curve in the preset window; obtain the degree of deviation of each extreme point of each near-infrared spectral curve in the preset window according to the difference between the absorbance of each extreme point of each near-infrared spectral curve in the preset window and the overall absorbance; Using any reference curve as the reference curve to be measured; matching the extreme value points between the target curve and the reference curve to be measured on the preset window based on the DTW algorithm, and using any two extreme value points that match each other as a matching point group; Normalizing the sum of the deviations of the two extreme value points in each matching point group to obtain a first adjustment weight for each matching point group; Based on the first adjustment weight, weighted summation is performed on the distances between two extreme value points in all matching point groups to obtain the local absorbance difference between the target curve and the reference curve to be measured at the target wavelength; Normalizing the difference in the local fluctuation degree between the target curve and the reference curve to be measured at the target wavelength to obtain a second adjustment weight; Based on the second adjustment weight, the local absorbance difference between the target curve and the reference curve to be measured at the target wavelength is weighted and negatively correlated to obtain the local absorbance similarity between the target curve and the reference curve to be measured at the target wavelength.

[0008] Furthermore, the feature retention degree of obtaining the target fitting extreme point includes: Obtaining a first characteristic factor of the target fitting extreme value point according to the difference in the fitting absorbance between the target fitting extreme value point and the adjacent fitting extreme value point, and the difference in the absorbance of each wavelength between two adjacent fitting extreme value points and the fitting absorbance; The fitting curve corresponding to any reference curve is used as the fitting curve to be tested, and according to the difference in wavelength between each extreme point on the fitting curve to be tested and the target fitting extreme point, an extreme point is selected from all the extreme points on the fitting curve to be tested as the relevant fitting extreme point of the fitting curve to be tested; Obtaining a second characteristic factor of a target fitting extreme point according to the distribution of wavelengths of the relevant fitting extreme points of the fitting curves corresponding to all reference curves and the distribution of the first characteristic factors of the relevant fitting extreme points; The first characteristic factor and the second characteristic factor of the target fitting extreme value point are integrated and normalized to obtain the characteristic retention degree of the target fitting extreme value point.

[0009] Furthermore, the first characteristic factor of obtaining the target fitting extreme point includes: According to the difference in the fitting absorbance between the target fitting extreme value point and each of the adjacent fitting extreme value points, an initial absorbance difference value between the target fitting extreme value point and each of the adjacent fitting extreme value points is obtained; and the average value of the initial absorbance difference value between the target fitting extreme value point and two adjacent fitting extreme value points is normalized as the overall absorbance difference value of the target fitting extreme value point; Performing negative correlation mapping on the difference between the absorbance of each wavelength between two adjacent fitting extreme value points and the fitted absorbance to obtain the initial fitting similarity of each wavelength between the two adjacent fitting extreme value points; synthesizing and normalizing the initial fitting similarities of all wavelengths between the two adjacent fitting extreme value points to obtain the comprehensive fitting similarity of the target fitting extreme value point; The preset first weight and the preset second weight are used to perform weighted summation on the overall absorbance difference value and the comprehensive fitting similarity of the target fitting extreme point, respectively, to obtain a first characteristic factor of the target fitting extreme point.

[0010] Furthermore, the step of selecting an extreme point from all extreme points on the fitted curve to be measured as a relevant fitting extreme point of the fitted curve to be measured includes: Obtaining the wavelength distance of each extreme point on the fitting curve to be measured according to the difference in wavelength between each extreme point on the fitting curve to be measured and the target fitting extreme point; On the fitting curve to be measured, the extreme point corresponding to the minimum value of the wavelength distance is used as the relevant fitting extreme point of the fitting curve to be measured.

[0011] Furthermore, the second characteristic factor of obtaining the target fitting extreme point includes: Analyzing the degree of dispersion of the wavelengths of the relevant fitting extreme value points of the fitting curves corresponding to all reference curves to obtain wavelength dispersion; Analyzing the degree of dispersion of the first characteristic factor of the relevant fitting extreme value points of the fitting curves corresponding to all reference curves to obtain the dispersion degree of the first characteristic factor; A negative correlation normalization process is performed on the average values ​​of the wavelength dispersion and the first characteristic factor dispersion to obtain a second characteristic factor of a target fitting extreme point.

[0012] Furthermore, filtering the spectral data points on the target curve to obtain the filtered curve includes: If the fitting data point corresponding to the target wavelength of the fitting curve corresponding to the target curve is not an extreme point, normalizing the undisturbed degree of the target curve at the target wavelength to obtain the filtering weight of the spectral data point corresponding to the target curve at the target wavelength; If the fitting data point corresponding to the target wavelength of the fitting curve corresponding to the target curve is an extreme point, the product value of the undisturbed degree of the target curve at the target wavelength and the feature retention degree of the fitting data point corresponding to the target wavelength of the fitting curve corresponding to the target curve is used as the weight adjustment amount of the spectral data point corresponding to the target curve at the target wavelength, and the sum of the undisturbed degree of the target curve at the target wavelength and the weight adjustment amount is normalized to obtain the filtering weight of the spectral data point corresponding to the target curve at the target wavelength; Based on the filtering weights of the spectral data points corresponding to each wavelength of the target curve, the fitting weights in the SG filtering algorithm are adjusted, and the spectral data points on the target curve are filtered based on the SG filtering algorithm to obtain the filtering curve corresponding to the target curve.

[0013] The present invention also proposes a cultivated land soil environment detection system, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any one of the steps of a cultivated land soil environment detection method.

[0014] The present invention has the following beneficial effects: The present invention takes into account that the existing filtering methods cannot effectively remove the interference information in the near-infrared spectrum curve, and will also destroy the key information about the heavy metal components in the near-infrared spectrum curve, resulting in poor accuracy in the detection of cultivated land soil environment. Therefore, the near-infrared spectrum curves of a preset number of soil samples in the cultivated land area to be tested are first obtained. Considering that the interference is caused by soil characteristics, that is, when soil particles scatter or reflect near-infrared light, it appears as a local fluctuation phenomenon on the near-infrared spectrum curve, and the particle sizes of different soil samples are different, resulting in large differences in the local fluctuation degrees of each near-infrared spectrum curve after being interfered by soil characteristics. Therefore, the degree of undisturbedness is used to reflect the degree to which the target curve is not interfered by soil characteristics in the preset window of the target wavelength. The filtering process can be optimized based on the degree of undisturbedness to effectively remove Interference information in the near-infrared absorption spectrum curve. Considering that the key information expressing heavy metal components in the near-infrared spectrum curve is usually a relatively obvious extreme point, it is necessary to retain the extreme point characteristics on the near-infrared spectrum curve as much as possible during the filtering process. At the same time, considering that the wavelength positions corresponding to the extreme points of specific heavy metal components on each near-infrared spectrum curve are relatively close, the present invention first fits the spectral data points of each near-infrared spectrum curve, preliminarily smoothes out the fluctuation phenomenon caused by interference, and reflects the degree of retention of key information on the near-infrared spectrum curve during the filtering process through the degree of feature retention, and then filters the spectral data points on the target curve, while removing the interference information in the near-infrared spectrum curve, retaining its key information as much as possible, improving the filtering effect, and then improving the accuracy of subsequent cultivated land soil environment detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0016] Figure 1 A flow chart of a method for detecting cultivated land soil environment provided by an embodiment of the present invention; Figure 2 A schematic diagram of near infrared spectrum curves of various soil samples provided by an embodiment of the present invention; Figure 3 A flow chart of a method for obtaining the undisturbed degree of a target curve at a target wavelength provided by an embodiment of the present invention; Figure 4 A flow chart of a method for obtaining the degree of feature retention of a target fitting extreme point provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0017] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a method and system for detecting the soil environment of cultivated land proposed by the present invention, its specific implementation method, structure, characteristics and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0018] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0019] The specific scheme of a method and system for detecting cultivated land soil environment provided by the present invention is described in detail below with reference to the accompanying drawings.

[0020] See also Figure 1 , which shows a flow chart of a method for detecting cultivated land soil environment provided by an embodiment of the present invention, the method comprising: Step S1: obtaining near-infrared spectrum curves of a preset number of soil samples in the cultivated land area to be tested, wherein there are a plurality of spectrum data points on the near-infrared spectrum curve, and the spectrum data points are composed of wavelength and absorbance.

[0021] Excessive heavy metal content in cultivated soil can seriously harm the growth of crops. Therefore, it is necessary to detect the content of heavy metal components in cultivated soil to evaluate whether the planting environment of the soil is safe and to avoid the excessive content of heavy metal components in cultivated soil affecting the growth of crops and the quality of crops. In the related art, the near-infrared spectrum curve of cultivated soil is usually filtered and pre-processed, and the heavy metal components contained in the soil are analyzed based on the filtered near-infrared spectrum curve. However, since soil particles will cause interference such as scattering or reflection of near-infrared light, the interference information in the near-infrared spectrum curve cannot be effectively removed after processing by the existing filtering method. At the same time, the key information about the heavy metal components in the near-infrared spectrum curve will be destroyed, resulting in poor accuracy of cultivated soil environment detection. Therefore, an embodiment of the present invention proposes a cultivated soil environment detection method to solve this problem.

[0022] The embodiment of the present invention first uniformly samples the soil in the cultivated land area to be tested to obtain a preset number of soil samples. The value range of the preset number is generally an integer of 50 to 100. In one embodiment of the present invention, the preset number is set to 50. The specific value of the preset number can also be set by the implementer according to the specific implementation scenario, which is not limited here.

[0023] Then, a near-infrared spectrometer is used to collect the spectral data of each soil sample, thereby obtaining a near-infrared spectrum curve of each soil sample. There are multiple spectral data points on each near-infrared spectrum curve. A specific spectral data point in the near-infrared spectrum curve is a two-dimensional data point composed of a specific wavelength and absorbance, and the wavelength range of the near-infrared spectrum curve is set to 900nm to 2600nm. Please refer to Figure 2 , which shows a schematic diagram of the near-infrared spectral curves of each soil sample provided by an embodiment of the present invention, wherein, since the multiple soil samples belong to the same cultivated land area to be tested, the types of heavy metal components contained in each soil sample are basically the same, so the overall trends of the near-infrared spectral curves of each soil sample are relatively similar, and the contents of heavy metal components in different soil samples vary greatly, so the absorbance of the near-infrared spectral curves of different soil samples at the same wavelength is inconsistent.

[0024] So far, the near-infrared spectral curves of multiple soil samples have been obtained.

[0025] Step S2: taking any wavelength as the target wavelength, taking any near-infrared spectral curve as the target curve, taking other near-infrared spectral curves except the target curve as reference curves, and obtaining the undisturbed degree of the target curve at the target wavelength according to the fluctuation of spectral data points of each near-infrared spectral curve in a preset window centered on the target wavelength, and the fluctuation difference of spectral data points between the target curve and the reference curve in the preset window.

[0026] Taking into account the particularity of soil samples, the soil particles therein can scatter or reflect near-infrared light, thereby interfering with the collected spectral data. The existing type of filtering algorithms, such as the SG filtering algorithm, usually implements filtering smoothing by polynomial fitting in a window. It can only effectively remove the conventional noise interference in the spectral data, but cannot effectively remove the interference caused by the characteristics of the soil itself. Therefore, in the subsequent steps, it is necessary to adjust the fitting strength of the filtering fitting to effectively remove the interference information in the near-infrared spectral curve while retaining the key information as much as possible.

[0027] In the subsequent steps, the embodiment of the present invention will use the SG filtering algorithm to filter the spectral data points on the near-infrared spectrum curve. The SG filtering is essentially to construct a window with each wavelength as the center, slide the window, and fit based on the overall characteristics of multiple absorbances in the window, so as to adjust the absorbance at the center of the window based on the fitting result. Therefore, the fitting effect of the SG filtering is largely determined by whether the multiple absorbances in the local area of ​​each wavelength position are disturbed. When soil particles scatter or reflect near-infrared light and interfere with the noise of the near-infrared spectrum curve, that is, when soil characteristics interfere with the near-infrared spectrum curve, it will appear as a local fluctuation phenomenon on the near-infrared spectrum curve, and the particle size of different soil samples is different, resulting in the influence of soil The difference in the local fluctuation degree of each near-infrared spectral curve after characteristic interference is relatively large. Therefore, the embodiment of the present invention first takes any wavelength as the target wavelength, any near-infrared spectral curve as the target curve, and other near-infrared spectral curves except the target curve as reference curves, and analyzes the fluctuation of the spectral data points of each near-infrared spectral curve in a preset window centered on the target wavelength, as well as the fluctuation difference of the spectral data points between the target curve and the reference curve in the preset window. The obtained undisturbed degree reflects the degree to which the absorbance of the target curve in the preset window of the target wavelength is not disturbed by the soil characteristics. The filtering process can be optimized based on the undisturbed degree subsequently, so as to effectively remove the interference information in the near-infrared absorption spectral curve and improve the accuracy of soil environment detection.

[0028] In one embodiment of the present invention, the length of the preset window is set to 21, that is, the preset window includes the target wavelength and 20 other wavelengths closest to the target wavelength. For the existing boundary problem, the boundary can be filled in step S1 by collecting the absorbance of other wavelengths outside the wavelength range of 900nm to 2600nm analyzed by the embodiment of the present invention, thereby ensuring that for each wavelength within the wavelength range analyzed by the embodiment of the present invention, a preset window can be constructed with it as the center.

[0029] Preferably, in one embodiment of the present invention, the method for obtaining the undisturbed degree of the target curve at the target wavelength specifically includes: See also Figure 3 , which shows a flow chart of a method for obtaining the undisturbed degree of a target curve at a target wavelength provided by an embodiment of the present invention.

[0030] Step S201: obtaining the soil disturbance degree of the target curve at the target wavelength according to the fluctuation of the spectral data points of the target curve in the preset window and the difference in the fluctuation of the spectral data points between the near-infrared spectral curves in the preset window.

[0031] When the characteristic of soil particles to reflect or refract near-infrared light causes strong interference to the near-infrared spectral curve, local fluctuations will occur in the near-infrared spectral curve. The greater the degree of interference of the soil characteristics, the more obvious the fluctuation phenomenon. At the same time, due to the different particle sizes of different soil samples, the local fluctuations of each near-infrared spectral curve after the interference of soil characteristics are quite different. Therefore, the fluctuations of the spectral data points of the target curve in the preset window and the differences in the fluctuations of the spectral data points in the preset window between each near-infrared spectral curve can be analyzed. The obtained soil interference degree can preliminarily reflect the interference degree of soil characteristics on the spectral data points of the target curve in the local range of the target wavelength, providing a data basis for the subsequent accurate calculation of the undisturbed degree of the target curve at the target wavelength.

[0032] Preferably, in one embodiment of the present invention, the method for obtaining the soil disturbance degree of the target curve at the target wavelength specifically includes: The discrete degree of absorbance of all spectral data points of the target curve in the preset window is analyzed to obtain the local fluctuation degree of the target curve at the target wavelength. The local fluctuation degree reflects the fluctuation of the spectral data points of the target curve in the preset window. The larger the local fluctuation degree, the more obvious the fluctuation of the spectral data points of the target curve in the preset window of the target wavelength.

[0033] In an embodiment of the present invention, the standard deviation or variance of the absorbance of all spectral data points of the target curve in the preset window can be used as the local fluctuation degree of the target curve at the target wavelength to analyze the discrete degree of the absorbance of all spectral data points of the target curve in the preset window, which is not limited here.

[0034] The same method as above can be used to obtain the local fluctuation degree of each near-infrared spectral curve at the target wavelength, and then the discrete degree of the local fluctuation degree of all near-infrared spectral curves at the target wavelength is analyzed to obtain the fluctuation difference degree of the target wavelength. The greater the fluctuation difference degree, the greater the difference in the fluctuation degree of the spectral data points of each near-infrared spectral curve in the preset window of the target wavelength.

[0035] In an embodiment of the present invention, the standard deviation or variance of the local fluctuation degree of all near-infrared spectral curves at the target wavelength can be used as the fluctuation difference degree of the target wavelength to analyze the discrete degree of the local fluctuation degree of all near-infrared spectral curves at the target wavelength, which is not limited here.

[0036] As can be seen from the above analysis, the greater the interference degree of soil characteristics, the more obvious the fluctuation phenomenon. At the same time, due to the different particle sizes of different soil samples, the local fluctuations of each near-infrared spectral curve after being disturbed by soil characteristics are quite different. Therefore, the local fluctuation degree and the fluctuation difference degree can be combined to obtain the soil interference degree of the target curve at the target wavelength.

[0037] In the embodiment of the present invention, the product value or the sum value of the local fluctuation degree and the fluctuation difference degree can be used as the soil disturbance degree of the target curve at the target wavelength to achieve the integration of the two.

[0038] The expression of the soil interference degree of the target curve at the target wavelength can be specifically, for example, as follows: in, Indicates the degree of soil interference of the target curve at the target wavelength; Indicates the local fluctuation degree of the target curve at the target wavelength; Indicates the degree of fluctuation difference of the target wavelength.

[0039] Step S202: Based on the distance between the extreme points of the target curve and each reference curve in the preset window, the deviation of the absorbance of the extreme points of each near-infrared spectral curve in the preset window relative to the overall level of the absorbance of all spectral data points in the preset window, and the difference in fluctuation of the spectral data points in the preset window between the target curve and each reference curve, the local absorbance similarity at the target wavelength is obtained between the target curve and each reference curve.

[0040] Since the fluctuation phenomenon on the near-infrared spectrum curve is not entirely caused by the interference of soil characteristics, the heavy metal components contained in the soil samples can also cause fluctuations in the near-infrared spectrum curve, and the greater the content of the heavy metal components, the more obvious the fluctuation phenomenon, and it will also cause a more obvious absorption peak, i.e., extreme point, to appear in the near-infrared spectrum curve. Therefore, it is not accurate to reflect the interference degree of soil characteristics on the spectral data points of the target curve in the preset window based on the soil interference degree obtained above, and further analysis is needed; considering that the soil samples come from the same cultivated land area to be tested, the heavy metal components contained therein are basically the same, so the positions of the wavelengths corresponding to the extreme points appearing in the preset window of each near-infrared spectrum curve are relatively close. At the same time, considering that the heavy metal components present in the soil samples will cause a more obvious absorption peak, i.e., extreme point, to appear in the preset window of the near-infrared spectrum curve, and the fluctuations of each near-infrared spectrum curve in the preset window are relatively close, therefore, the first First, extreme points, including maximum points and minimum points, are extracted from each near-infrared spectral curve respectively, wherein the extreme points can be extracted using existing methods such as Newton's method, and the distance between the extreme points of the target curve and each reference curve in the preset window is analyzed. At the same time, the deviation of the absorbance of the extreme points of each near-infrared spectral curve in the preset window relative to the overall level of the absorbance of all spectral data points in the preset window, and the difference in the fluctuation of the spectral data points in the preset window between the target curve and each reference curve are combined. The local absorbance similarity obtained reflects the similarity of the absorbance characteristics of the heavy metal components between the target curve and each reference curve in the preset window of the target wavelength. The greater the local absorbance similarity between the target curve and each reference curve at the target wavelength, the more likely it is that the fluctuation characteristics of the target curve in the preset window are caused by the heavy metal components rather than the soil characteristics, thereby providing a data basis for the subsequent accurate calculation of the undisturbed degree of the target curve at the target wavelength.

[0041] Preferably, in one embodiment of the present invention, a method for obtaining the local absorbance similarity between the target curve and each reference curve at the target wavelength specifically includes: The overall level of absorbance of all spectral data points of each near-infrared spectral curve in the preset window is analyzed to obtain the overall absorbance of each near-infrared spectral curve in the preset window; according to the difference between the absorbance of each extreme point of each near-infrared spectral curve in the preset window and the overall absorbance, the degree of deviation of each extreme point of each near-infrared spectral curve in the preset window is obtained. The greater the degree of deviation, the more obvious the extreme point is, and further the extreme point is more likely to be caused by heavy metal components in the soil sample.

[0042] In an embodiment of the present invention, the average value or median of the absorbance of all spectral data points of each near-infrared spectral curve in the preset window can be used as the overall absorbance of each near-infrared spectral curve in the preset window, so as to realize the analysis of the overall level of absorbance of all spectral data points of each near-infrared spectral curve in the preset window, which is not limited here.

[0043] In one embodiment of the present invention, the absolute value of the difference between the absorbance of each extreme point of each near-infrared spectral curve in the preset window and the overall absorbance can be used as the degree of deviation of each extreme point of each near-infrared spectral curve in the preset window to analyze the difference between the two.

[0044] Any reference curve is used as the reference curve to be measured; based on the DTW algorithm, each extreme point between the target curve and the reference curve to be measured on the preset window is matched, and any two extreme points that match each other are used as a matching point group. The DTW algorithm is a technical means well known to those skilled in the art and will not be described in detail here.

[0045] The sum of the deviation degrees of the two extreme points in each matching point group is normalized to obtain the first adjustment weight of each matching point group. The larger the first adjustment weight, the greater the possibility that the two extreme points in the matching point group are caused by heavy metal components. In the subsequent calculation process, the first adjustment weight can be used as confidence to provide calculation accuracy.

[0046] In one embodiment of the present invention, the normalization processing can be specifically, for example, maximum and minimum value normalization processing, and the normalization in subsequent steps can all adopt maximum and minimum value normalization processing. In other embodiments of the present invention, other normalization methods can be selected according to the specific range of numerical values, which will not be described in detail.

[0047] Based on the first adjustment weight, the distances between the two extreme points in all matching point groups are weighted and summed to obtain the local absorbance difference between the target curve and the reference curve to be measured at the target wavelength. The larger the local absorbance difference, the greater the difference in the absorbance characteristics between the target curve and the reference curve to be measured in the preset window of the target wavelength.

[0048] In the embodiment of the present invention, the existing Euclidean distance or Manhattan distance may be used to measure the distance between two extreme value points in the matching point group, which is not limited here.

[0049] The difference in the local fluctuation degree between the target curve and the reference curve to be measured at the target wavelength is normalized to obtain a second adjustment weight. The larger the second adjustment weight, the greater the difference in the fluctuation between the target curve and the reference curve to be measured in the preset window, which further indicates that the absorption characteristics in the preset window of the target wavelength are less likely to be caused by heavy metal components.

[0050] In one embodiment of the present invention, the difference between the target curve and the reference curve to be measured can be analyzed by calculating the absolute value of the difference between the local fluctuation degree at the target wavelength between the target curve and the reference curve to be measured.

[0051] Based on the second adjustment weight, the local absorbance difference between the target curve and the reference curve to be measured at the target wavelength is weighted and negatively correlated to obtain the local absorbance similarity between the target curve and the reference curve to be measured at the target wavelength.

[0052] In the embodiment of the present invention, negative correlation mapping may be implemented using a negative correlation function such as an inverse proportional function, which is not limited here, and negative correlation mapping may be implemented in the same manner in subsequent steps.

[0053] The expression for the local absorbance similarity between the target curve and the reference curve to be measured at the target wavelength can be specifically, for example, as follows: in, Indicates the local absorbance similarity between the target curve and the reference curve to be measured at the target wavelength; and Respectively represent The degree of deviation between two extreme points in a matching point group; Indicates The first adjustment weight of the matching point group; Indicates The distance between two extreme points in a matching point group; Indicates the number of matching point groups; Indicates the local fluctuation degree of the target curve at the target wavelength; Indicates the local fluctuation degree of the reference curve to be measured at the target wavelength; represents the second adjustment weight; represents the normalization function; Indicates the preset first adjustment parameter to prevent the denominator from being 0. The value range is In one embodiment of the present invention, Set to 0.01, The specific value of can also be set by the implementer according to the specific implementation scenario and is not limited here.

[0054] The local absorbance similarity between the target curve and each reference curve at the target wavelength can be obtained by the same method as above.

[0055] Step S203: negatively correlate the soil disturbance degree to obtain a first undisturbed factor of the target curve at the target wavelength; analyze the overall level of local absorbance similarity between the target curve and all reference curves at the target wavelength to obtain a second undisturbed factor of the target curve at the target wavelength.

[0056] From the above analysis, it can be seen that the greater the degree of soil interference of the target curve at the target wavelength, the greater the degree of interference by soil characteristics. Therefore, the soil interference degree can be negatively correlated to obtain the first undisturbed factor of the target curve at the target wavelength. The larger the first undisturbed factor, the greater the possibility that the target curve is not disturbed by soil characteristics in the preset window of the target wavelength. At the same time, the greater the local absorbance similarity between the target curve and each reference curve at the target wavelength, the more likely the fluctuation characteristics of the target curve in the preset window are caused by heavy metal components rather than soil characteristic interference. Therefore, the overall level of local absorbance similarity between the target curve and all reference curves at the target wavelength can be analyzed to obtain the second undisturbed factor of the target curve at the target wavelength. The larger the second undisturbed factor, the greater the possibility that the target curve is not disturbed by soil characteristics in the preset window of the target wavelength.

[0057] In an embodiment of the present invention, the average value or median of the local absorbance similarity between the target curve and all reference curves at the target wavelength can be used as the second undisturbed factor of the target curve at the target wavelength to analyze the overall level of the local absorbance similarity between the target curve and all reference curves at the target wavelength, which is not limited here.

[0058] Step S204: synthesize the first undisturbed factor and the second undisturbed factor to obtain the undisturbed degree of the target curve at the target wavelength.

[0059] Furthermore, the first undisturbed factor and the second undisturbed factor of the target curve at the target wavelength may be integrated to obtain the undisturbed degree of the target curve at the target wavelength.

[0060] In the embodiment of the present invention, the product value or the sum value of the first undisturbed factor and the second undisturbed factor may be used as the undisturbed degree of the target curve at the target wavelength to achieve a combination of the two, which is not limited here.

[0061] The expression of the undisturbed degree of the target curve at the target wavelength may be specifically, for example, as follows: in, Indicates the degree to which the target curve is undisturbed at the target wavelength; Indicates the degree of soil interference of the target curve at the target wavelength; represents the first undisturbed factor of the target curve at the target wavelength; Indicates the target curve and the The local absorbance similarity between the reference curves at the target wavelength; represents the second undisturbed factor of the target curve at the target wavelength; Indicates the preset second adjustment parameter to prevent the denominator from being 0. The value range is In one embodiment of the present invention, Set to 0.01, The specific value of can also be set by the implementer according to the specific implementation scenario and is not limited here; Indicates the number of all reference curves.

[0062] Step S3: Fit the spectral data points of each near-infrared spectral curve to obtain a fitting curve, wherein the fitting curve includes multiple fitting data points, and the fitting data points are composed of wavelengths and fitting absorbances; on the fitting curve corresponding to the target curve, any extreme point is used as the target fitting extreme point, and the two extreme points adjacent to the target fitting extreme point are used as adjacent fitting extreme points; according to the difference in fitting absorbance between the target fitting extreme point and the adjacent fitting extreme points, the difference in absorbance and fitting absorbance at each wavelength between the two adjacent fitting extreme points, and the distribution of wavelengths of extreme points related to the target fitting extreme point on the fitting curve corresponding to each reference curve, the characteristic retention degree of the target fitting extreme point is obtained.

[0063] When there are specific heavy metal components in the soil sample, its near-infrared spectrum curve usually has relatively obvious and prominent extreme points at specific wavelength positions. The extreme points on the near-infrared spectrum curve are key information for analyzing heavy metal components. Therefore, in the filtering process, it is necessary to retain the relatively obvious extreme point characteristics on the near-infrared spectrum curve as much as possible. Therefore, in the embodiment of the present invention, the spectrum data points of each near-infrared spectrum curve are first fitted to obtain a fitting curve, wherein after the fitting process, each spectrum data point on the near-infrared spectrum curve corresponds to a fitting data point, and the fitting data point is a two-dimensional data point composed of a wavelength and a fitting absorbance, that is, the data of the first dimension, that is, the wavelength, between each spectrum data point and the corresponding fitting data point is the same, while the data of the second dimension is different. The purpose of fitting the near-infrared spectrum curve is to preliminarily smooth out the relatively inconspicuous extreme points on the near-infrared spectrum curve caused by the interference of soil characteristics, so that the extreme points on the fitting curve are basically formed by the heavy metal components rather than the interference of soil characteristics, so that the feature retention degree of the extreme points on the fitting curve can be accurately analyzed later, so that when the near-infrared spectrum curve is subsequently filtered, the key information therein is retained as much as possible.

[0064] Preferably, in one embodiment of the present invention, the existing least squares method can be used to fit the spectral data points of each near-infrared spectral curve to obtain the corresponding fitting curve. In other embodiments of the present invention, the existing spline fitting algorithm can also be used to implement the fitting process, which is not limited here.

[0065] After obtaining the fitting curve of each near-infrared spectral curve, the existing Newton method is used to extract the extreme points of each fitting curve again, including the maximum point and the minimum point. Then, the embodiment of the present invention analyzes the fitting curve corresponding to the target curve. On the fitting curve corresponding to the target curve, any extreme point is used as the target fitting extreme point, and the two extreme points adjacent to the target fitting extreme point are used as adjacent fitting extreme points. Then, the difference in fitting absorbance between the target fitting extreme point and the adjacent fitting extreme point, the difference in absorbance and fitting absorbance of each wavelength between the two adjacent fitting extreme points, and the distribution of wavelengths of extreme points related to the target fitting extreme point on the fitting curve corresponding to each reference curve are analyzed. The degree of feature retention obtained reflects the degree of retention of the target fitting extreme point in the filtering process, so that the key information on the target curve can be retained based on the degree of feature retention in the subsequent filtering process, thereby improving the accuracy of soil environment detection.

[0066] Preferably, in one embodiment of the present invention, the method for obtaining the feature retention degree of the target fitting extreme point specifically includes: See also Figure 4 , which shows a flow chart of a method for obtaining the undisturbed degree of a target curve at a target wavelength provided by an embodiment of the present invention.

[0067] Step S301: obtaining a first characteristic factor of a target fitting extreme value point according to the difference in fitting absorbance between a target fitting extreme value point and an adjacent fitting extreme value point, and the difference in absorbance at each wavelength between two adjacent fitting extreme value points and the fitting absorbance.

[0068] The greater the difference in the fitted absorbance between the target fitting extreme point and the adjacent fitting extreme point, the more prominent the target fitting extreme point is, which further indicates that the target fitting extreme point is more likely to be caused by heavy metal components in the soil sample, and the target fitting extreme point and the adjacent fitting extreme point are of different types, that is, if the target fitting extreme point is a maximum point, then the adjacent fitting extreme point must be a minimum point, if the target fitting extreme point is a minimum point, then the adjacent fitting extreme point must be a maximum point. Therefore, when the target fitting extreme point is caused by heavy metal components, the change in the fitted absorbance of each fitting data point between the target fitting extreme point and each adjacent fitting extreme point If the trend is the same, the difference between the absorbance of each wavelength and the fitted absorbance between the target fitting extreme point and the adjacent fitting extreme point is small. Therefore, the first characteristic factor of the target fitting extreme point can be obtained according to the difference between the fitted absorbance of the target fitting extreme point and the adjacent fitting extreme point, and the difference between the absorbance of each wavelength and the fitted absorbance between two adjacent fitting extreme points. The larger the first characteristic factor, the more likely the target fitting extreme point is caused by heavy metal components. Subsequently, the second characteristic factor of the target fitting extreme point can be calculated and analyzed based on the first characteristic factor of the extreme point on the fitting curve corresponding to each reference curve, and then the characteristic retention degree of the target fitting extreme point can be calculated.

[0069] Preferably, in one embodiment of the present invention, the method for obtaining the first characteristic factor of the target fitting extreme point specifically includes: According to the difference in fitting absorbance between the target fitting extreme point and each adjacent fitting extreme point, the initial absorbance difference value between the target fitting extreme point and each adjacent fitting extreme point is obtained; the average value of the initial absorbance difference value between the target fitting extreme point and two adjacent fitting extreme points is normalized as the overall absorbance difference value of the target fitting extreme point. The larger the overall absorbance difference value, the more prominent the target fitting extreme point is, which provides a data basis for the subsequent calculation of the first characteristic factor of the target fitting extreme point.

[0070] In an embodiment of the present invention, the absolute value of the difference in fitting absorbance between the target fitting extreme point and each adjacent fitting extreme point can be used as the initial absorbance difference value between the target fitting extreme point and each adjacent fitting extreme point to analyze the difference between the two.

[0071] The difference between the absorbance and the fitted absorbance at each wavelength between two adjacent fitting extreme points is negatively correlated and mapped to obtain the initial fitting similarity of each wavelength between two adjacent fitting extreme points; the initial fitting similarities of all wavelengths between two adjacent fitting extreme points are integrated and normalized to obtain the comprehensive fitting similarity of the target fitting extreme point. The greater the comprehensive fitting similarity, the closer the absorbance and the fitted absorbance of each wavelength between the target fitting extreme point and the adjacent fitting extreme point are, which provides a data basis for the subsequent calculation of the first characteristic factor of the target fitting extreme point.

[0072] In one embodiment of the present invention, the difference between the absorbance at each wavelength and the fitted absorbance between two adjacent fitting extreme points can be analyzed by calculating the absolute value of the difference between the absorbance at each wavelength and the fitted absorbance between two adjacent fitting extreme points.

[0073] In an embodiment of the present invention, the initial fitting similarities of all wavelengths between two adjacent fitting extreme value points may be integrated by calculating the sum or product of the initial fitting similarities of all wavelengths between two adjacent fitting extreme value points.

[0074] Using the preset first weight and the preset second weight, weighted summation is performed on the overall absorbance difference value and the comprehensive fitting similarity of the target fitting extreme point, respectively, to obtain a first characteristic factor of the target fitting extreme point; In one embodiment of the present invention, the preset first weight is set to 0.5, and the preset second weight is set to 0.5. The specific values ​​of the preset first weight and the preset second weight can also be set by the implementer according to the specific implementation scenario, but it is necessary to ensure that the sum of the two is equal to the value 1.

[0075] The expression of the first characteristic factor of the target fitting extreme point can be specifically, for example, as follows: in, Represents the first characteristic factor of the target fitting extreme point; and Respectively represent the initial absorbance difference between the target fitting extreme point and each adjacent fitting extreme point; Represents the overall absorbance difference value of the target fitting extreme point; Represents the first The difference between the absorbance at each wavelength and the fitted absorbance; Represents the first Similarity of initial fits at each wavelength; Indicates the comprehensive fitting similarity of the target fitting extreme point; Indicates the preset first weight; Indicates the preset second weight; represents the normalization function; Indicates the preset third adjustment parameter to prevent the denominator from being 0. The value range is In one embodiment of the present invention, Set to 0.01, The specific value of can also be set by the implementer according to the specific implementation scenario and is not limited here; Represents the number of all wavelengths between two adjacent fitting extreme points.

[0076] The first characteristic factor of each extreme point on each fitting curve can be obtained by the same method as above.

[0077] Step S302: taking the fitting curve corresponding to any reference curve as the fitting curve to be tested, and selecting an extreme point from all the extreme points on the fitting curve to be tested according to the wavelength difference between each extreme point on the fitting curve to be tested and the target fitting extreme point as the relevant fitting extreme point of the fitting curve to be tested.

[0078] Since the wavelength positions corresponding to the absorption peaks of specific heavy metal components on the near-infrared spectrum curves of different soil samples are relatively close, the wavelength positions corresponding to the extreme points of specific heavy metal components on each fitting curve are relatively close. First, the fitting curve corresponding to any reference curve is used as the fitting curve to be tested. According to the difference in wavelength between each extreme point on the fitting curve to be tested and the target fitting extreme point, an extreme point is selected from all the extreme points on the fitting curve to be tested as the relevant fitting extreme point of the fitting curve to be tested. Subsequently, the distribution of the wavelengths of the relevant fitting extreme points of the fitting curves corresponding to each reference curve can be analyzed to accurately calculate the second characteristic factor of the target fitting extreme point.

[0079] Preferably, in one embodiment of the present invention, a method for obtaining relevant fitting extreme value points of a fitting curve to be measured specifically includes: According to the wavelength difference between each extreme point on the measured fitting curve and the target fitting extreme point, the wavelength distance of each extreme point on the measured fitting curve is obtained. The larger the wavelength distance, the farther the wavelength position corresponding to each extreme point on the measured fitting curve is from the wavelength position corresponding to the target fitting extreme point.

[0080] In one embodiment of the present invention, the absolute value of the difference in wavelength between each extreme point on the measured fitting curve and the target fitting extreme point can be used as the wavelength distance of each extreme point on the measured fitting curve to analyze the difference between the two.

[0081] On the fitting curve to be measured, the extreme point corresponding to the minimum wavelength distance is used as the relevant fitting extreme point of the fitting curve to be measured.

[0082] The relevant fitting extreme value points on the fitting curve corresponding to each reference curve can be obtained by the same method as above, which is shown in the spectrum diagram as the relevant fitting extreme value points on the fitting curve corresponding to each reference curve are basically in the same column.

[0083] Step S303: obtaining the second characteristic factor of the target fitting extreme value point according to the distribution of the wavelength of the relevant fitting extreme value points of the fitting curves corresponding to all the reference curves and the distribution of the first characteristic factor of the relevant fitting extreme value points.

[0084] When the wavelengths of the relevant fitting extreme points on the fitting curves corresponding to each reference curve are relatively close, and the first characteristic factors of the relevant fitting extreme points on the fitting curves corresponding to each reference curve are relatively close, it means that the target fitting extreme point is more likely to be caused by heavy metal components. Therefore, the second characteristic factor of the target fitting extreme point can be obtained according to the distribution of the wavelengths of the relevant fitting extreme points of the fitting curves corresponding to all reference curves and the distribution of the first characteristic factors of the relevant fitting extreme points, thereby providing a data basis for the subsequent calculation of the characteristic retention degree of the target fitting extreme point.

[0085] Preferably, in one embodiment of the present invention, the method for obtaining the second characteristic factor of the target fitting extreme point specifically includes: The wavelength dispersion of the relevant fitting extreme points of the fitting curves corresponding to all reference curves is analyzed to obtain the wavelength dispersion. The smaller the wavelength dispersion, the more likely the relevant fitting extreme points of the fitting curves corresponding to the reference curves are to be at the same wavelength position, which further indicates that the target fitting extreme point is more likely to be caused by heavy metal components.

[0086] In an embodiment of the present invention, the standard deviation or variance of the wavelengths of the relevant fitting extreme points of the fitting curves corresponding to all reference curves can be used as the wavelength dispersion to analyze the degree of dispersion of the wavelengths of the relevant fitting extreme points of the fitting curves corresponding to all reference curves, which is not limited here.

[0087] The degree of dispersion of the first characteristic factors of the relevant fitting extreme points of the fitting curves corresponding to all reference curves is analyzed to obtain the dispersion of the first characteristic factor. The smaller the dispersion of the first characteristic factor, the closer the first characteristic factors of the relevant fitting extreme points of the fitting curves corresponding to the reference curves are, and the more likely the target fitting extreme point is caused by heavy metal components.

[0088] In an embodiment of the present invention, the standard deviation or variance of the first characteristic factor of the relevant fitting extreme points of the fitting curves corresponding to all reference curves can be used as the wavelength dispersion to analyze the degree of dispersion of the first characteristic factor of the relevant fitting extreme points of the fitting curves corresponding to all reference curves, which is not limited here.

[0089] Then, the wavelength dispersion and the average value of the first characteristic factor dispersion can be normalized to obtain the second characteristic factor of the target fitting extreme point.

[0090] In the embodiments of the present invention, the natural constants may be used. A negative exponential function with base The normalization processing of negative correlation is realized in the form of a function, which is not limited here.

[0091] The expression of the second characteristic factor of the target fitting extreme point can be specifically, for example, as follows: in, The second characteristic factor representing the target fitting extreme point; Indicates wavelength dispersion; Indicates the dispersion of the first characteristic factor; Indicated by natural constant An exponential function with base .

[0092] Step S304: The first characteristic factor and the second characteristic factor of the target fitting extreme value point are integrated and normalized to obtain the characteristic retention degree of the target fitting extreme value point.

[0093] Through the above analysis, it can be seen that the larger the first characteristic factor and the second characteristic factor of the target fitting extreme point are, the more likely the target fitting extreme point is caused by heavy metal components, which further indicates that the target fitting extreme point is more critical information, and the target fitting extreme point is retained to a greater extent during the filtering process. Therefore, the first characteristic factor and the second characteristic factor of the target fitting extreme point can be combined and normalized to obtain the characteristic retention degree of the target fitting extreme point.

[0094] In the embodiment of the present invention, the integration of the first characteristic factor and the second characteristic factor of the target fitting extreme point can be achieved by calculating the product value or the sum value of the first characteristic factor and the second characteristic factor of the target fitting extreme point, which is not limited here.

[0095] The expression of the feature retention degree of the target fitting extreme point can be specifically, for example, as follows: in, Indicates the degree of feature retention of the target fitting extreme point; Represents the first characteristic factor of the target fitting extreme point; The second characteristic factor representing the target fitting extreme point; Represents the normalization function.

[0096] The feature retention degree of each extreme point on the fitting curve corresponding to the target curve can be obtained by the same method as above.

[0097] Step S4: filtering the spectral data points on the target curve according to the undisturbed degree of the target curve at the target wavelength and the characteristic retention degree of the target fitting extreme point to obtain a filtered curve; and detecting the heavy metal components contained in the soil sample based on each filtered curve.

[0098] Since existing filtering algorithms, such as the SG filtering algorithm, can only effectively remove conventional noise interference in spectral data, but cannot effectively remove interference caused by the characteristics of the soil itself, and it is easy to destroy key information representing heavy metal components during the filtering process, the spectral data points on the target curve can be filtered according to the degree of undisturbedness of the target curve at the target wavelength and the degree of feature retention of the target fitting extreme points, the filtering process can be optimized, while removing interference information in the near-infrared spectral curve, retaining its key information as much as possible, improving the filtering effect on the target curve, and thus obtaining the filtering curve corresponding to the target curve.

[0099] Preferably, in one embodiment of the present invention, filtering is performed on the spectral data points on the target curve, and the method for obtaining the filtered curve specifically includes: If the fitting data point corresponding to the target wavelength of the fitting curve corresponding to the target curve is not an extreme point, it means that the spectral data point corresponding to the target wavelength of the target curve is not key information. At this time, the undisturbed degree of the target curve at the target wavelength can be normalized to obtain the filtering weight of the spectral data point corresponding to the target curve at the target wavelength.

[0100] If the fitting data point corresponding to the target wavelength of the fitting curve corresponding to the target curve is an extreme point, it means that the spectral data point corresponding to the target curve at the target wavelength is key information. At this time, the product value of the undisturbed degree of the target curve at the target wavelength and the feature retention degree of the fitting data point corresponding to the target wavelength of the fitting curve corresponding to the target curve can be used as the weight adjustment amount of the spectral data point corresponding to the target curve at the target wavelength. The sum of the undisturbed degree of the target curve at the target wavelength and the weight adjustment amount is normalized to obtain the filtering weight of the spectral data point corresponding to the target curve at the target wavelength.

[0101] The filtering weights of the spectral data points corresponding to the target curve at each wavelength can be obtained by the same method as above, and then the fitting weights in the SG filtering algorithm can be adjusted based on the filtering weights of the spectral data points corresponding to the target curve at each wavelength, and the spectral data points on the target curve can be filtered based on the SG filtering algorithm to obtain the filtering curve corresponding to the target curve, wherein the process of adjusting the fitting weights in the SG filtering algorithm based on the filtering weights of the spectral data points corresponding to each wavelength of the target curve and the SG filtering algorithm are technical means well known to those skilled in the art and will not be elaborated here.

[0102] Each near-infrared spectral curve can be filtered using the same method as above to obtain a corresponding filter curve, which can then be used to perform spectral analysis on each filter curve, detect the heavy metal components and their content in each soil sample, and achieve high-precision detection of the soil environment.

[0103] An embodiment of the present invention provides a farmland soil environment detection system, which includes a memory, a processor and a computer program, wherein the memory is used to store the corresponding computer program, and the processor is used to run the corresponding computer program. When the computer program runs in the processor, it can implement the method described in steps S1 to S4.

[0104] In summary, the embodiment of the present invention first obtains near-infrared spectral curves of a preset number of soil samples in the cultivated land area to be tested, where there are multiple spectral data points on the near-infrared spectral curve, and the spectral data points are composed of wavelength and absorbance; any wavelength is used as the target wavelength, any near-infrared spectral curve is used as the target curve, and other near-infrared spectral curves except the target curve are used as reference curves, and the undisturbed degree of the target curve at the target wavelength is obtained according to the fluctuation of the spectral data points of each near-infrared spectral curve in a preset window centered on the target wavelength, and the fluctuation difference of the spectral data points between the target curve and the reference curve in the preset window; the spectral data points of each near-infrared spectral curve are fitted to obtain a fitting curve, where the fitting curve includes multiple fitting data points, and the fitting data points are composed of absorbance. length and fitted absorbance; on the fitting curve corresponding to the target curve, any extreme point is taken as the target fitting extreme point, and the two extreme points adjacent to the target fitting extreme point are taken as adjacent fitting extreme points; according to the difference in fitted absorbance between the target fitting extreme point and the adjacent fitting extreme points, the difference in absorbance at each wavelength between two adjacent fitting extreme points and the fitted absorbance, and the distribution of wavelengths of extreme points related to the target fitting extreme point on the fitting curve corresponding to each reference curve, the characteristic retention degree of the target fitting extreme point is obtained; according to the undisturbed degree of the target curve at the target wavelength and the characteristic retention degree of the target fitting extreme point, the spectral data points on the target curve are filtered to obtain a filtered curve; based on each filtered curve, the heavy metal components contained in the soil sample are detected.

[0105] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0106] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

Claims

1. A method for detecting cultivated land soil environment, characterized in that: The method comprises: Acquire a preset number of near-infrared spectrum curves of soil samples in the cultivated land area to be tested, wherein there are a plurality of spectrum data points on the near-infrared spectrum curve, and the spectrum data points are composed of wavelength and absorbance; Taking any wavelength as the target wavelength, taking any near-infrared spectrum curve as the target curve, taking other near-infrared spectrum curves except the target curve as reference curves, and obtaining the undisturbed degree of the target curve at the target wavelength according to the fluctuation of the spectrum data points of each near-infrared spectrum curve in a preset window centered on the target wavelength, and the fluctuation difference of the spectrum data points between the target curve and the reference curve in the preset window; Fitting the spectral data points of each near-infrared spectral curve to obtain a fitting curve, wherein the fitting curve includes a plurality of fitting data points, and the fitting data points are composed of wavelengths and fitting absorbances; on the fitting curve corresponding to the target curve, any extreme point is used as a target fitting extreme point, and two extreme points adjacent to the target fitting extreme point are used as adjacent fitting extreme points; according to the difference in the fitting absorbance between the target fitting extreme point and the adjacent fitting extreme point, the difference between the absorbance of each wavelength between the two adjacent fitting extreme points and the fitting absorbance, and the distribution of the wavelengths of the extreme points related to the target fitting extreme point on the fitting curve corresponding to each reference curve, the characteristic retention degree of the target fitting extreme point is obtained; According to the undisturbed degree of the target curve at the target wavelength and the characteristic retention degree of the target fitting extreme point, the spectral data points on the target curve are filtered to obtain a filtered curve; based on each filtered curve, the heavy metal components contained in the soil sample are detected.

2. A method for detecting cultivated land soil environment according to claim 1, characterized in that: The obtaining of the undisturbed degree of the target curve at the target wavelength comprises: According to the fluctuation of the spectral data points of the target curve in the preset window and the difference in the fluctuation of the spectral data points in the preset window between the near-infrared spectral curves, the soil interference degree of the target curve at the target wavelength is obtained; Obtaining local absorbance similarity between the target curve and each reference curve at a target wavelength according to the distance between the extreme points in the preset window between the target curve and each reference curve, the deviation of the absorbance of the extreme points in the preset window of each near-infrared spectrum curve relative to the overall level of absorbance of all spectrum data points in the preset window, and the difference in fluctuation of the spectrum data points in the preset window between the target curve and each reference curve; Performing negative correlation mapping on the soil disturbance degree to obtain a first undisturbed factor of the target curve at the target wavelength; analyzing the overall level of the local absorbance similarity between the target curve and all reference curves at the target wavelength to obtain a second undisturbed factor of the target curve at the target wavelength; The first undisturbed factor and the second undisturbed factor are integrated to obtain the undisturbed degree of the target curve at the target wavelength.

3. A method for detecting cultivated land soil environment according to claim 2, characterized in that: The step of obtaining the soil interference degree of the target curve at the target wavelength includes: Analyzing the discrete degree of absorbance of all spectral data points of the target curve in the preset window to obtain the local fluctuation degree of the target curve at the target wavelength; Analyzing the discrete degree of the local fluctuation degree of all near-infrared spectral curves at the target wavelength to obtain the fluctuation difference degree of the target wavelength; The local fluctuation degree and the fluctuation difference degree are combined to obtain the soil interference degree of the target curve at the target wavelength.

4. A method for detecting cultivated land soil environment according to claim 3, characterized in that: The obtaining of the local absorbance similarity between the target curve and each reference curve at the target wavelength comprises: Analyze the overall level of absorbance of all spectral data points of each near-infrared spectral curve in the preset window to obtain the overall absorbance of each near-infrared spectral curve in the preset window; obtain the degree of deviation of each extreme point of each near-infrared spectral curve in the preset window according to the difference between the absorbance of each extreme point of each near-infrared spectral curve in the preset window and the overall absorbance; Using any reference curve as the reference curve to be measured; matching the extreme value points between the target curve and the reference curve to be measured on the preset window based on the DTW algorithm, and using any two extreme value points that match each other as a matching point group; Normalizing the sum of the deviations of the two extreme value points in each matching point group to obtain a first adjustment weight for each matching point group; Based on the first adjustment weight, weighted summation is performed on the distances between two extreme value points in all matching point groups to obtain the local absorbance difference between the target curve and the reference curve to be measured at the target wavelength; Normalizing the difference in the local fluctuation degree between the target curve and the reference curve to be measured at the target wavelength to obtain a second adjustment weight; Based on the second adjustment weight, the local absorbance difference between the target curve and the reference curve to be measured at the target wavelength is weighted and negatively correlated to obtain the local absorbance similarity between the target curve and the reference curve to be measured at the target wavelength.

5. The method for detecting cultivated land soil environment according to claim 1, characterized in that: The feature retention degree of obtaining the target fitting extreme point includes: Obtaining a first characteristic factor of the target fitting extreme value point according to the difference in the fitting absorbance between the target fitting extreme value point and the adjacent fitting extreme value point, and the difference in the absorbance of each wavelength between two adjacent fitting extreme value points and the fitting absorbance; The fitting curve corresponding to any reference curve is used as the fitting curve to be tested, and according to the difference in wavelength between each extreme point on the fitting curve to be tested and the target fitting extreme point, an extreme point is selected from all the extreme points on the fitting curve to be tested as the relevant fitting extreme point of the fitting curve to be tested; Obtaining a second characteristic factor of a target fitting extreme point according to the distribution of wavelengths of the relevant fitting extreme points of the fitting curves corresponding to all reference curves and the distribution of the first characteristic factors of the relevant fitting extreme points; The first characteristic factor and the second characteristic factor of the target fitting extreme value point are integrated and normalized to obtain the characteristic retention degree of the target fitting extreme value point.

6. A method for detecting cultivated land soil environment according to claim 5, characterized in that: The first characteristic factor of obtaining the target fitting extreme point includes: According to the difference in the fitting absorbance between the target fitting extreme value point and each of the adjacent fitting extreme value points, an initial absorbance difference value between the target fitting extreme value point and each of the adjacent fitting extreme value points is obtained; and the average value of the initial absorbance difference value between the target fitting extreme value point and two adjacent fitting extreme value points is normalized as the overall absorbance difference value of the target fitting extreme value point; Performing negative correlation mapping on the difference between the absorbance of each wavelength between two adjacent fitting extreme value points and the fitted absorbance to obtain the initial fitting similarity of each wavelength between the two adjacent fitting extreme value points; synthesizing and normalizing the initial fitting similarities of all wavelengths between the two adjacent fitting extreme value points to obtain the comprehensive fitting similarity of the target fitting extreme value point; The preset first weight and the preset second weight are used to perform weighted summation on the overall absorbance difference value and the comprehensive fitting similarity of the target fitting extreme point, respectively, to obtain a first characteristic factor of the target fitting extreme point.

7. A method for detecting cultivated land soil environment according to claim 5, characterized in that: The step of selecting an extreme point from all extreme points on the fitted curve to be tested as a relevant fitting extreme point of the fitted curve to be tested comprises: Obtaining the wavelength distance of each extreme point on the fitting curve to be measured according to the difference in wavelength between each extreme point on the fitting curve to be measured and the target fitting extreme point; On the fitting curve to be measured, the extreme point corresponding to the minimum value of the wavelength distance is used as the relevant fitting extreme point of the fitting curve to be measured.

8. A method for detecting cultivated land soil environment according to claim 5, characterized in that: The second characteristic factor for obtaining the target fitting extreme point includes: Analyzing the degree of dispersion of the wavelengths of the relevant fitting extreme value points of the fitting curves corresponding to all reference curves to obtain wavelength dispersion; Analyzing the degree of dispersion of the first characteristic factor of the relevant fitting extreme value points of the fitting curves corresponding to all reference curves to obtain the dispersion degree of the first characteristic factor; A negative correlation normalization process is performed on the average values ​​of the wavelength dispersion and the first characteristic factor dispersion to obtain a second characteristic factor of a target fitting extreme point.

9. A method for detecting cultivated land soil environment according to claim 1, characterized in that: The filtering of the spectral data points on the target curve to obtain the filtered curve comprises: If the fitting data point corresponding to the target wavelength of the fitting curve corresponding to the target curve is not an extreme point, normalizing the undisturbed degree of the target curve at the target wavelength to obtain the filtering weight of the spectral data point corresponding to the target curve at the target wavelength; If the fitting data point corresponding to the target wavelength of the fitting curve corresponding to the target curve is an extreme point, the product value of the undisturbed degree of the target curve at the target wavelength and the feature retention degree of the fitting data point corresponding to the target wavelength of the fitting curve corresponding to the target curve is used as the weight adjustment amount of the spectral data point corresponding to the target curve at the target wavelength, and the sum of the undisturbed degree of the target curve at the target wavelength and the weight adjustment amount is normalized to obtain the filtering weight of the spectral data point corresponding to the target curve at the target wavelength; Based on the filtering weights of the spectral data points corresponding to each wavelength of the target curve, the fitting weights in the SG filtering algorithm are adjusted, and the spectral data points on the target curve are filtered based on the SG filtering algorithm to obtain the filtering curve corresponding to the target curve.

10. A farmland soil environment detection system, the system comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Near-infrared soil spectrum denoising method based on self-adapting filtering

    CN102721663A

  • Indocyanine green detection method based on optics

    CN116818739A

  • Rapid soil layer pollution detection method based on spectral analysis

    CN117629967A

  • Collagen tripeptide quality detection method and system

    CN117951484A

  • Method for monitoring mass ratio of saturated acid for preparing diesel oil anti-wear agent

    CN118914437A

Cited By

  • Clinical blood concentration detection method

    CN120558897A

  • Soil component detection method for camellia oleifera nursery

    CN120761332A

  • Geological sample component identification and anomaly detection system based on machine learning

    CN121068531A

  • A machine learning based geological sample composition identification and anomaly detection system

    CN121068531B

  • Near infrared spectrum-based cotton cleaner multi-bin cotton blending uniformity analysis system

    CN121207928A