A soil organic matter measurement method, device, equipment and medium

CN122944329APending Publication Date: 2026-10-20BEIJING RES CENT FOR INFORMATION TECH & AGRI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611061287.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-16
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

然而,现有光谱反演方法受多种因素干扰,精度和稳定性有待提升,且同样无法实现土壤有机质含量的快速测定

Benefits of technology

[0011]本发明实施例采用成本低廉且较易获取的数据源——RGB图像,精度提升不再依赖多光谱和高光谱手段,而是土壤有机质轻量型可解释深度学习模型来实现,无需依赖实验室或其他复杂设备,可由便携式手持仪独立完成有机质含量检测,用户手持便携式手持仪现场便可得到有机质含量检测结果,大幅度提高了有机质含量的检测效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This invention discloses a method, apparatus, device, and medium for measuring soil organic matter. The method includes: acquiring soil images at sampling points using a camera sensor, and preprocessing the soil images to obtain image features; inputting the image features and user-inputted soil information as input features into a locally deployed lightweight interpretable deep learning model for soil organic matter, thereby obtaining the organic matter content of the soil at the sampling point and the contribution of the input features; and displaying the organic matter content and the contribution of the input features on-site. This invention can improve the detection efficiency of soil organic matter content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of soil management technology, and in particular to a method, apparatus, equipment and medium for measuring soil organic matter. Background Technology

[0002] Soil organic matter is a core component of soil and a key indicator of soil fertility. It directly affects the soil's ability to retain and supply nutrients, its aeration and water permeability, and crop growth and development, and is closely related to improving grain production capacity, protecting arable land quality, and promoting sustainable agricultural development. Against the backdrop of the national strategy of vigorously promoting arable land protection and food security, accurately obtaining soil organic matter content is of great significance for scientifically guiding agricultural production, optimizing fertilization management, and improving soil quality. Accurate inversion of soil organic matter content is an important prerequisite for achieving efficient utilization of soil resources and refined agricultural management.

[0003] Currently, traditional methods for determining soil organic matter content mainly rely on laboratory chemical analysis, such as the potassium dichromate oxidation-external heating method. This method involves collecting soil samples, processing them through air drying, grinding, and digestion, and then using chemical reagents to determine the organic matter content. While this method offers high accuracy, it suffers from drawbacks such as time-consuming and labor-intensive sample collection, cumbersome experimental procedures, long analysis cycles, high costs, and difficulty in achieving large-scale rapid monitoring. Consequently, it fails to meet the demands of modern agriculture for real-time soil information acquisition.

[0004] To achieve rapid determination of soil organic matter, inversion methods based on spectroscopic techniques (such as visible-near-infrared spectroscopy) have been widely used in recent years. By acquiring soil reflectance spectral information using a spectrometer and combining it with chemometric methods to establish a correlation model between spectral characteristics and organic matter content, rapid estimation of organic matter content can be achieved. However, existing spectroscopic inversion methods are susceptible to interference from various factors, and their accuracy and stability need improvement; furthermore, they cannot achieve rapid determination of soil organic matter content. Summary of the Invention

[0005] This invention provides a method, apparatus, equipment, and medium for measuring soil organic matter, thereby improving the detection efficiency of soil organic matter content.

[0006] According to one aspect of the present invention, a method for measuring soil organic matter is provided, comprising: Soil images of the soil at sampling points are acquired using a camera sensor, and the soil images are preprocessed to obtain image features. The image features and user-inputted soil information are used as input features to a locally deployed lightweight interpretable deep learning model for soil organic matter, thereby obtaining the soil organic matter content at the sampling point and the contribution of the input features. The organic matter content and the contribution of the input features are displayed on-site.

[0007] According to another aspect of the present invention, a soil organic matter measuring device is provided, comprising: The image processing module is used to acquire soil images of the soil at the sampling point through a camera sensor, and to preprocess the soil images to obtain image features; The content detection module is used to input the image features and user-inputted soil information as input features into a locally deployed lightweight interpretable deep learning model for soil organic matter, so as to obtain the organic matter content of the soil at the sampling point and the contribution of the input features. The results display module is used to display the organic matter content and the contribution of the input features on-site.

[0008] According to another aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method for measuring soil organic matter according to any embodiment of the present invention.

[0009] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the soil organic matter measurement method according to any embodiment of the present invention.

[0010] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the method for measuring soil organic matter according to any embodiment of the present invention.

[0011] The embodiments of this invention use RGB images, a low-cost and readily available data source. The accuracy improvement no longer relies on multispectral and hyperspectral methods, but is achieved through a lightweight and interpretable deep learning model for soil organic matter. It does not require a laboratory or other complex equipment and can independently complete the organic matter content detection with a portable handheld device. Users can obtain the organic matter content detection results on-site with the portable handheld device, which greatly improves the detection efficiency of organic matter content.

[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0013] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0014] Figure 1A This is a flowchart of a method for measuring soil organic matter according to an embodiment of the present invention; Figure 1B This is a schematic diagram of the training process of a lightweight interpretable deep learning model for soil organic matter according to an embodiment of the present invention; Figure 2A This is a flowchart of a method for measuring soil organic matter according to another embodiment of the present invention; Figure 2B This is a schematic diagram of a straw area before removal, provided by another embodiment of the present invention; Figure 2C This is a schematic diagram of a straw area before removal, provided by another embodiment of the present invention; Figure 2D This is a schematic diagram of the outline of soil aggregate particles according to another embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a soil organic matter measuring device according to another embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device that implements an embodiment of the present invention. Detailed Implementation

[0015] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0016] It should be noted that the terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0017] To facilitate understanding of the problems of the prior art, before introducing the embodiments of the present invention, some problems of the prior art are analyzed as follows: (1) Most existing methods for determining soil organic matter content use laboratory chemical analysis. This method is highly accurate and reliable, and is a classic standard in the industry. However, it requires a series of cumbersome procedures such as field sampling, sample drying, grinding, and digestion. This is not only time-consuming and labor-intensive with a long analysis cycle, but also has high detection costs. It is difficult to achieve rapid monitoring of soil organic matter over a large area and cannot meet the needs of modern agriculture for real-time acquisition of soil information.

[0018] (2) Existing soil organic matter inversion methods based on spectroscopic technology acquire soil reflectance spectra by spectrometer and combine them with modeling algorithms to achieve rapid determination, which is significantly more efficient than traditional chemical analysis. However, they do not effectively eliminate the spectral interference of residual straw in the field. The mixed spectrum of straw and soil will mask the spectral characteristics of organic matter in the soil itself, especially in straw-covered areas, which can easily lead to deviations in the organic matter content inversion results and make it difficult to guarantee the accuracy of the determination.

[0019] (3) Existing spectral inversion methods are insufficient in correcting for spectral variations caused by changes in soil moisture in practical applications. Moisture can significantly alter the reflectance properties of soil, resulting in soils with the same organic matter content exhibiting different spectral responses under different soil moisture conditions, thus affecting the stability of the model. (4) Existing soil organic matter inversion methods ignore the modulation effect of soil aggregate structure on spectral characteristics. The particle size distribution and pore structure of aggregates will change the scattering and absorption path of light, making the inversion model based on the homogeneity assumption poorly adaptable to complex soil structures, further affecting the universality and accuracy of the inversion results.

[0020] The measurement method provided by this invention, compared with existing spectral inversion methods, effectively solves the problems of "many interfering factors and poor model stability" by specifically removing straw, correcting moisture, and integrating aggregate characteristics. It also proposes the Soil Particle Aggregation Index (SOILPAI) and an improved lightweight interpretable deep learning model (Mobile-DeepSHAP-EfficientNet), which significantly improves the accuracy and applicability of soil organic matter remote sensing inversion. This provides an effective technical approach for rapid and accurate monitoring of soil organic matter in the field and has important practical significance for farmland quality assessment and precision agricultural management.

[0021] Figure 1A This is a flowchart illustrating a method for measuring soil organic matter according to an embodiment of the present invention. This embodiment is applicable to situations where a user holds a portable handheld device with organic matter content detection capabilities to test soil organic matter in the field. The method can be executed by a soil organic matter measuring device, which can be implemented in hardware and / or software. This device can be configured in an electronic device with corresponding data processing capabilities, such as a portable handheld device. Figure 1A As shown, the method includes: S110. Soil images of the soil at the sampling point are acquired through a camera sensor, and the soil images are preprocessed to obtain image features.

[0022] S120. Input the image features and user-inputted soil information as input features into a locally deployed lightweight interpretable deep learning model for soil organic matter, and obtain the soil organic matter content at the sampling point and the contribution of the input features.

[0023] S130. Display the organic matter content and the contribution of the input features on-site.

[0024] Specifically, the portable handheld device is equipped with an RGB camera sensor, a spatial 3D coordinate sensor, and a laser rangefinder sensor. The imaging CCD of the RGB camera sensor has three channels with a spectral response range covering the 400-700 nm band. Filter material is also added to the CMOS, enabling it to acquire three bands within the 400-700 nm band, with 2048 × 2048 pixels per band and a field of view of 28°. Considering the special characteristics of the soil and the spectral differences with interfering ground objects, the specific bands are as follows: Blue band (B) - 465-530 nm, 1 band; Green band (G) - 530-580 nm, 1 band; Red band (R) - 630-670 nm, 1 band, for a total of 3 bands. The spatial three-dimensional coordinate sensor uses a satellite signal receiving unit to synchronously acquire the three-dimensional coordinates (longitude, latitude, and elevation) of the sampling points. It synchronizes with the RGB camera through the GPIO interface (error ≤ 1ms) to automatically associate the three-dimensional spatial coordinates with the soil image.

[0025] In the target testing area, the user manually places the portable handheld device horizontally above the soil at the sampling point (approximately 1 m). Observe the level indicator and adjust it until the bubble is centered to ensure the device is perfectly level. Click the "Sampling" button to activate the laser rangefinder and begin collecting distance data (H). Based on the distance from the device to the soil surface of the target testing area measured by the laser rangefinder, and combined with the field of view angle of the RGB camera sensor (α = 28°), the portable handheld device performs real-time calculations according to the area measurement formula for the target testing area, thereby measuring the area of ​​the target testing area—S. The main steps include: selecting the testing area location, adjusting the device to a horizontal position, measuring the target distance, and calculating the area of ​​the target testing area.

[0026] S = (H×tanα×2) 2 In the above formula, S is the area of ​​the target test area, H is the distance from the rapid field measurement device for soil organic matter to the soil surface of the target test area, and α is the field of view angle of the five-channel camera sensor, for example, 28°.

[0027] A three-channel RGB camera sensor with area array imaging was used. Under natural light conditions (avoiding cloudy days, strong winds, or midday sun), ensuring the lens was perpendicular to the ground surface, soil images of the target survey area were acquired and saved simultaneously with the area measurement. The soil images were stored in RAW format (preserving more spectral details) and associated with sampling point numbers to establish a "soil image-sampling point" correspondence. Simultaneously, the soil images were displayed on the screen of a portable handheld device for viewing and verification, completing the sampling process. After preprocessing the sampled soil images (e.g., image noise reduction and scale calibration), image features (e.g., reflectance of the soil image in the R, G, and B bands) were acquired as part of the input features.

[0028] The lightweight interpretable deep learning model for soil organic matter is based on EfficientNet-B7 (balancing accuracy and computational efficiency), and is obtained through lightweight optimization and network structure improvement to enable successful deployment in portable handheld devices with relatively limited hardware and computing power.

[0029] For soil information (such as soil type and texture) needed to detect organic matter content, analysis of soil images is insufficient; these input features must be manually selected and entered by the user on a portable handheld device. After obtaining the required input features, these features are fed into a lightweight interpretable deep learning model for soil organic matter, yielding the organic matter content output by the model and the contribution of each input feature. The organic matter content and the contribution of the input features are then processed and displayed on the portable handheld device's screen, allowing the user to quickly determine the organic matter content at the sampling point in the field.

[0030] The embodiments of this invention use RGB images, a low-cost and readily available data source. The accuracy improvement no longer relies on multispectral and hyperspectral methods, but is achieved through a lightweight and interpretable deep learning model for soil organic matter. It does not require a laboratory or other complex equipment and can independently complete the organic matter content detection with a portable handheld device. Users can obtain the organic matter content detection results on-site with the portable handheld device, which greatly improves the detection efficiency of organic matter content.

[0031] Based on the above embodiments, optionally, the network structure of the lightweight interpretable deep learning model for soil organic matter includes: an input layer, a depthwise separable convolutional block, a global average pooling layer, a preliminary fully connected layer, a preliminary output layer, a feature contribution quantization layer, a feature contribution interpretation layer, a feature optimization layer, an optimized fully connected layer, and an output layer; the feature contribution interpretation layer is used to output the contribution of the input features, and the optimized fully connected layer is used to output the soil organic matter content.

[0032] Specifically, a dual strategy of "visual interpretation of input feature contributions from deep learning networks" and "secondary deep learning" is employed to construct a high-precision, interpretable, and highly adaptable lightweight deep learning remote sensing inversion model for soil organic matter. Using EfficientNet-B7 as the base model (balancing accuracy and computational efficiency), the model is optimized for lightweight design. Some convolutional layers in the base model are replaced with "depth-separable convolutional layers" to reduce the number of model parameters. The three fully connected layers at the end of the base model are removed and replaced with a single "global average pooling layer + one fully connected layer (output dimension = 1)" to reduce model complexity and adapt to the needs of rapid field computation. An interpretation layer is integrated after the output layer. By calculating the contribution value (Shapley value) of each input feature to the organic matter content inversion result, the importance of features is quantified, improving the model's interpretability. The final model structure is as follows: Input layer → depthwise separable convolutional blocks (3, including batch normalization and ReLU activation) → global average pooling layer → preliminary fully connected layer → preliminary output layer → feature contribution quantization layer → feature contribution interpretation layer (outputs feature contribution value) → feature optimization layer → optimized fully connected layer (outputs soil organic matter content) → output layer.

[0033] Based on the above embodiments, optionally, the input feature optimization process of the lightweight interpretable deep learning model for soil organic matter is as follows: Input at least two input features of the training sample into the lightweight interpretable deep learning model of soil organic matter to obtain the organic matter content of the training sample and the contribution of the input features; Based on the detection accuracy of the organic matter content and the contribution of each input feature, low-contribution input features and high-contribution input features are determined. Low-contribution input features are removed, high-contribution input features are retained, and the process returns to input at least two input features of the training sample into the lightweight interpretable deep learning model for soil organic matter until the number of input features meets the lightweight requirement.

[0034] Specifically, such as Figure 1B As shown, the model input features include "corrected pure soil image" (reflectance extracted from R, G, and B bands), "moisture correction parameters" (moisture content θ), "soil particle aggregation characteristic index," soil type, and soil texture. A feature matrix is ​​constructed (dimension: number of samples × 7, meaning each sample contains 7 input features: R, G, B, θ, SOILPAI, soil type, and soil texture). Labeling and dataset partitioning: The model label is the soil organic matter content measured in the laboratory. The dataset is divided into a "training set" (for model parameter fitting) and a "validation set" (for model performance validation) in a 7:3 ratio. During partitioning, it is ensured that the soil type and moisture content distributions of the training and validation sets are roughly consistent to avoid data bias.

[0035] The process involves acquiring input features from training samples in the training set and inputting them into an interpretable deep learning model to obtain the organic matter content of the training samples and the contribution of each input feature. Based on the contribution of the input features and the detection accuracy of the organic matter content in this iteration, the model analyzes which input features will be used in the next detection (i.e., retained features) and which will not be used in the next iteration (i.e., deleted features). For example, if there are 19 input features in the first detection, after one round of detection, 12 of the 19 input features are discarded as deleted features, and only 7 of them are used in the next round of detection. This iterative process is repeated multiple times until the number of input features meets the lightweight requirement (e.g., the upper limit of the number of input features is 7). The purpose of optimizing the number of input features is to reduce the pressure on the lightweight interpretable deep learning model for soil organic matter, making it lightweight enough to be easily deployed in a portable handheld device.

[0036] Based on the above embodiments, optionally, the preprocessing includes straw area removal, soil moisture content inversion, and soil particle aggregation characteristic inversion.

[0037] Specifically, straw interference refers to the phenomenon where residual crop straw (such as wheat straw, corn straw, etc.) mixed with soil in the field. Its spectral characteristics overlap with the soil spectrum, leading to spectral information "contamination," especially in areas with high straw coverage, which can easily cause deviations in organic matter content retrieval. Soil moisture content is a crucial factor affecting spectral reflectance. The presence of moisture alters the dielectric and light absorption properties of the soil, causing soils with the same organic matter content to exhibit different spectral responses under different moisture conditions, thus interfering with model stability. Therefore, in addition to conventional image denoising and scale calibration preprocessing steps, it is also necessary to remove straw areas and retrieve moisture content from soil images.

[0038] Figure 2A This is a flowchart illustrating a method for measuring soil organic matter according to another embodiment of the present invention. This embodiment is an optimization and improvement upon the above embodiment. Figure 2A As shown, the method includes: S210. Collect soil images of the soil at the sampling point using a camera sensor.

[0039] S220. Mask the straw area in the soil image based on the difference in RGB spectral characteristics between bare soil and straw; invert the soil moisture content based on the G-band reflectance of the soil image, and correct the spectral reflectance of the soil image based on the soil moisture content.

[0040] S230. Determine the soil particle aggregation characteristic index based on the distribution of soil aggregates in the soil image.

[0041] Specifically, soil aggregates are natural aggregates of soil particles. Their particle size and structural characteristics affect the reflection and scattering paths of light. Existing methods often assume that soil is a homogeneous granular system and do not consider the modulation effect of aggregates on the spectrum, resulting in poor adaptability of inversion models to soils with different structures. Therefore, in image processing, it is necessary to consider not only the interference of straw and the influence of soil moisture, but also the influence of soil aggregates. The corresponding processing flow is as follows: (1) Conventional preprocessing. Image denoising: The original RAW format soil image is denoised by "Gaussian filtering" (kernel size 5×5), and the image contrast is enhanced by "histogram equalization" to highlight the boundary difference between soil and straw. Scale calibration: The mapping relationship between pixel coordinates in the soil image and actual distance is established to clarify the spatial resolution of the image and ensure that the soil aggregate particle data extracted later is consistent with the actual size.

[0042] (2) Straw identification and removal in the target survey area. Based on the high-resolution soil images of the target survey area, the Mask R-CNN deep learning algorithm for image segmentation and binarization data processing technology were used to accurately identify the straw information in the target survey area based on the differences in RGB spectral characteristics between bare soil and surrounding interfering straw (straw is mostly light yellow or brown, while soil is mostly brownish-gray). Binarization data processing technology was used to mask the "straw area" in the soil image, deleting the spectral data of that area and retaining the remaining "pure soil area" image, i.e., the pure soil image, as the basis for subsequent spectral analysis. The distribution map of surface soil features with straw residue is shown below. Figure 2B As shown, the image of pure soil (white area) after removing straw (black area) is as follows. Figure 2C As shown.

[0043] (3) Construction of soil moisture content inversion model and spectral correction. A soil moisture content inversion model was used to correct the moisture content of the pure soil image, and the corrected soil spectral reflectance was obtained, which can provide data support for subsequent spectral analysis of soil organic matter. The specific steps are as follows: ① Determination of Moisture-Sensitive Bands. Drawing on the correlation between RGB band reflectance of pure soil images and laboratory-measured soil moisture content, it was found that the G band (500-560nm) reflectance has the strongest negative correlation with moisture content. Generally, R... 2 >0.7, thus determining the moisture-sensitive band as the G band (500-560nm).

[0044] ②Establishment of a quantitative water content model. Using the reflectance of the water-sensitive G-band as the independent variable and soil moisture content (θ) as the dependent variable, a univariate linear regression model is constructed: θ = a × G + b In the above formula, θ represents soil moisture content, G represents the spectral reflectance of the moisture-sensitive band G, and a and b are parameters of the quantitative moisture relationship model. Initial values ​​for parameters a and b are obtained by fitting soil moisture measurement sample data from typical areas with the spectral reflectance of the G band, which must satisfy R... 2 ≥0.8, RMSE≤0.05.

[0045] ③ Dynamic Correction of Original Spectrum: Using the constructed moisture model, the moisture content of each pure soil image is retrieved, and the original spectral reflectance is corrected based on the moisture content. A standard moisture content (θ0 = 15%) is set, and the correction formula is as follows: R_cor = R_ori × (1 + k×(θ-θ0)) In the above formula, R_cor is the new spectral reflectance of the pure soil image, R_ori is the original spectral reflectance of the soil image, θ is the soil moisture content, θ0 is the standard moisture content, and k is the correction coefficient. The correction coefficient is determined by verification through soil moisture measurement samples to eliminate spectral variations under different moisture conditions.

[0046] (3) Drawing on the research approach of soil micro-aggregate characteristic index, this invention proposes the soil particle aggregation characteristic index SOILPAI for the first time in the soil macro-domain, which indirectly reflects the characteristics of soil aggregates. By extracting soil particle aggregation characteristics and using them as part of the input features, data support can be provided for the removal of interference factors in subsequent soil organic matter inversion.

[0047] Based on the above embodiments, optionally, determining the soil particle aggregation characteristic index according to the distribution of soil particles in the soil image includes: Contour recognition is performed on soil aggregates in the soil image to obtain the contours of each soil aggregate in the soil image; The average particle size, abundance, and fragmentation of soil aggregates are calculated based on the outlines of each soil aggregate. The average particle size, abundance, and fragmentation of soil aggregates are weighted and fused to obtain the soil particle aggregation characteristic index.

[0048] Specifically, such as Figure 2D As shown (the background vertical lines represent soil aggregates), the outer contours of soil aggregates were extracted from a pure soil image after moisture (spectral reflectance) correction using an edge detection algorithm, ensuring that the contours of the soil aggregates were complete and unbroken. The three main aggregate characteristics of soil particles include the average particle size, abundance, and fragmentation of the soil aggregate distribution.

[0049] Average particle size of soil aggregates: The outline of each identified soil aggregate is approximated as a circle. Based on the pixel-actual distance mapping relationship after scale calibration, the equivalent diameter (d_i) of each soil aggregate is calculated, and then the average diameter of all soil aggregates is calculated.

[0050] SOILPAID_avg = Σd_i / n In the above formula, SOILPAID_avg is the average diameter of all soil aggregates, d_i is the equivalent diameter of each soil aggregate, and n is the number of soil aggregates.

[0051] Soil aggregate abundance: The abundance of soil aggregates is obtained by calculating the ratio of the pixel area occupied by soil aggregates (S_ag) to the total pixel area of ​​pure soil area (S_tot).

[0052] SOILPAIA = S_ag / S_tot × 100% In the above formula, SOILPAIA represents the abundance of soil aggregate particles, S_ag represents the pixel area of ​​the region occupied by soil aggregate particles, and S_tot represents the total pixel area of ​​the pure soil region.

[0053] Soil aggregate fragmentation: Soil aggregate fragmentation (SOILPAIF) reflects the degree of fragmentation in the distribution of soil aggregates. A gray-level co-occurrence matrix (GLCM) is calculated on a pure soil image (distance = 1, angle = 0°), and the "entropy value" of the GLCM is extracted as the fragmentation index SOILPAIF. A higher SOILPAIF value indicates a more dispersed distribution of soil aggregates and a higher degree of fragmentation; conversely, a lower value indicates a lower degree of fragmentation.

[0054] The three parameters (average particle size, abundance, and fragmentation of soil aggregates) were standardized and normalized to the 0-1 range. A soil particle aggregation characteristic index was constructed using multiple linear regression. The weights were determined based on the correlation with the organic matter content of the soil samples.

[0055] SOILPAI = k1×SOILPAID_avg + k2×SOILPAIA + k3×SOILPAIF In the above formula, SOILPAI is the soil particle aggregation characteristic index, SOILPAID_avg is the average diameter of all soil aggregate particles, SOILPAIA is the abundance of soil aggregate particles, SOILPAIF is the fragmentation degree of soil aggregate particle distribution, and k1, k2, and k3 are the integration weight parameters.

[0056] S240. Input the image features and user-inputted soil information as input features into a locally deployed lightweight interpretable deep learning model for soil organic matter, and obtain the soil organic matter content at the sampling point and the contribution of the input features.

[0057] S230. Correlate the soil organic matter content, the contribution of input features, and the three-dimensional spatial coordinates of the sampling points at each sampling point to obtain the field soil organic matter measurement results; display the field soil organic matter measurement results on-site.

[0058] Specifically, there are usually multiple sampling points on the soil in the field. Users need to use a portable handheld device to measure the organic matter content of the soil at each sampling point and the contribution of the corresponding input features. In addition, the portable handheld device has previously recorded the three-dimensional coordinates of each sampling point using a spatial three-dimensional coordinate sensor. Therefore, after obtaining the organic matter content and the contribution of the input features at each sampling point, these are correlated with the previously collected three-dimensional coordinates of each sampling point to obtain detailed information about each sampling point, which serves as the field soil organic matter measurement result. The field soil organic matter measurement result is then displayed on the screen of the portable handheld device.

[0059] To achieve accurate and efficient inversion of soil organic matter content, this invention employs the following optimization methods: An integrated visible light RGB sensor is used to acquire RGB spectral data of the target area. Utilizing the spectral differences between straw and soil in specific bands, and combining the Mask R-CNN image segmentation deep learning algorithm with binarization data processing technology, the spectral information of straw-affected areas is accurately identified and removed, extracting pure soil spectral features and eliminating straw interference. Simultaneously, based on RGB image data, a quantitative relationship model between moisture content and spectral reflectance is established to invert soil moisture content. The original soil spectrum is dynamically corrected to eliminate spectral variations under different moisture conditions, improving model stability. Furthermore, soil particle aggregation characteristic index data was extracted based on RGB imagery. Three key parameters—average particle size (the diameter after approximating a circular outline to reflect particle size), abundance of aggregated particles (the proportion of aggregated particle regions in the total soil area), and fragmentation of aggregated particle distribution (the entropy value calculated through the gray-level co-occurrence matrix)—were used as auxiliary variables to comprehensively form the soil aggregate particle characteristic index data. By analyzing the modulation pattern of spectral reflectance on the soil aggregate structure, the degree of aggregation of soil aggregates was indirectly correlated, thus reflecting the stability characteristics of the soil structure. Then, an improved lightweight interpretable deep learning model (Mobile-DeepSHAP-EfficientNet) was proposed. This model deeply integrates the processed pure soil spectral data, moisture correction parameters, and aggregate characteristics, optimizing the model input features and constructing a high-precision lightweight interpretable deep learning remote sensing inversion model for soil organic matter. This improves the model's adaptability to different soil structures, enabling high-precision and rapid field measurement of soil organic matter, and providing reliable technical support for field soil fertility monitoring and precision agricultural management.

[0060] Figure 3 This is a schematic diagram of a soil organic matter measuring device provided in another embodiment of the present invention. Figure 3 As shown, the device includes: Image processing module 310 is used to acquire soil images of the soil at the sampling point through a camera sensor, and to preprocess the soil images to obtain image features; The content detection module 320 is used to input the image features and user-inputted soil information as input features into a locally deployed lightweight interpretable deep learning model for soil organic matter, so as to obtain the organic matter content of the soil at the sampling point and the contribution of the input features. The result display module 330 is used to display the organic matter content and the contribution of the input features on-site.

[0061] The soil organic matter measuring device provided in this embodiment of the invention can execute the soil organic matter measuring method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method.

[0062] Optionally, the network structure of the lightweight interpretable deep learning model for soil organic matter includes: an input layer, a depthwise separable convolutional block, a global average pooling layer, a preliminary fully connected layer, a preliminary output layer, a feature contribution quantization layer, a feature contribution interpretation layer, a feature optimization layer, an optimized fully connected layer, and an output layer; the feature contribution interpretation layer is used to output the contribution of the input features, and the optimized fully connected layer is used to output the soil organic matter content.

[0063] Optionally, the optimization process for the input features of the lightweight, interpretable deep learning model based on soil organic matter is as follows: Input at least two input features of the training sample into the lightweight interpretable deep learning model of soil organic matter to obtain the organic matter content of the training sample and the contribution of the input features; Based on the detection accuracy of the organic matter content and the contribution of each input feature, low-contribution input features and high-contribution input features are determined. Low-contribution input features are removed, high-contribution input features are retained, and the process returns to input at least two input features of the training sample into the lightweight interpretable deep learning model for soil organic matter until the number of input features meets the lightweight requirement.

[0064] Optionally, the preprocessing includes straw area removal, soil moisture content inversion, and soil particle aggregation characteristic inversion.

[0065] Optionally, the image processing module 310 includes: The region removal unit is used to mask the straw region in the soil image based on the difference in RGB spectral characteristics between bare soil and straw. A reflectance correction unit is used to invert soil moisture content based on the G-band reflectance of the soil image, and to correct the spectral reflectance of the soil image based on the soil moisture content. The feature extraction unit is used to determine the soil particle aggregation feature index based on the distribution of soil aggregate particles in the soil image.

[0066] Optionally, the feature extraction unit is specifically used for: performing contour recognition on soil aggregates in the soil image to obtain the contour of each soil aggregate in the soil image; calculating the average particle size, abundance, and fragmentation of soil aggregate distribution based on the contour of each soil aggregate; and performing weighted fusion on the average particle size, abundance, and fragmentation of soil aggregate distribution to obtain a soil particle aggregation feature index.

[0067] Optionally, the result display module 330 is specifically used to: correlate the soil organic matter content, the contribution of input features, and the three-dimensional spatial coordinates of the sampling points at each sampling point to obtain the field soil organic matter measurement results; and display the field soil organic matter measurement results on-site.

[0068] The soil organic matter measuring device further described can also perform the soil organic matter measuring method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for performing the method.

[0069] Figure 4 A schematic diagram of an electronic device 40 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0070] like Figure 4 As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42 or a random access memory (RAM) 43, communicatively connected to the at least one processor 41. The memory stores computer programs executable by the at least one processor. The processor 41 can perform various appropriate actions and processes based on the computer program stored in the ROM 42 or loaded from storage unit 48 into the RAM 43. The RAM 43 may also store various programs and data required for the operation of the electronic device 40. The processor 41, ROM 42, and RAM 43 are interconnected via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.

[0071] Multiple components in electronic device 40 are connected to I / O interface 45, including: input unit 46, such as keyboard, mouse, etc.; output unit 47, such as various types of monitors, speakers, etc.; storage unit 48, such as disk, optical disk, etc.; and communication unit 49, such as network card, modem, wireless transceiver, etc. Communication unit 49 allows electronic device 40 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0072] Processor 41 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 41 performs the various methods and processes described above, such as methods for measuring soil organic matter.

[0073] In some embodiments, the method for measuring soil organic matter may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 40 via ROM 42 and / or communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the soil organic matter measurement method described above may be performed. Alternatively, in other embodiments, processor 41 may be configured to perform the soil organic matter measurement method by any other suitable means (e.g., by means of firmware).

[0074] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0075] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0076] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0077] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0078] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0079] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0080] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0081] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for measuring soil organic matter, characterized in that, Applied to portable handheld devices, the method includes: Soil images of the soil at sampling points are acquired using a camera sensor, and the soil images are preprocessed to obtain image features. The image features and user-inputted soil information are used as input features to a locally deployed lightweight interpretable deep learning model for soil organic matter, thereby obtaining the soil organic matter content at the sampling point and the contribution of the input features. The organic matter content and the contribution of the input features are displayed on-site.

2. The method according to claim 1, characterized in that, The network structure of the lightweight interpretable deep learning model for soil organic matter includes: an input layer, a depthwise separable convolutional block, a global average pooling layer, a preliminary fully connected layer, a preliminary output layer, a feature contribution quantization layer, a feature contribution interpretation layer, a feature optimization layer, an optimized fully connected layer, and an output layer; the feature contribution interpretation layer is used to output the contribution of the input features, and the optimized fully connected layer is used to output the soil organic matter content.

3. The method according to claim 2, characterized in that, The optimization process of the input features of the lightweight, interpretable deep learning model based on soil organic matter is as follows: Input at least two input features of the training sample into the lightweight interpretable deep learning model of soil organic matter to obtain the organic matter content of the training sample and the contribution of the input features; Based on the contribution of each input feature and the model accuracy of the remote sensing inversion of soil organic matter content, low-contribution and high-contribution input features are determined. Low-contribution input features are removed, high-contribution input features are retained, and the process is repeated to input at least two input features of the training samples into the lightweight interpretable deep learning model for soil organic matter until the number of input features meets the requirements of lightweight design and accuracy.

4. The method according to claim 1, characterized in that, The preprocessing includes straw removal, soil moisture content inversion, and soil particle aggregation characteristic inversion.

5. The method according to claim 4, characterized in that, The image features include soil particle aggregation characteristic index and soil moisture content, and the preprocessing of the soil image to obtain image features includes: The straw region in the soil image is masked based on the difference in RGB spectral characteristics between bare soil and straw. Soil moisture content is retrieved from the G-band reflectance of the soil image, and the spectral reflectance of the soil image is corrected based on the soil moisture content. Based on the distribution of soil aggregates in the soil image, a soil particle aggregation characteristic index is determined.

6. The method according to claim 5, characterized in that, The step of determining the soil particle aggregation characteristic index based on the distribution of soil aggregates in the soil image includes: Contour recognition is performed on soil aggregates in the soil image to obtain the contours of each soil aggregate in the soil image; The average particle size, abundance, and fragmentation of soil aggregates are calculated based on the outlines of each soil aggregate. The average particle size, abundance, and fragmentation of soil aggregates are weighted and fused to obtain the soil particle aggregation characteristic index.

7. The method according to claim 1, characterized in that, The on-site display of the organic matter content and the contribution of the input features includes: The organic matter content of the soil at each sampling point, the contribution of the input features, and the three-dimensional spatial coordinates of the sampling point were correlated to obtain the field soil organic matter measurement results. The results of soil organic matter measurement in the field were displayed on-site.

8. A device for measuring soil organic matter, characterized in that, Deployed in a portable handheld device, the device includes: The image processing module is used to acquire soil images of the soil at the sampling point through a camera sensor, and to preprocess the soil images to obtain image features; The content detection module is used to input the image features and user-inputted soil information as input features into a locally deployed lightweight interpretable deep learning model for soil organic matter, so as to obtain the organic matter content of the soil at the sampling point and the contribution of the input features. The results display module is used to display the organic matter content and the contribution of the input features on-site.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory communicatively connected to said at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor to enable the at least one processor to perform the method for measuring soil organic matter according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method for measuring soil organic matter according to any one of claims 1-7.