Method for detecting soil organic matter based on phenotyping and spectral analysis

CN122901412APending Publication Date: 2026-10-13NINGXIA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611406203.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-11
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

[0004]但现有光谱检测技术仍存在以下局限性:其一,散射校正采用全局统一的算法模型,未针对不同质地土壤的光散射机制差异进行适配性调整,对非均相复杂土壤基体的干扰消除效果不均衡,跨质地样本的检测精度波动较大;其二,表型参数与光谱数据的融合多为简单维度拼接,未根据表型对各波段的干扰程度进行差异化特征加权,易引入冗余干扰信息,模型泛化能力提升有限;其三,仅在光谱预处理阶段执行单级校正,无法消解同质地群内土壤表型个体差异带来的残余预测误差,检测精度存在明显瓶颈,且检测结果仅输出单一含量数值,无法同步量化结果的可靠程度,难以满足田间原位检测的决策参考需求

Benefits of technology

本申请通过表型物理参数驱动的质地聚类分群与定向多元散射校正,针对不同质地土壤的光散射机制差异匹配专属校正系数,可精准消除土壤物理表型引发的基线漂移与光散射干扰,避免了全局统一校正对复杂非均相基体适配性不足的问题;同时结合表型参数计算特征波段权重并执行加权增强,再将加权光谱特征与表型参数进行特征级融合后输入反演模型,能够有效强化有机质特征信号、抑制表型冗余干扰,显著提升土壤有机质光谱反演的检测精度与跨质地样本的泛化能力;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122901412A_ABST
    Figure CN122901412A_ABST
Patent Text Reader

Abstract

The application discloses a soil organic matter detection method based on phenotypes and spectrum analysis, and relates to the technical field of rapid nondestructive detection of soil nutrients. The specific implementation scheme is as follows: the phenotypic parameters of the to-be-detected soil, such as particle size, moisture content, texture type and surface roughness, are detected, and near-infrared full-band original spectrum data are synchronously collected; texture clustering is performed according to the phenotypic parameters, a corresponding scattering correction coefficient is matched, directional multivariate scattering correction with phenotype constraint is performed, organic matter characteristic absorption bands are extracted, and the organic matter characteristic absorption bands are weighted and enhanced according to the degree of phenotypic interference; after the phenotypic characteristics are fused, the preliminary detection value is obtained by inputting the inversion model matched by clustering; and then, the dynamic compensation amount is calculated through a clustering residual error correction matrix to complete secondary error compensation, and finally, the detection value is output, and the error range and the credibility level are synchronously labeled. The application can effectively eliminate the spectrum interference caused by soil phenotypes, improve the detection precision and generalization ability under a complex matrix, and adapt to the demand for rapid detection in situ in the field.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of rapid and non-destructive testing technology for soil nutrients, and more specifically, to a method for detecting soil organic matter based on phenotypic and spectral analysis. Background Technology

[0002] With the advancement of precision agriculture and farmland quality assessment, rapid and non-destructive testing of soil organic matter content has become a core technical requirement for soil testing and fertilizer recommendation, as well as soil fertility classification. In particular, in-situ field testing and rapid screening of batch samples have placed high demands on the testing efficiency, environmental adaptability, and reliability of testing methods.

[0003] Currently, soil organic matter testing mainly falls into two technical approaches: one is laboratory wet chemical testing methods, represented by potassium dichromate titration and dry burning methods. These methods offer high accuracy and are the benchmark methods for soil organic matter testing. The other is rapid spectroscopic detection methods, centered on near-infrared diffuse reflectance spectroscopy. By collecting soil spectral reflectance data and combining it with chemometric models, organic matter content can be retrieved without complex sample pretreatment, enabling non-destructive and rapid detection. Existing spectroscopic detection schemes generally employ a general multivariate scattering correction algorithm to preprocess the original spectrum, and then use models such as partial least squares regression to retrieve the content. Some improved schemes attempt to incorporate soil moisture content and texture type as auxiliary variables into the model to reduce the impact of matrix interference on the detection results.

[0004] However, existing spectral detection technologies still have the following limitations: First, scattering correction uses a globally unified algorithm model without adapting it to the differences in light scattering mechanisms of soils with different textures. This results in uneven interference elimination effects on heterogeneous and complex soil matrices, leading to significant fluctuations in detection accuracy across different soil types. Second, the fusion of phenotypic parameters and spectral data is often a simple dimensional stitching process without differentiated feature weighting based on the degree of interference in each band according to the phenotypic characteristics. This easily introduces redundant interference information, limiting the improvement of model generalization ability. Third, performing single-level correction only in the spectral preprocessing stage cannot eliminate residual prediction errors caused by individual differences in soil phenotypes within the same soil group. This results in a significant bottleneck in detection accuracy, and the detection results only output a single content value, failing to simultaneously quantify the reliability of the results and making it difficult to meet the decision-making reference needs of in-situ field detection.

[0005] Therefore, it is necessary to provide a soil organic matter detection method based on phenotypic and spectral analysis to solve the aforementioned problem.

[0006] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0007] In view of this, the purpose of this application is to provide a soil organic matter detection method based on phenotypic and spectral analysis, which can specifically eliminate spectral scattering interference and baseline drift caused by soil physical phenotype, effectively improve the accuracy and cross-matter generalization ability of soil organic matter spectral detection in complex heterogeneous matrices, and simultaneously label the error range and confidence level of the detection results, adapting to the application needs of rapid in-situ detection in the field.

[0008] According to a first aspect of this application, a method for detecting soil organic matter based on phenotypic and spectral analysis is provided, comprising: S101: Detect the phenotypic physical parameters of the soil sample to be tested, including particle size, moisture content, texture type and surface roughness. Perform near-infrared diffuse reflectance spectral scanning on the soil sample to be tested to obtain raw spectral reflectance data across the entire band. S102: Based on the phenotypic physical parameters, the soil to be tested is clustered into texture groups to determine the texture group to which the soil to be tested belongs. The scattering correction model coefficients of the corresponding groups are matched and retrieved. The spectral scattering correction coefficients are calculated based on the scattering correction model coefficients. Phenotypic constraints are applied to the original spectral reflectance data to obtain the corrected spectral data. S103: Extract the organic matter characteristic absorption bands from the corrected spectral data, calculate the weight coefficients of each characteristic band based on the phenotypic physical parameters and perform weighted enhancement, fuse the weighted spectral features with the phenotypic physical parameters at the feature level, input the pre-calibrated partial least squares regression inversion model, and calculate the preliminary detection value of organic matter content of the soil to be tested. S104: Match the corresponding phenotypic-prediction residual correction matrix according to the texture group to which the soil sample to be tested belongs, and calculate the dynamic residual compensation amount according to the relative proportion of water content and particle size in the interval of the phenotypic-prediction residual correction matrix. Perform directional secondary error compensation on the preliminary detection value of organic matter content to obtain the final detection value of organic matter content. S105: Match the accuracy verification interval corresponding to the phenotypic parameters of the soil sample to be tested, output the final organic matter content detection value, and simultaneously label the relative error range and confidence level corresponding to the detection value.

[0009] In some embodiments, acquiring the phenotypic physical parameters and full-band raw spectral reflectance data of the sample specifically includes: First, the surface of the soil sample to be tested is leveled and impurities are removed. Then, phenotypic physical parameters and near-infrared diffuse reflectance spectroscopy are simultaneously detected in the same pretreated surface area. Among the phenotypic physical parameters, particle size, moisture content, and surface roughness are determined by quantitative physical detection methods, and the texture type is determined according to the particle size distribution results and the general soil texture classification standard. The same soil sample is scanned N times to obtain N spectral curves. The arithmetic mean of the reflectance obtained from the repeated scans is taken at each wavelength, and the obtained average spectrum is used as the original full-band spectral reflectance data of the sample. N is a positive integer greater than 2.

[0010] In some embodiments, the texture group to which the soil to be tested belongs is determined, and the scattering correction model coefficients of the corresponding group are retrieved, specifically including: Using particle size distribution, moisture content, and surface roughness as clustering features, unsupervised texture clustering was performed on the soil samples, and the clustering results were mapped and matched with preset texture type labels. Each texture group has a corresponding set of exclusive scattering correction model coefficients. The corresponding coefficient set is retrieved according to the texture group to which the soil to be tested belongs. Based on the clustering results, the soil samples to be tested are classified into their original corresponding texture groups, and the set of coefficients of the dedicated scattering correction model pre-established for that texture group is retrieved.

[0011] In some embodiments, spectral scattering correction coefficients are calculated, and phenotypic-constrained directional multivariate scattering correction is performed on the original spectral reflectance data to obtain corrected spectral data, specifically including: The scattering correction model coefficient set includes the standard reference spectrum, baseline reference parameters, and scattering reference parameters corresponding to the texture group; Using the standard reference spectrum as the calibration reference, the baseline correction amount is calculated by combining the real-time moisture content of the soil to be tested, and the scattering correction coefficient is calculated by combining the surface roughness of the soil to be tested. The baseline correction amount and the scattering correction coefficient together constitute the dynamic correction factor. Based on the dynamic correction factor, baseline drift correction is performed on the original spectral reflectance data to eliminate the overall spectral translation deviation caused by soil moisture content; Multiplicative light scattering compensation correction is performed on the baseline-corrected spectral data to eliminate spectral multiplicative scattering interference caused by surface roughness, resulting in corrected spectral data.

[0012] In some embodiments, the characteristic absorption bands of organic matter in the corrected spectral data are extracted, and the weighting coefficients of each characteristic band are calculated based on phenotypic physical parameters and then weighted and enhanced. Specifically, this includes: Pre-configure a set of exclusive characteristic bands for the characteristic absorption peaks of the organic functional groups of each texture group; Based on the texture group of the soil to be tested, the corresponding exclusive characteristic band set is retrieved, and the organic matter characteristic absorption band data is extracted from the corrected spectral data. The degree of phenotypic interference corresponding to each characteristic band is calculated based on the phenotypic physical parameters of the soil to be tested, and the weight coefficient of each characteristic band is determined by the rule that is negatively correlated with the degree of interference. Based on the weighting coefficients, the spectral reflectance data of the corresponding characteristic bands are subjected to weighted enhancement processing to obtain the weighted enhanced spectral features of organic matter.

[0013] In some embodiments, a preliminary detection value of the organic matter content of the soil to be tested is obtained, specifically including: The phenotypic physical parameters are normalized to obtain standardized phenotypic features. The standardized phenotypic features are then combined with the weighted and enhanced organic matter spectral features according to their dimensions to form a multi-source fusion feature vector. The multi-source fusion feature vector is input into a pre-calibrated partial least squares regression inversion model that matches the soil texture group to calculate and output the preliminary detection value of organic matter content of the soil to be tested.

[0014] In some embodiments, based on the texture group to which the soil to be tested belongs, a phenotypic-prediction residual correction matrix for the corresponding group is matched, specifically including: A dedicated phenotypic-prediction residual correction matrix is ​​pre-constructed for each texture group. The phenotypic-prediction residual correction matrix has the water content gradient interval as the row dimension and the particle size gradient interval as the column dimension. Each element in the matrix is ​​the average predicted residual of organic matter content of the calibrated sample of the corresponding texture group within the corresponding phenotypic parameter interval. Based on the texture group to which the soil to be tested belongs, retrieve the corresponding phenotypic-prediction residual correction matrix; Based on the real-time moisture content and particle size parameters of the soil to be tested, the corresponding row and column intervals in the matrix are located, and the average value of the predicted residuals at the corresponding positions is extracted as the residual correction benchmark value for subsequent directional secondary error compensation.

[0015] In some embodiments, a phenotypic adaptation correction coefficient is calculated to perform directional secondary error compensation on the preliminary organic matter content detection value to obtain the final organic matter content detection value, specifically including: The two-parameter interpolation coefficients are calculated based on the relative proportion of the real-time soil moisture content in the row interval of the matrix and the relative proportion of the real-time particle size in the column interval of the matrix. The extracted residual correction benchmark value is multiplied by the two-parameter interpolation coefficient to obtain the dynamic residual compensation amount adapted to the soil to be tested. The ratio of the dynamic residual compensation amount to the preliminary detection value of organic matter content is determined as the phenotypic adaptation correction coefficient after amplitude limiting mapping. The phenotypic adaptation correction coefficient is then used to correct the amplitude of the dynamic residual compensation amount to obtain the final detection value of organic matter content.

[0016] In some embodiments, the final organic matter content detection value is output, and the relative error range and confidence level corresponding to the detection value are simultaneously labeled, specifically including: A dedicated accuracy verification interval comparison table is pre-constructed for each texture group. The comparison table uses the moisture content gradient interval and the particle size gradient interval as matching dimensions. Each matching dimension combination corresponds to a set of preset relative error ranges and confidence levels. Based on the texture group of the soil to be tested, retrieve the corresponding accuracy verification interval reference table, combine the real-time moisture content and particle size parameters of the soil to be tested, locate the corresponding matching dimension combination, and extract the relative error range and confidence level corresponding to the combination. Output the final organic matter content detection value, and simultaneously label the extracted relative error range and confidence level in the detection results.

[0017] One embodiment of the above application has the following advantages or beneficial effects: This application employs texture clustering and directional multivariate scattering correction driven by phenotypic physical parameters. It matches specific correction coefficients to the differences in light scattering mechanisms of soils with different textures, which can accurately eliminate baseline drift and light scattering interference caused by soil physical phenotypes. This avoids the problem of insufficient adaptability of global uniform correction to complex heterogeneous matrices. At the same time, it calculates the feature band weights by combining phenotypic parameters and performs weighted enhancement. Then, it inputs the weighted spectral features and phenotypic parameters into the inversion model after feature-level fusion. This can effectively enhance the organic matter feature signal, suppress phenotypic redundancy interference, and significantly improve the detection accuracy and generalization ability of soil organic matter spectral inversion across texture samples. Based on spectral preprocessing correction, this application further performs directional secondary error compensation through a phenotypic-prediction residual correction matrix matched by texture group. This can eliminate residual prediction bias caused by individual differences in soil phenotypes within the same texture group, break through the upper limit of single-level correction accuracy, and better adapt to the actual application needs of rapid in-situ detection in the field.

[0018] Other effects of the above-mentioned alternative methods will be described below in conjunction with specific embodiments. Attached Figure Description

[0019] The accompanying drawings are provided for a better understanding of this solution and do not constitute a limitation of this application. Wherein: Figure 1 This is a schematic diagram of a soil organic matter detection method based on phenotypic and spectral analysis provided in an embodiment of this application; Figure 2 This is the original spectrum before scattering correction provided in the embodiments of this application; Figure 3 This is a directional multivariate scattering corrected spectrum provided in an embodiment of this application; Figure 4These are the heatmaps of the prediction residual correction matrix provided in the embodiments of this application, wherein (a) is the heatmap of the prediction residual correction matrix of the sandy soil group phenotype, (b) is the heatmap of the prediction residual correction matrix of the loamy soil group phenotype, and (c) is the heatmap of the prediction residual correction matrix of the clay soil group phenotype. Figure 5 This is a distribution map of the characteristic band weight coefficients of organic matter in three different soil groups provided in the embodiments of this application. Detailed Implementation

[0020] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0021] To facilitate understanding of this application, the embodiments of this application will be briefly described below: In the field in-situ testing of arable land quality and soil testing for fertilizer recommendation, it is necessary to quickly obtain soil organic matter content data at each sampling point to provide data support for the assessment of arable land fertility level and the accurate formulation of field fertilization plans. For example, when conducting an annual survey of arable land quality in a county, hundreds or thousands of field soil samples need to be screened quickly, and a large number of tests need to be completed on-site in the field, making it impossible to perform uniform pre-treatment such as drying and grinding on all samples. Soils in different plots have significant differences in texture, moisture content, particle size and surface condition, requiring testing methods that can adapt to the complex and varied soil matrix conditions, while quickly outputting test results that can be directly used for production decisions.

[0022] Existing rapid near-infrared spectroscopy methods for soil organic matter mostly employ globally uniform scattering correction algorithms and inversion models, which are difficult to adapt to the differences in light scattering characteristics of soils with different textures, resulting in significant fluctuations in detection accuracy across soil textures. Some schemes that introduce phenotypic parameters simply concatenate the parameters to the model input without differentiating the degree of interference of phenotypes on each spectral band. Furthermore, they only perform single-level correction during the spectral preprocessing stage, failing to eliminate residual prediction biases caused by individual phenotypic differences within the same soil texture. At the same time, the detection results only output a single content value, failing to simultaneously quantify the reliability of the results, and thus failing to meet the on-site decision-making reference needs of in-situ field detection.

[0023] See Figure 1 This is a schematic flowchart of a soil organic matter detection method based on phenotypic and spectral analysis provided in an embodiment of this application. Figure 1The execution subject of the method shown can be a combination of software and / or hardware, specifically, it can be one or more of various types of terminals, hardware systems, cloud computing, etc.

[0024] Figure 1 The method for detecting soil organic matter based on phenotypic and spectral analysis shown includes S101 to S105, as detailed below: S101: Detect the phenotypic physical parameters of the soil sample to be tested, including particle size, moisture content, texture type and surface roughness. Perform near-infrared diffuse reflectance spectral scanning on the soil sample to be tested to obtain raw spectral reflectance data across the entire band.

[0025] Furthermore, in a specific embodiment of this application, the specific implementation process of S101 for obtaining the phenotypic physical parameters and the original spectral reflectance data of the sample across the entire wavelength band is as follows: First, the surface of the soil sample to be tested is pre-treated. The soil sample is placed horizontally at the testing station, and a standard leveling scraper is used to lightly scrape and level the surface of the sample. At the same time, non-soil impurities such as plant residues and gravel attached to the surface are removed. The flatness error of the leveled test surface is controlled to be no more than 0.5mm. This eliminates the systematic deviation caused by macroscopic unevenness and impurities on the surface to subsequent spectral scattering and phenotypic parameter detection, and ensures that the reference surface of all samples is consistent.

[0026] After preprocessing, synchronous acquisition of the same area is performed: the effective detection fields of the phenotypic parameter detection unit and the near-infrared diffuse reflectance spectroscopy detection probe are aligned with the same preprocessed surface area to ensure that the detection areas of the two are completely overlapped; at the same time, the time interval between the start time of phenotypic parameter detection and the start time of spectral scanning is controlled to not exceed 2 seconds to ensure that the soil moisture content and surface condition are completely consistent when the two sets of data are collected, avoiding data mismatch caused by water evaporation and surface condition changes due to time difference, and providing a consistent data source for subsequent phenotypic constraint spectral correction.

[0027] Among them, the four types of phenotypic physical parameters were determined using corresponding quantitative physical detection methods: particle size was detected by laser diffraction, and the particle size distribution data of soil particles were obtained by laser particle size analysis device; moisture content was detected by contact in-situ detection using a capacitive in-situ sensor, and the quantitative value of soil volumetric moisture content was directly output; surface roughness was obtained by collecting three-dimensional morphology data of the test surface through a laser three-dimensional morphology scanning device, and the quantitative characterization value of surface roughness was calculated; texture type was determined based on the aforementioned particle size distribution results, according to the international soil texture classification standard, to determine the texture category of the soil to be tested.

[0028] Specifically, the near-infrared diffuse reflectance spectral scanning is performed according to the preset acquisition parameters: the scanning band range covers 900nm-2500nm, and the spectral resolution is set to 8nm; the same detection surface of the same soil sample is continuously scanned 3-5 times, each scan completely covering the entire preset band and outputting the reflectance values ​​of each corresponding wavelength; after the scan is completed, the arithmetic mean of the reflectance data of all bands is taken wavelength by wavelength, and the calculated average spectral data is used as the original full-band spectral reflectance data of the soil sample. Random noise is suppressed by averaging multiple scans, thereby improving the stability and repeatability of the original spectral data. It should be noted that the number of repeated scans of the same detection surface is set to 3-5 times in this application, which is determined by comprehensively considering the random noise suppression effect, the marginal benefit of the signal-to-noise ratio, and the field detection efficiency. If the number of scans is less than 3 times, the random noise suppression is insufficient and the average spectral repeatability is poor. Therefore, the number of repeated scans is set to 3-5 times, which ensures the stability and reliability of the original spectral data while taking into account the needs of rapid in-situ detection in the field. This range of scans is definite and reproducible.

[0029] In this embodiment, S101 serves as the data input terminal for the entire detection process. Through pre-processing of surface smoothing and impurity removal, synchronous acquisition at second-level intervals in the same area, parameter detection using quantitative physical methods, and spectral noise reduction design using multiple scan averaging, it controls the systematic and random errors in the acquisition process from the source. This ensures accurate matching of phenotypic data and spectral data in the spatiotemporal dimensions and consistency of output standards, providing a stable and reliable data foundation for subsequent group scattering correction, band weighted fusion, and residual secondary compensation. It also supports the phenotypic-driven correction logic of the entire process from the acquisition end.

[0030] S102: Based on the phenotypic physical parameters, the soil to be tested is clustered into texture groups to determine the texture group to which the soil to be tested belongs. The scattering correction model coefficients of the corresponding group are matched and retrieved. The spectral scattering correction coefficients are calculated based on the scattering correction model coefficients. Phenotypic constraints are applied to the original spectral reflectance data to obtain the corrected spectral data.

[0031] Furthermore, in the specific implementation of this application, the specific implementation process of S102 is as follows: First, the texture clustering and scattering correction model coefficient set are matched and retrieved. The particle size distribution and texture type obtained by S101 are used as the core clustering features, and the real-time moisture content and surface roughness parameters of the soil to be tested are used as auxiliary clustering features. An unsupervised clustering algorithm is used to perform texture clustering on the soil samples to be tested. In this embodiment, a fixed number of texture clusters are pre-constructed based on a large number of calibrated soil samples. For example, according to the soil texture spectrum, they are divided into three basic clusters: sandy soil, loamy soil, and clay soil. Each texture cluster has a corresponding exclusive scattering correction model coefficient set. According to the clustering calculation results, the soil samples to be tested are assigned to the original texture cluster with the highest matching degree, and the exclusive scattering correction model coefficient set pre-established for that texture cluster is directly retrieved to complete the matching of clusters and coefficients.

[0032] After retrieving the coefficient set, the spectral scattering correction coefficients are calculated, and directional multivariate scattering correction for phenotypic constraints is performed. The scattering correction model coefficient set includes the standard reference spectrum, baseline reference parameters, and scattering reference parameters for the corresponding texture group. The standard reference spectrum is the spectral reflectance data of a standard soil sample under the texture group, where both moisture content and surface roughness are at the reference calibration state. The baseline reference parameters are the quantized value of the spectral baseline drift caused by a unit change in moisture content under the group, and the scattering reference parameters are the coefficients of spectral scattering intensity change caused by a unit change in surface roughness under the group. Using the standard reference spectrum as a correction reference, the difference between the real-time moisture content of the soil to be tested and the reference moisture content is multiplied by the baseline reference parameters to calculate the baseline correction amount. The ratio of the real-time surface roughness of the soil to be tested to the reference surface roughness is combined with the scattering reference parameters for fitting calculation to obtain the scattering correction coefficient. The baseline correction amount and the scattering correction coefficient together constitute the dynamic correction factor for phenotypic constraints.

[0033] The correction process is performed in two steps: First, baseline drift correction is performed on the original spectral reflectance data based on the baseline correction amount, and the corresponding baseline correction amount is uniformly superimposed on the spectral reflectance values ​​of the entire band to eliminate the overall spectral translation deviation caused by differences in soil moisture content; then, multiplicative light scattering compensation correction is performed on the baseline-corrected spectral data based on the scattering correction coefficient, and the spectral reflectance values ​​of the entire band are multiplicatively corrected according to the scattering correction coefficient to eliminate the spectral multiplicative scattering interference caused by differences in surface roughness, and finally the corrected spectral data is obtained.

[0034] Specifically, the standard reference spectrum, baseline reference parameters, and scattering reference parameters for the corresponding texture groups are all calibration parameters that have been independently constructed and stored for each texture group through calibration experiments in advance. The specific acquisition process is as follows: First, the acquisition of standard reference spectra. For each texture group, standard soil samples with median organic matter content and physical conditions meeting the reference calibration conditions were selected as reference samples. The reference calibration conditions were set as follows: soil moisture content was the air-dried reference moisture content for that group, and the surface roughness after standard leveling process reached the reference roughness value for that group. Multiple repeated spectral scans were performed on the same test surface of the reference samples, and the average spectral data from the multiple scans was taken as the standard reference spectrum for that texture group, which was used as a reference for subsequent scattering correction.

[0035] Secondly, the acquisition of baseline reference parameters. For each texture group, based on the reference sample of that group, while maintaining constant soil particle size distribution and surface roughness, multiple sets of calibration samples with different moisture contents were prepared by gradient humidification. The moisture contents of each set of samples covered the common field moisture content range. Full-band spectral data of each set of moisture content samples were collected sequentially. Using the standard reference spectrum as a reference, the overall baseline shift of the full-band spectrum under different moisture contents was calculated. The mapping relationship between moisture content difference and baseline shift was established by linear fitting. The baseline drift quantification value corresponding to the unit moisture content change obtained by fitting was determined as the baseline reference parameter of that texture group.

[0036] Third, the acquisition of scattering reference parameters. For each texture group, based on the reference sample of that group, while maintaining constant soil particle size distribution and moisture content, multiple sets of calibration samples with different surface roughnesses were prepared through different degrees of surface smoothing treatment. The roughness of each set of samples covered the range of common surface conditions in the field. Full-band spectral data of each roughness sample were collected sequentially. Using the standard reference spectrum as a reference, the multiplicative scattering intensity change of the full-band spectrum under different roughness was calculated. By fitting, a mapping relationship between the surface roughness difference and the multiplicative scattering intensity was established. The scattering intensity change coefficient corresponding to the unit roughness change obtained by fitting was determined as the scattering reference parameter of that texture group.

[0037] After completing the above calibration, the standard reference spectrum, baseline reference parameters, and scattering reference parameters of each texture group are packaged into a set of dedicated scattering correction model coefficients for the corresponding group and pre-stored in the storage unit of the detection system for direct retrieval based on the grouping results during actual detection.

[0038] It should be noted that the fundamental reason for performing the baseline drift correction and multiplicative light scattering compensation correction mentioned above is that soil physical phenotypic parameters can interfere with the near-infrared diffuse reflectance spectrum through different optical mechanisms, distorting the characteristic absorption signals of organic matter functional groups, and ultimately leading to systematic biases in the spectral inversion results, as detailed below: On the one hand, soil moisture content can cause additive baseline drift in the spectrum. Water molecules exhibit multiple broad-area strong absorption peaks in the near-infrared band. When soil moisture content increases, the absorption effect of water causes an overall shift in the reflectance of the entire spectrum across the same direction, resulting in baseline drift. This drift is an additive interference that is uniformly superimposed on the characteristic absorption signal of organic matter, masking the weak absorption characteristics of organic matter and leading to distortion of the input data for subsequent feature band extraction and model inversion. Therefore, it is necessary to first perform a baseline correction on the entire spectrum to eliminate the overall baseline deviation caused by moisture content and restore the relative absorption characteristics of the spectrum.

[0039] On the other hand, soil particle size and surface roughness can cause multiplicative scattering interference in the spectrum. When near-infrared light incident on the soil surface, it undergoes multiple diffuse reflections and scatterings between soil particles. The finer the particles and the rougher the surface, the longer the light scattering path, and the overall reflectance changes proportionally. Different soil textures exhibit significant differences in particle size distribution, resulting in fundamentally different light scattering mechanisms and intensities. This multiplicative scattering alters the relative amplitude and slope of the characteristic absorption peaks of organic matter, disrupting the quantitative mapping relationship between spectral characteristics and organic matter content. Therefore, a scattering correction coefficient is needed to multiplicatively compensate for the spectrum, eliminating scattering biases caused by particle and surface conditions and restoring the quantitative characteristics of the spectrum.

[0040] Meanwhile, since the optical properties of soil matrix vary significantly among different soil texture groups, a uniform reference parameter cannot be adapted to all soil types. Therefore, a group-specific coefficient set is used for directional correction, which can specifically match the scattering patterns of the corresponding texture and further improve the correction accuracy.

[0041] In this embodiment, S102, as the core spectral preprocessing and correction step of the entire process, overcomes the limitation of the global unified correction algorithm in adapting to the differences in optical properties of different soil textures by designing a set of dedicated scattering correction coefficients through texture clustering and grouping. This ensures the uniformity of correction effects under different types of soil matrices. At the same time, by distinguishing between additive baseline drift and multiplicative scattering interference in a two-step directional correction, the spectral interference introduced by different optical mechanisms for two types of phenotypic parameters, namely moisture content and surface roughness, can be specifically removed. This accurately restores the intrinsic absorption characteristics of organic matter functional groups, effectively improves the signal-to-noise ratio and feature effectiveness of the input spectral data, and provides a clean and reliable data foundation for subsequent feature band weighting and inversion model calculations.

[0042] S103: Extract the organic matter characteristic absorption bands from the corrected spectral data, calculate the weight coefficients of each characteristic band based on the phenotypic physical parameters and perform weighted enhancement, fuse the weighted spectral features with the phenotypic physical parameters at the feature level, input the pre-calibrated partial least squares regression inversion model, and calculate the preliminary detection value of organic matter content of the soil to be tested.

[0043] Furthermore, in the specific implementation of this application, the specific implementation process of S103 is as follows: First, characteristic band extraction is performed. A unique set of organic matter characteristic bands is pre-constructed for each texture group. The construction process is based on the intrinsic absorption peak wavelength range of organic matter functional groups, combined with the soil matrix interference characteristics of the corresponding texture group to complete the band screening: organic matter functional groups such as CH bonds, OH bonds, and NH bonds have fixed characteristic absorption bands in the near-infrared band, mainly distributed around wavelengths such as 1100nm, 1400nm, 1900nm, and 2200nm. On this basis, bands with excessive phenotypic interference and low signal-to-noise ratio of organic matter characteristics under the corresponding texture group are removed. For example, wavelength ranges with excessive scattering noise in the short-wavelength range are removed for sandy soil group, and wavelength ranges that highly overlap with water absorption peaks are removed for clay soil group. Finally, a unique set of characteristic bands for each group is formed. In actual testing, based on the soil texture group determined by S102, the corresponding exclusive characteristic band set is retrieved, and the reflectance data of the corresponding band is extracted from the corrected spectral data output by S102 according to the wavelength position to obtain the organic matter characteristic absorption band data.

[0044] Subsequently, the weighting coefficients of each characteristic band are calculated and weighted enhancement is performed. For each characteristic band in each dedicated characteristic band set, interference sensitivity coefficients corresponding to three phenotypic parameters—moisture content, surface roughness, and particle size—are pre-configured. These coefficients are obtained statistically from calibration experiments and characterize the degree of influence of unit phenotypic parameter changes on the spectral reflectance of that band; the larger the value, the stronger the interference from the corresponding phenotypic parameter. During calculation, the real-time measured values ​​of the soil's moisture content, surface roughness, and particle size are multiplied by the interference sensitivity coefficient of the corresponding characteristic band to obtain the individual interference contribution value of each phenotypic parameter in that band. All individual interference contribution values ​​corresponding to the same characteristic band are summed to obtain the comprehensive phenotypic interference level of that band. An inversely proportional mapping relationship is used to calculate the initial weights of each characteristic band; that is, the higher the comprehensive interference level, the lower the initial weight of the band. The initial weights of all characteristic bands are normalized so that the sum of all weights is 1, yielding the final weighting coefficients of each characteristic band. The spectral reflectance data of each characteristic band is multiplied one by one with the corresponding final weighting coefficient to complete the weighted enhancement processing of the characteristic bands, thereby obtaining the weighted enhanced organic matter spectral features. This strengthens the band signals with weak interference and significant organic matter features, while suppressing the proportion of bands with strong interference and low signal-to-noise ratio.

[0045] Specifically, the method for feature-level fusion and preliminary inversion of organic matter content is as follows: First, the phenotypic physical parameters are standardized. Three quantitative phenotypic parameters obtained from S101—moisture content, particle size, and surface roughness—are selected. Using the min-max normalization method, based on the common field value ranges of each parameter, the values ​​of each parameter are uniformly mapped to the range of 0 to 1, eliminating the dimensional and numerical scale differences of different parameters and obtaining standardized phenotypic features. Then, feature-level fusion is performed. The standardized phenotypic feature vector is concatenated with the aforementioned weighted and enhanced organic matter spectral feature vector in dimensional order to form a multi-source fusion feature vector that simultaneously contains spectral feature information and phenotypic physical attribute information, thus completing the feature-level fusion of phenotypic data and spectral data.

[0046] Finally, the input model completes the initial inversion. The multi-source fused feature vector is input into a pre-calibrated partial least squares regression inversion model that matches the texture group of the soil to be tested. After model calculation, the preliminary detection value of organic matter content of the soil to be tested is directly output. The partial least squares regression inversion model is pre-constructed based on calibrated soil samples of the corresponding texture group: the multi-source fused feature vector of the calibrated sample is used as input, and the true value of organic matter content determined by potassium dichromate volumetric method is used as output label. The feature principal components are extracted by partial least squares regression algorithm and a quantitative mapping relationship is established to complete model training and parameter calibration, ensuring that the model has the ability to quantitatively invert organic matter content under the corresponding texture group.

[0047] In this embodiment, S103, as the core step of spectral feature mining and content inversion, uses feature band screening specific to soil texture groups to selectively eliminate interference bands with low signal-to-noise ratios under different soil textures, accurately locking in effective organic matter feature signals. Combined with an inverse proportional weighted enhancement design based on the degree of phenotypic interference, it can differentiate and strengthen the organic matter features of weakly interfering bands and suppress the noise proportion of strongly interfering bands, avoiding redundant interference introduced by simple feature splicing. Then, through feature-level fusion after phenotypic parameter normalization and partial least squares regression inversion with group matching, it realizes the collaborative modeling of spectral information and soil physical properties, effectively improving the quantitative accuracy and cross-sample generalization ability of the inversion model, outputting reliable preliminary detection values ​​of organic matter content, and providing an accurate calculation benchmark for subsequent residual secondary error compensation.

[0048] S104: Match the corresponding phenotypic-prediction residual correction matrix according to the texture group to which the soil sample to be tested belongs, and calculate the dynamic residual compensation amount according to the relative proportion of water content and particle size in the interval of the phenotypic-prediction residual correction matrix. Perform directional secondary error compensation on the preliminary detection value of organic matter content to obtain the final detection value of organic matter content.

[0049] Furthermore, in the specific implementation of this application, the specific implementation process of S104 is as follows: First, it should be noted that the phenotypic-prediction residual correction matrix is ​​a pre-constructed cluster-specific correction benchmark based on the calibrated sample set. It is independently constructed and pre-stored for each texture cluster and serves as the basis for the calculation of secondary error compensation. Its specific construction process is as follows: For the target soil texture group, multiple sets of calibration soil samples covering the common moisture content range and common particle size range in the field were selected to ensure that the samples were evenly distributed in both the moisture content and particle size dimensions, covering the vast majority of the phenotypic states of the field soil under this group. The true value of organic matter content of all calibration samples was determined by potassium dichromate titration method, and the detection procedures of S101 to S103 of this application were fully implemented to calculate the corresponding preliminary detection value of organic matter content.

[0050] Then, using moisture content as the row dimension and particle size as the column dimension, equal gradient intervals are divided according to the common range of field soil parameters. For example, the common field moisture content of 5%-25% is divided into 4 consecutive gradient intervals, and the median particle size of 0.01mm-0.5mm is divided into 3 consecutive gradient intervals. The number of intervals can be adjusted according to the detection accuracy requirements. Each gradient interval corresponds to a row or column in the matrix, and the interval boundary values ​​are pre-stored as the judgment criteria for interval matching.

[0051] For each combination of moisture content gradient interval and particle size gradient interval, all calibrated samples whose phenotypic parameters fall within that interval are selected. The prediction residual is uniformly defined as "the difference between the preliminary detected value of organic matter content and the true value of organic matter content". The arithmetic mean of the prediction residuals of this group of samples is calculated as the statistical value of the residuals corresponding to the interval combination. The calculated average residual is filled into the intersection of the corresponding row and column of the matrix. The element filling of all interval combinations is completed in sequence, and finally a phenotypic-prediction residual correction matrix specific to this texture group is formed. Each element in the matrix represents the average prediction deviation of the samples in the corresponding phenotypic interval, which can characterize the systematic residual error of the preliminary inversion model under this phenotypic interval.

[0052] After the system is built, the phenotypic-prediction residual correction matrix of each texture group is associated with the group identifier and stored in the storage unit of the detection system for direct retrieval during actual detection.

[0053] Furthermore, the specific method for matrix matching and residual correction benchmark value extraction is as follows: In the actual testing process, the matching and retrieval of the correction matrix and the positioning of the benchmark value are performed first. Based on the texture group of the soil to be tested determined in S102, the specific phenotype-prediction residual correction matrix corresponding to the group is retrieved; the real-time moisture content of the soil to be tested is compared with each gradient interval of the matrix row dimension to determine the row interval to which the moisture content of the sample belongs; the real-time particle size of the soil to be tested is compared with each gradient interval of the matrix column dimension to determine the column interval to which the particle size of the sample belongs; the matrix element at the intersection of the row interval and the column interval, i.e., the average value of the prediction residual of the corresponding interval, is extracted as the residual correction benchmark value.

[0054] Specifically, after extracting the baseline value, the dynamic residual compensation amount and phenotypic adaptation correction coefficient are calculated and compensation is performed: First, the two-parameter interpolation coefficients are calculated. Based on the relative position of the real-time soil moisture content within its row interval, the row-direction interpolation coefficient is calculated as follows: Row-direction interpolation coefficient = (Real-time moisture content - Lower limit of the row interval) / (Upper limit of the row interval - Lower limit of the row interval). Similarly, based on the relative position of the real-time particle size within its column interval, the column-direction interpolation coefficient is calculated as follows: Column-direction interpolation coefficient = (Real-time particle size - Lower limit of the column interval) / (Upper limit of the column interval - Lower limit of the column interval). In this embodiment, an equal-weighted synthesis method is used to take the arithmetic mean of the row-direction and column-direction interpolation coefficients to obtain the two-parameter interpolation coefficients, thereby comprehensively characterizing the deviation of the phenotypic parameters of the tested sample from the interval benchmark.

[0055] Subsequently, the dynamic residual compensation amount and phenotypic adaptation correction coefficient were calculated: the extracted residual correction benchmark value was multiplied by the two-parameter interpolation coefficient to obtain the dynamic residual compensation amount that adapts to the phenotypic state of the soil individual to be tested. This compensation amount is the absolute deviation correction value for the sample to be tested. The ratio of the dynamic residual compensation amount to the preliminary detection value of organic matter content was calculated to obtain the phenotypic adaptation correction coefficient. This coefficient is used to characterize the relative correction magnitude of the dynamic residual compensation amount relative to the preliminary detection value of organic matter content, and can intuitively reflect the degree of correction of the preliminary detection value by this compensation. It should be noted that the phenotypic adaptation correction coefficient corrects the preliminary detection value of organic matter content. When performing targeted secondary error compensation, absolute deviation correction is performed through the dynamic residual compensation amount that corresponds one-to-one with the phenotypic adaptation correction coefficient. That is, by subtracting the dynamic residual compensation amount from the preliminary detection value of organic matter content, the relative proportional correction effect quantified by the phenotypic adaptation correction coefficient is obtained, thus eliminating the residual phenotypic interference deviation in the preliminary detection value of organic matter content. The phenotypic adaptation correction coefficient itself, as a relative quantitative indicator, can intuitively reflect the adjustment intensity of this secondary compensation on the preliminary detection result, and can also serve as an auxiliary quantitative basis for determining the reliability of subsequent detection results.

[0056] Finally, error compensation calculation is performed: the dynamic residual compensation amount is subtracted from the preliminary detection value of organic matter content output by S103 to eliminate the residual prediction bias introduced by individual phenotypic differences within the same population in the preliminary detection value, and the directional secondary error compensation for phenotypic adaptation is completed to obtain the final detection value of organic matter content.

[0057] It is important to clarify that the core reason for performing directional secondary error compensation is that spectral scattering correction and feature-weighted fusion inversion can only eliminate phenotypic interference at the signal input layer and feature modeling layer, and cannot completely eliminate the systematic prediction bias remaining at the model output due to individual phenotypic differences within the same phenotypic population. Secondary compensation, on the other hand, performs directional correction of residual bias at the result output layer, forming a three-level closed-loop correction system of "signal purification - feature optimization - result calibration." Its logic is based on the hierarchy, statistical regularity, and compensability of residual errors. Logically, the core objective of the pre-correction is to "eliminate input interference and restore the intrinsic spectral characteristics of organic matter," and its target is the spectral data itself. The core objective of secondary compensation is to "correct the systematic shift in the model output," and its target is the inversion result value. The two have different levels of action and different correction targets, and there is no functional overlap. Instead, they form a complete correction link from signal to result, which can further compress detection errors and improve the uniformity of detection accuracy across the entire phenotypic range without changing the pre-correction model architecture.

[0058] In this embodiment, S104 serves as the precise calibration step at the result end of the entire detection process. It anchors the systematic residual bias of the preliminary inversion model under different phenotypic intervals within the same phenotypic group by using a pre-constructed phenotypic-prediction residual calibration matrix specific to each phenotypic group. It calculates the two-parameter interpolation coefficients by combining the relative proportions of the moisture content and particle size of the sample under test within the corresponding intervals, generating a dynamic residual compensation amount that is adapted to the individual phenotypic state. This can specifically eliminate the nonlinear residual prediction error that cannot be fully covered by the preceding spectral scattering correction and feature-weighted inversion, breaking through the accuracy limit of the two-stage front-end calibration. At the same time, this step complements the signal domain scattering correction in S102 and the feature domain weighted modeling in S103, constructing a three-stage closed-loop calibration system of "signal purification - feature optimization - result calibration". This effectively smooths out the fluctuations in detection accuracy under different phenotypic states and improves the balance of detection results across the entire phenotypic interval and the adaptability to the field environment.

[0059] To verify the logical rationality and feasibility of the directional secondary error compensation mechanism in step S104, the core verification objectives include: First, verifying that within homogeneous material clusters, the prediction residuals of the preliminary inversion model exhibit a stable statistical correlation with the phenotypic parameters of moisture content and particle size, providing objective data for the construction of the residual correction matrix; Second, verifying the feasibility of constructing a two-dimensional interval matrix with moisture content gradient as rows and particle size gradient as columns, where matrix elements can be obtained through residual statistics of calibrated samples; Third, verifying that a systematic residual bias still exists after prior spectral scattering correction and feature-weighted inversion, varying with phenotypic changes, thus demonstrating the technical necessity of setting up a secondary error compensation step. Specific verification instructions and data analysis are as follows: Table 1 - Loamy soil group phenotype - Prediction residual correction matrix (mean of prediction residual, g / kg)

[0060] As shown in Table 1, the prediction residuals exhibit a significant increasing trend with increasing moisture content, with the row mean rising from 0.57 g / kg in the 5-10% range to 2.73 g / kg in the 20-25% range. Furthermore, the residual levels vary across different particle size ranges at the same moisture content, with the residuals in the 0.05-0.25 mm particle size range being generally higher than those in the coarse and fine particle size ranges. This directly confirms that the systematic residual bias of the preliminary inversion model within the same soil group is highly correlated with both moisture content and particle size parameters and possesses stable statistical characteristics. This pattern verifies that the design of constructing a cluster-specific residual correction matrix using a two-dimensional gradient interval is supported by objective data, accurately anchoring the residual bias levels under different phenotypic combinations. This provides a reliable correction benchmark for subsequent two-parameter interpolation calculations of dynamic compensation, ensuring the accuracy of directional secondary error compensation and effectively mitigating nonlinear residual errors that cannot be covered by previous corrections.

[0061] S105: Match the accuracy verification interval corresponding to the phenotypic parameters of the soil sample to be tested, output the final organic matter content detection value, and simultaneously label the relative error range and confidence level corresponding to the detection value.

[0062] Furthermore, in the specific implementation of this application, the specific implementation process of S105 is as follows: A precision verification interval lookup table is pre-constructed. This table is a dedicated precision mapping benchmark independently constructed for each texture group. Its texture grouping rules, moisture content, and particle size gradient interval division standards are completely consistent with the division rules of the phenotypic-prediction residual correction matrix in S104, ensuring the uniformity of phenotypic matching dimensions throughout the entire process. The specific construction process is as follows: First, sample error statistics are performed: For each texture group, the same calibration sample set with a residual correction matrix is ​​used to perform the full-process detection of S101 to S104 of this application on all calibration samples to obtain the final organic matter content detection value of each sample; combined with the true value of organic matter content determined by potassium dichromate titration method for each sample, the relative error is calculated for each sample. The calculation method of relative error is: relative error = |final organic matter content detection value - true value of organic matter content| / true value of organic matter content × 100%.

[0063] Next, the error range of each interval is determined: according to the moisture content gradient interval and particle size gradient interval that are completely corresponding to the residual correction matrix, all calibration samples are assigned to the corresponding interval combination; for each interval combination, the distribution data of the relative error of all samples in the group are statistically analyzed, and the lower limit and upper limit of the relative error at a 95% confidence level are taken as the preset relative error range corresponding to the interval combination. This range can characterize the error fluctuation range of the detection results under the corresponding phenotypic state.

[0064] Finally, credibility level mapping and matching are performed: a unified credibility level classification rule is pre-defined. In this embodiment, the credibility level is divided into three levels: interval combinations with a relative error range upper limit not exceeding 3% correspond to level 1 credibility; interval combinations with a relative error range upper limit greater than 3% but not exceeding 6% correspond to level 2 credibility; and interval combinations with a relative error range upper limit greater than 6% correspond to level 3 credibility. Based on this classification rule, the corresponding credibility level is matched for each interval combination in the lookup table to complete the filling of all content.

[0065] After the system is built, the accuracy verification interval comparison table of each texture group is associated with the corresponding group identifier and stored in the storage unit of the detection system. The table synchronously records the boundary values ​​of each gradient interval, the corresponding relative error range and the confidence level, so that they can be directly retrieved during actual detection.

[0066] Specifically, the methods for precision interval matching and index extraction are as follows: In the actual testing process, firstly, based on the texture group of the soil to be tested determined in S102, the corresponding exclusive accuracy verification interval reference table is retrieved; the real-time moisture content and real-time particle size parameters of the soil to be tested are compared one by one with the gradient interval boundary values ​​in the reference table to determine the moisture content interval and particle size interval to which the sample to be tested belongs, and locate the corresponding phenotypic dimension combination; the relative error range and confidence level corresponding to the dimension combination are extracted from the reference table as the accuracy quantitative characterization index of this test result.

[0067] Finally, while outputting the final organic matter content detection value obtained after S104 correction, the relative error range and confidence level extracted above are simultaneously labeled in the detection results. In this embodiment, the labeling adopts a combination of numerical values ​​and text, with the corresponding error range and level label attached after the organic matter content detection value. For example, the output format is "Organic matter content: 18.2g / kg, relative error range: 2.1%-3.5%, confidence level: Level 2", so that the detection results and reliability information are presented simultaneously, which makes it convenient for field testing personnel to directly carry out subsequent work such as farmland fertility evaluation and fertilization plan formulation based on the results.

[0068] In this embodiment, S105 serves as the result output and reliability quantification step of the entire detection process. By employing a cluster-specific accuracy verification interval comparison table consistent with the dimension of the phenotypic-prediction residual correction matrix, it matches the relative error range and confidence level of the corresponding interval based on the phenotypic parameters of the soil to be tested, such as moisture content and particle size, to achieve the synchronous output of the final organic matter content detection value and accuracy quantification information. This design breaks through the limitations of traditional soil spectral detection, which only outputs a single content value and cannot quantify the reliability of the result. It allows testing personnel to intuitively determine the confidence level and decision reference value of the result. At the same time, its phenotypic interval accuracy mapping forms a complete logical closed loop with the technical system of prior cluster scattering correction, feature weighted inversion, and directional secondary compensation. The error labeling is highly matched with the actual detection accuracy, effectively improving the practicality of the detection results in actual scenarios such as field in-situ screening, farmland fertility evaluation, and soil testing and formula fertilization.

[0069] To verify the rationality and data support of the clustered dual-dimensional precision annotation mechanism proposed in step S105 of this application, and to verify the influence of soil phenotypic parameters on detection accuracy, the following verification and data analysis are provided to support the actual effect of the full-process hierarchical correction architecture from the results perspective: Table 2 - Comparison Table of Accuracy Verification Intervals for Loamy Soil Grouping

[0070] As shown in Table 2, the relative error range of the detection generally increases with increasing moisture content, and the error levels differ among different particle size ranges at the same moisture content. This directly confirms that moisture content and particle size are the core phenotypic factors affecting detection accuracy, thus supporting the necessity of the design in this application to perform directional scattering correction and residual secondary compensation for different phenotypic ranges, and to label the errors in different ranges. The relative error range and confidence level of each range in the table are determined based on the measured statistical results of the full-process detection of the calibration samples. The grading rules strictly correspond to the error distribution, ensuring that the accuracy labeling has objective data support and reproducibility. At the same time, the confidence level is directly linked to the reference value for field fertilization decisions, which can transform the quantitative accuracy indicators into clear application guidelines, adapting to the decision-making needs of in-situ field detection scenarios such as farmland fertility screening and soil testing for fertilizer formulation, effectively improving the engineering practical value of the detection results.

[0071] Please see Figure 2 , Figure 2 The figure shows the spectral changes of three typical soil textures (sandy soil, loamy soil, and clay soil) before directional multivariate scattering correction. As can be seen from the figure, there are significant differences in the spectral curves of different soil textures before correction: clay soil has a higher overall reflectance and obvious baseline drift due to its high water content and fine particles; sandy soil has stronger scattering noise due to its coarse particles and rough surface.

[0072] Please see Figure 3 As shown in Figure 3, after the directional multivariate scattering correction applied in this application, the spectral curves of the three soil textures tend to be consistent, baseline drift is effectively eliminated, and multiplicative scattering interference is significantly suppressed. Particularly at the organic matter characteristic absorption peaks at 1400 nm (OH bond), 1900 nm (H2O), and 2200 nm (CH bond), the corrected spectral features are clearer, providing a high-quality spectral data foundation for subsequent feature extraction and inversion modeling. A comparison of the two figures reveals that before scattering correction, the spectral reflectance difference between different soil textures could reach 15-20%; after correction, the difference was reduced to 3-5%. The baseline drift caused by water content was effectively eliminated, particularly near the 1900 nm water absorption peak, and the multiplicative scattering interference caused by surface roughness was specifically compensated for, restoring the quantitative spectral features.

[0073] Please see Figure 4 , Figure 4 (a) Heatmap of the phenotypic-prediction residual correction matrix for sandy soil clusters. Figure 4 (b) Heatmap of the phenotypic-prediction residual correction matrix for loam soil groups. Figure 4(c) is a heat map of the phenotypic-prediction residual correction matrix for clay soil groups, corresponding to the group-specific residual correction benchmark pre-constructed in step S104 of this application. All values ​​in the matrix are the average residuals between the preliminary predicted values ​​and the laboratory true values ​​of organic matter content of the calibrated samples within the corresponding moisture content and particle size ranges, in g / kg. This set of graphs is used to verify the distribution law of prediction residuals within the same soil group, the technical necessity of constructing the group-specific matrix, and the objective data basis for directional secondary error compensation, supporting the feasibility and rationality of the S104 scheme.

[0074] Depend on Figure 4 (a) The heatmap of the phenotypic-prediction residual correction matrix of sandy soil groups shows that the prediction residuals of sandy soil groups generally increase monotonically with increasing moisture content: in the low moisture content range of 5-10%, the residuals of each particle size range are 0.6-1.2 g / kg, with a relatively low overall deviation level; in the high moisture content range of 20-25%, the residuals rise to 2.8-4.5 g / kg, with the residual in the medium particle size range of 0.05-0.25 mm reaching the maximum value of 4.5 g / kg. From the perspective of particle size, at the same moisture content, the residuals of the medium particle size range are generally higher than those of the coarse and fine particle size ranges, showing a distribution characteristic of high in the middle and low on both sides.

[0075] This pattern matches the optical characteristics of sandy soil particles with large porosity and the significant impact of moisture changes on light scattering paths, proving that there is a stable correspondence between residuals and moisture content and particle size within the sandy soil group, and that it is not random noise without any pattern. The systematic deviation can be accurately anchored by a two-dimensional gradient matrix, providing a reliable benchmark for subsequent interpolation calculations of dynamic compensation.

[0076] Depend on Figure 4 (b) The heat map of the phenotypic-prediction residual correction matrix of loam soil group shows that the overall residual level of loam soil group is lower than that of sandy soil and clay soil. The residual in the 5-10% moisture content range is only 0.4-0.8 g / kg, and the residual in the 20-25% high moisture content range is 2.2-3.5 g / kg, which also shows the law of increasing with increasing moisture content. In terms of particle size, the residual in the 0.05-0.25 mm particle size range is the highest, which is consistent with the distribution law of sandy soil but the overall amplitude is lower.

[0077] This result corresponds to the characteristics of loam soil with uniform particle size distribution and stable matrix optical properties, indicating that after pre-scattering correction and feature weighting, the residual deviation of loam soil is minimized overall; it also verifies that the residual distribution law has common statistical characteristics in different soil groups, and the matrix construction method of this application has cross-group universality.

[0078] Depend on Figure 4(c) The heat map of the phenotypic-prediction residual correction matrix of clay soil group shows that the overall residual level of clay soil group is the highest among the three soil types. The residual in the 5-10% low moisture content range is 1.0-1.8 g / kg, and the residual in the 20-25% high moisture content range reaches 3.5-5.5 g / kg. The maximum value appears at the combination of 0.05-0.25 mm particle size and 20-25% moisture content, reaching 5.5 g / kg.

[0079] This is because clay particles are small and have a large specific surface area, resulting in stronger binding between water molecules and soil particles. This leads to more significant nonlinear modulation of the spectral characteristics of organic matter, making it difficult to completely eliminate the residual bias through preceding linear scattering correction. This result directly demonstrates the fundamental differences in residual bias levels among soils of different textures. Using a uniform residual correction matrix would lead to poor correction fit, undercorrection, or overcorrection of some soils, further supporting the technical necessity of employing a group-specific residual correction matrix in this application.

[0080] In summary, the residual matrices of the three texture groups all exhibit a stable statistical law that "the residual increases with increasing moisture content, and the residual is higher in the medium-sized grain size range at the same moisture content." Moreover, the overall amplitude of the residuals of different texture groups differs significantly, proving that the predicted residuals are a systematic bias strongly correlated with phenotypic parameters. This provides objective data support for the directional secondary error compensation based on the residual matrix in this application S104. At the same time, the differentiated residual levels of the groups also verify the rationality of the design of texture clustering and the correction parameters configured for the groups, which can ensure that soils of different textures obtain appropriate compensation effects.

[0081] Please see Figure 5 , Figure 5 This is a bar chart showing the weighting coefficients of the core characteristic bands of organic matter for three soil texture groups: sandy soil, loamy soil, and clayey soil. This corresponds to the band weighting enhancement step based on the degree of phenotypic interference in step S103 of this application. The weighting coefficients are calculated and normalized according to the rule of "negative correlation with the overall degree of phenotypic interference." This set of charts is used to verify the technical rationality of group-specific characteristic band selection and phenotypic-driven weighting enhancement.

[0082] Analysis of the distribution of the weight coefficients of the characteristic bands of organic matter in the sandy soil group shows that the 1100nm C-H bond characteristic band has the highest weight at 0.32; the 1400nm O-H bond band is second at 0.28; the 1900nm water absorption band has the lowest weight at only 0.18; and the 2200nm C-H bond band has a weight of 0.22.

[0083] This distribution closely matches the optical properties of sandy soil: sandy soil has coarse particles and strong scattering effects, resulting in high scattering noise in the short-wavelength band. However, the 1100nm band exhibits significant organic functional group characteristics and is relatively less affected by scattering interference, thus receiving the highest weight. The 1900nm band highly overlaps with the absorption peak of water molecules, exhibiting strong phenotypic interference and a low signal-to-noise ratio for organic characteristics, therefore receiving the lowest weight. This weight distribution directly confirms the weighting rule of this application: "the stronger the interference, the lower the weight," which effectively suppresses the noise contribution of strong interference bands and enhances the signal proportion of effective features.

[0084] Analysis of the distribution of the weight coefficients of the characteristic bands of organic matter in loam soil groups shows that the 1400nm O-H bond characteristic band has the highest weight (0.30); the 1100nm C-H bond band and the 2200nm C-H bond band have weights of 0.25 and 0.23, respectively; and the 1900nm water absorption band has the lowest weight (0.22).

[0085] Compared to sandy soils, loam exhibits smaller differences in weight distribution across bands and a more balanced distribution. This is attributed to the reasonable particle size distribution, stable matrix optical properties, smaller differences in phenotypic interference levels across bands, and generally higher signal-to-noise ratios for organic matter characteristics in loam. These results demonstrate that the weighting mechanism adaptively adjusts the weight allocation based on the actual interference characteristics of the clusters, rather than using fixed weights, reflecting the adaptability advantage of cluster-specific weighting designs.

[0086] Analysis of the distribution of the characteristic band weight coefficients of organic matter in the clay soil group shows that the 1900nm water absorption band has the highest weight (0.30); the weights of the 1400nm O-H bond and 2200nm C-H bond bands are both 0.25; and the weight of the 1100nm C-H bond band is the lowest (0.20).

[0087] This distribution differs significantly from that of sandy soils because clay soils have fine particles, large specific surface areas, and weak short-wavelength scattering effects, but high water-bound content. While the 1900nm band is affected by water, the organic matter in clay soils is tightly bound to water molecules, thus this band carries more information about the organic matter's bound state, resulting in a higher overall signal-to-noise ratio and therefore receiving the highest weight. In contrast, the short-wavelength bands are more strongly affected by absorption by clay minerals, leading to a lower weight. This result directly demonstrates the fundamental differences in the characteristic band interference characteristics of different soil textures, proving that a uniform band weight cannot be applied to all soil types. This underscores the technical necessity of the group-specific feature screening and differentiated weighting techniques proposed in this application.

[0088] In summary, the characteristic band weight distributions of the three texture groups show significant differences. The weight allocation is highly matched with the phenotypic interference characteristics of each group, strictly following the calculation rule that "the degree of interference is negatively correlated with the weight," thus verifying the reproducibility and rationality of the S103 band weighted enhancement scheme of this application. The differentiated weight design of the groups can specifically enhance the organic matter features with strong characterization and high signal-to-noise ratio under the corresponding texture, suppress the noise transmission of strong interference bands, and improve the accuracy and generalization ability of the inversion model from the feature input level.

[0089] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.

[0090] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0091] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for detecting soil organic matter based on phenotypic and spectral analysis, characterized in that, include: S101: Detect the phenotypic physical parameters of the soil sample to be tested, including particle size, moisture content, texture type and surface roughness. Perform near-infrared diffuse reflectance spectral scanning on the soil sample to be tested to obtain raw spectral reflectance data across the entire band. S102: Based on the phenotypic physical parameters, the soil to be tested is clustered into texture groups to determine the texture group to which the soil to be tested belongs. The scattering correction model coefficients of the corresponding groups are matched and retrieved. The spectral scattering correction coefficients are calculated based on the scattering correction model coefficients. Phenotypic constraints are applied to the original spectral reflectance data to obtain the corrected spectral data. S103: Extract the organic matter characteristic absorption bands from the corrected spectral data, calculate the weight coefficients of each characteristic band based on the phenotypic physical parameters and perform weighted enhancement, fuse the weighted spectral features with the phenotypic physical parameters at the feature level, input the pre-calibrated partial least squares regression inversion model, and calculate the preliminary detection value of organic matter content of the soil to be tested. S104: Match the corresponding phenotypic-prediction residual correction matrix according to the texture group to which the soil sample to be tested belongs, and calculate the dynamic residual compensation amount according to the relative proportion of water content and particle size in the interval of the phenotypic-prediction residual correction matrix. Perform directional secondary error compensation on the preliminary detection value of organic matter content to obtain the final detection value of organic matter content. S105: Match the accuracy verification interval corresponding to the phenotypic parameters of the soil sample to be tested, output the final organic matter content detection value, and simultaneously label the relative error range and confidence level corresponding to the detection value.

2. The method according to claim 1, characterized in that, Obtain the phenotypic physical parameters and raw spectral reflectance data of the sample across the entire wavelength range, specifically including: First, the surface of the soil sample to be tested is leveled and impurities are removed. Then, phenotypic physical parameters and near-infrared diffuse reflectance spectroscopy are simultaneously detected in the same pretreated surface area. Among the phenotypic physical parameters, particle size, moisture content, and surface roughness are determined by quantitative physical detection methods, and the texture type is determined according to the particle size distribution results and the general soil texture classification standard. The same soil sample is scanned N times to obtain N spectral curves. The arithmetic mean of the reflectance obtained from the repeated scans is taken at each wavelength, and the obtained average spectrum is used as the original full-band spectral reflectance data of the sample. N is a positive integer greater than 2.

3. The method according to claim 1, characterized in that, Determine the texture group to which the soil to be tested belongs, and retrieve the scattering correction model coefficients for the corresponding group. Specifically, this includes: Using particle size distribution, moisture content, and surface roughness as clustering features, unsupervised texture clustering was performed on the soil samples, and the clustering results were mapped and matched with preset texture type labels. Each texture group has a corresponding set of exclusive scattering correction model coefficients. The corresponding coefficient set is retrieved according to the texture group to which the soil to be tested belongs. Based on the clustering results, the soil samples to be tested are classified into their original corresponding texture groups, and the set of coefficients of the dedicated scattering correction model pre-established for that texture group is retrieved.

4. The method according to claim 3, characterized in that, Calculate the spectral scattering correction coefficients, perform phenotypic-constrained directional multivariate scattering correction on the original spectral reflectance data, and obtain the corrected spectral data, specifically including: The scattering correction model coefficient set includes the standard reference spectrum, baseline reference parameters, and scattering reference parameters corresponding to the texture group; Using the standard reference spectrum as the calibration reference, the baseline correction amount is calculated in combination with the real-time moisture content of the soil to be tested, and the scattering correction coefficient is calculated in combination with the surface roughness of the soil to be tested. The baseline correction amount and the scattering correction coefficient together constitute the dynamic correction factor. Based on the dynamic correction factor, baseline drift correction is performed on the original spectral reflectance data to eliminate the overall spectral translation deviation caused by soil moisture content; Multiplicative light scattering compensation correction is performed on the baseline-corrected spectral data to eliminate spectral multiplicative scattering interference caused by surface roughness, resulting in corrected spectral data.

5. The method according to claim 4, characterized in that, Extract the characteristic absorption bands of organic matter from the corrected spectral data, calculate the weighting coefficients of each characteristic band based on phenotypic physical parameters, and perform weighted enhancement. Specifically, this includes: Pre-configure a set of exclusive characteristic bands for the characteristic absorption peaks of the organic functional groups of each texture group; Based on the texture group of the soil to be tested, the corresponding exclusive characteristic band set is retrieved, and the organic matter characteristic absorption band data is extracted from the corrected spectral data. The degree of phenotypic interference corresponding to each characteristic band is calculated based on the phenotypic physical parameters of the soil to be tested, and the weight coefficient of each characteristic band is determined by the rule that is negatively correlated with the degree of interference. Based on the weighting coefficients, the spectral reflectance data of the corresponding characteristic bands are subjected to weighted enhancement processing to obtain the weighted enhanced spectral features of organic matter.

6. The method according to claim 5, characterized in that, The preliminary test values ​​of organic matter content in the soil to be tested are obtained, including: The phenotypic physical parameters are normalized to obtain standardized phenotypic features. The standardized phenotypic features are then combined with the weighted and enhanced organic matter spectral features according to their dimensions to form a multi-source fusion feature vector. The multi-source fusion feature vector is input into a pre-calibrated partial least squares regression inversion model that matches the soil texture group to calculate and output the preliminary detection value of organic matter content of the soil to be tested.

7. The method according to claim 1, characterized in that, Based on the texture group to which the soil sample belongs, the corresponding phenotypic-prediction residual correction matrix is ​​matched, specifically including: A dedicated phenotypic-prediction residual correction matrix is ​​pre-constructed for each texture group. The phenotypic-prediction residual correction matrix has the water content gradient interval as the row dimension and the particle size gradient interval as the column dimension. Each element in the matrix is ​​the average predicted residual of organic matter content of the calibrated sample of the corresponding texture group within the corresponding phenotypic parameter interval. Based on the texture group to which the soil to be tested belongs, retrieve the corresponding phenotypic-prediction residual correction matrix; Based on the real-time moisture content and particle size parameters of the soil to be tested, the corresponding row and column intervals in the matrix are located, and the average value of the predicted residuals at the corresponding positions is extracted as the residual correction benchmark value for subsequent directional secondary error compensation.

8. The method according to claim 7, characterized in that, Calculate the phenotypic adaptation correction coefficient, perform directional secondary error compensation on the preliminary organic matter content detection value, and obtain the final organic matter content detection value, specifically including: The two-parameter interpolation coefficients are calculated based on the relative proportion of the real-time soil moisture content in the row interval of the matrix and the relative proportion of the real-time particle size in the column interval of the matrix. The extracted residual correction benchmark value is multiplied by the two-parameter interpolation coefficient to obtain the dynamic residual compensation amount adapted to the soil to be tested. The ratio of the dynamic residual compensation amount to the preliminary detection value of organic matter content is determined as the phenotypic adaptation correction coefficient after amplitude limiting mapping. The phenotypic adaptation correction coefficient is then used to correct the amplitude of the dynamic residual compensation amount to obtain the final detection value of organic matter content.

9. The method according to claim 1, characterized in that, Output the final organic matter content detection value, and simultaneously label the corresponding relative error range and confidence level of the detection value, specifically including: A dedicated accuracy verification interval comparison table is pre-constructed for each texture group. The comparison table uses the moisture content gradient interval and the particle size gradient interval as matching dimensions. Each matching dimension combination corresponds to a set of preset relative error ranges and confidence levels. Based on the texture group of the soil to be tested, retrieve the corresponding accuracy verification interval reference table, combine the real-time moisture content and particle size parameters of the soil to be tested, locate the corresponding matching dimension combination, and extract the relative error range and confidence level corresponding to the combination. Output the final organic matter content detection value, and simultaneously label the extracted relative error range and confidence level in the detection results.