Self-adaptive calculation method for soil fissure rate based on classification difficulty gradient

By calculating the classification difficulty index and sampling strategy of soil surface RGB data, a high-quality training dataset is constructed, which solves the problem of insufficient accuracy in soil fracture rate calculation in existing technologies and realizes high-precision fracture rate calculation in complex environments.

CN121659042BActive Publication Date: 2026-05-29NANJING HYDRAULIC RES INST +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING HYDRAULIC RES INST
Filing Date
2026-02-06
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing methods for calculating soil porosity suffer from large measurement errors and data modeling defects when dealing with complex surface environments. Imbalanced sample distribution leads to insufficient ability of the model to distinguish critical states, affecting the accuracy of calculations.

Method used

By calculating the classification difficulty index of soil surface RGB data, a discrete candidate sample set is generated using a sampling ratio positively correlated with the difficulty level. A training dataset is constructed and a classification model is trained online. The trained model is then used for classification, and the soil fissure rate is calculated.

Benefits of technology

It improves the accuracy of soil fissure segmentation in complex environments and enhances the accuracy and efficiency of fissure rate calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121659042B_ABST
    Figure CN121659042B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on classification difficulty gradient's soil fissure rate self-adapting calculation method, comprising: obtaining soil surface RGB data and calculating the classification difficulty index of each data point;According to the statistical distribution characteristics of difficulty index, determine the stratification threshold, and divide data points into a predetermined difficulty level;Using the sampling ratio positively correlated with difficulty level to extract data points in each level, generate discrete candidate sample set;Obtain the interactive labeling result for candidate sample set and construct training dataset;Using training dataset to train classification model online and classify all data points of soil surface RGB data, calculate soil fissure rate.The application solves the problems of unbalanced sample distribution and insufficient learning of boundary areas in traditional methods by constructing a classification difficulty evaluation system and inverse difficulty sampling strategy, improving the segmentation accuracy of soil fissures in complex environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of soil physical testing, and in particular, it is an adaptive calculation method for soil porosity based on classification difficulty gradient. Background Technology

[0002] Soil porosity is a key physical indicator characterizing soil drying shrinkage, permeability, and mechanical stability, directly affecting farmland water and fertilizer retention efficiency and the safety assessment of geotechnical engineering projects. Achieving rapid, non-contact, and accurate measurement of this physical indicator is a key research direction in soil physics and geotechnical engineering. Currently, using optical sensors to acquire surface data and perform quantitative inversion has become the main technical means to replace traditional manual contact measurements.

[0003] In existing soil physical parameter calculation techniques, the distinction between fractures and matrix is ​​mainly achieved by analyzing the spectral intensity distribution of optical sensor data (such as RGB matrix data). Conventional methods include statistical thresholding methods (such as the Otsu algorithm) and supervised learning-based data classification methods. Thresholding methods determine the critical value based on the global single-channel intensity distribution of the data; supervised learning methods train a classification model by collecting sample data, and infer the physical properties (fractures or matrix) using the spectral or local spatial variation characteristics of the data points, thereby calculating the fracture rate.

[0004] However, existing data analysis methods still suffer from significant measurement errors and data modeling deficiencies when dealing with complex surface environments. Specifically, gradual changes in soil surface moisture content or shaded areas can cause overlapping spectral characteristics in sensor data, forming highly uncertain and ambiguous data bands. Traditional static benchmark-based analysis methods struggle to accurately determine the attributes of such data. Furthermore, existing random sampling strategies fail to consider differences in data entropy when constructing classification models, resulting in a training sample set filled with a large amount of redundant data with obvious characteristics—simple samples—while the critical data that determines measurement accuracy, i.e., difficult samples, constitutes a very small proportion. This imbalanced sample distribution leads to insufficient model discrimination ability for critical states, thus affecting the accuracy of the final physical parameter, i.e., the fracture rate. Summary of the Invention

[0005] The purpose of this invention is to provide an adaptive calculation method for soil fissure rate based on classification difficulty gradient, so as to solve the above-mentioned problems existing in the prior art.

[0006] Technical solution: An adaptive calculation method for soil porosity based on classification difficulty gradient, comprising:

[0007] Obtain the RGB data of the soil surface to be tested, and calculate the classification difficulty index of each data point in the RGB data of the soil surface;

[0008] The stratification threshold is determined based on the statistical distribution characteristics of the classification difficulty index, and the data points of the soil surface RGB data are divided into a predetermined number of difficulty levels.

[0009] Using a sampling ratio positively correlated with the difficulty level, data points are extracted from each difficulty level to generate a discrete candidate sample set;

[0010] Obtain interactive annotation results for discrete candidate sample sets and construct a training dataset;

[0011] A pre-configured classification model was trained online using the training dataset, and the trained classification model was used to classify all data points of the RGB data of the soil surface to obtain the classification results.

[0012] Soil porosity was calculated based on the classification results using RGB data of the soil surface.

[0013] According to one aspect of this application, the classification difficulty index of each data point in soil surface RGB data is calculated, including:

[0014] Calculate the color space difficulty component and spatial neighborhood difficulty component of each data point in the RGB data of the soil surface;

[0015] The color space difficulty component and the spatial neighborhood difficulty component are weighted and fused based on preset weight coefficients to obtain the classification difficulty index.

[0016] The formula for calculating the classification difficulty index is: D(x, y) = α·D color (x, y) + (1-α)·D spatial (x, y);

[0017] Where D(x, y) is the classification difficulty index of the data point at coordinates (x, y), D color (x, y) represents the color space difficulty components, D spatial (x, y) represents the spatial neighborhood difficulty component, and α is the weight coefficient.

[0018] According to one aspect of this application, calculating the color space difficulty component of each data point in RGB data of a soil surface includes:

[0019] Extract the fracture reference anchor points and matrix reference anchor points from the RGB data of the soil surface, respectively;

[0020] Calculate the first color distance from the data point to the crack reference anchor point, and the second color distance from the data point to the matrix reference anchor point;

[0021] The difficulty component of the color space is calculated based on the degree of difference between the first color distance and the second color distance.

[0022] According to one aspect of this application, the extraction of fracture reference anchor points and matrix reference anchor points from soil surface RGB data is achieved through an iterative refinement process, specifically including:

[0023] Based on the single-channel intensity distribution quantile statistics of soil surface RGB data, the initial fracture reference anchor point and the initial matrix reference anchor point are obtained;

[0024] Enter the iterative update step: calculate the class tendency of each data point relative to the current fracture reference anchor point and the current matrix reference anchor point;

[0025] The pre-set confidence threshold is used to filter the category tendency, and the pre-stored fracture reference set and matrix reference set are updated based on the filtering results;

[0026] Calculate the mean of the updated fracture reference set and matrix reference set to obtain the new current fracture reference anchor point and the new current matrix reference anchor point;

[0027] Repeat the iterative update steps until the change in the anchor point position is less than the preset convergence threshold, and use the finally converged anchor point as the crack reference anchor point and the matrix reference anchor point.

[0028] According to one aspect of this application, the formula for calculating the color space difficulty component is as follows:

[0029] D color (x, y) = 1 - |d crack (x, y)-d matrix (x, y)| / (d crack (x, y) + d matrix (x, y));

[0030] Where D color (x, y) represents the color space difficulty component of the data point at coordinates (x, y), d crack (x, y) represents the first color distance, i.e., the Euclidean distance from the data point to the crack reference anchor point, d matrix (x, y) represents the second color distance, i.e., the Euclidean distance from the data point to the matrix reference anchor point, and || represents the absolute value operation.

[0031] According to one aspect of this application, the formula for calculating the spatial neighborhood difficulty component is as follows:

[0032] D spatial (x, y) = σ local (x, y) / σ max ;

[0033] Where D spatial (x, y) represents the spatial neighborhood difficulty component of the data point at coordinates (x, y), σ local(x, y) represents the standard deviation of gray values ​​within a preset local neighborhood window centered at the data point (x, y), σ max This represents the maximum local grayscale standard deviation of all data points in the RGB data of the soil surface.

[0034] According to one aspect of this application, the data points of RGB data on the soil surface are divided into predetermined difficulty levels, including:

[0035] The distribution of classification difficulty index of all data points in the RGB data of soil surface is statistically analyzed. The q1 quantile of the classification difficulty index is used as the first threshold, and the q2 quantile of the classification difficulty index is used as the second threshold.

[0036] Using the first and second thresholds, the data points are divided into low-difficulty, medium-difficulty, and high-difficulty layers;

[0037] The low-difficulty layer contains data points whose classification difficulty index is less than the first threshold; the medium-difficulty layer contains data points whose classification difficulty index is greater than or equal to the first threshold and less than the second threshold; and the high-difficulty layer contains data points whose classification difficulty index is greater than or equal to the second threshold.

[0038] According to one aspect of this application, a sampling ratio positively correlated with the difficulty level is adopted, including:

[0039] The sampling ratio for each difficulty level is set according to the principle of inverse difficulty ratio allocation;

[0040] The sampling ratio for high, medium, and low difficulty levels is set as follows: P hard :P medium :P easy =β 2 :β:1;

[0041] Where P hard P medium and P easy These represent the sampling ratios for high, medium, and low difficulty levels, respectively, with β being a preset difficulty weighting factor, and β>1.

[0042] According to one aspect of this application, data points are extracted from each difficulty level, specifically based on a pre-set total number of samples, by calculating the sampling probability of each level according to the following formula and then performing random sampling:

[0043] p easy =N total / (|L easy |+β·|L medium |+β 2 ·|L hard |);p medium =β·p easy ;phard =β 2 ·p easy ;

[0044] Where p easy p medium and p hard Let N represent the probability of each data point being selected in the low, medium, and high difficulty levels, respectively. total For the total number of samples, |L easy |、|L medium | and |L hard | represents the number of data points contained in each level.

[0045] According to one aspect of this application, a training dataset is constructed, comprising:

[0046] The data points contained in the discrete candidate sample set are visualized and marked on the RGB data of the soil surface.

[0047] In response to manual classification instructions for the labeled data points, the category label for each data point is determined, including fracture and matrix categories;

[0048] Extract the RGB color values ​​of the labeled data points as feature vectors, and combine the feature vectors with the corresponding category labels to construct the training dataset.

[0049] Beneficial effects: This invention constructs a classification difficulty evaluation system and an inverse difficulty sampling strategy, which solves the problems of unbalanced sample distribution and insufficient learning of boundary regions in traditional methods, and improves the segmentation accuracy of soil fissures in complex environments. Attached Figure Description

[0050] Figure 1 A flowchart illustrating the steps of an adaptive calculation method for soil porosity based on classification difficulty gradient provided in this application embodiment.

[0051] Figure 2 A flowchart illustrating the steps for calculating the classification difficulty index of each data point in the RGB data of the soil surface, as provided in this embodiment of the application.

[0052] Figure 3 A flowchart illustrating the steps for calculating the color space difficulty component of each data point in the RGB data of the soil surface, as provided in this application embodiment.

[0053] Figure 4 A flowchart illustrating the steps for extracting fracture reference anchor points and matrix reference anchor points from RGB data of the soil surface, as provided in this application embodiment. Detailed Implementation

[0054] 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.

[0055] It should be noted that the terms "first," "second," etc., used in this specification 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 "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that includes 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.

[0056] like Figure 1 As shown, an adaptive calculation method for soil porosity based on classification difficulty gradient includes the following steps:

[0057] Obtain the RGB data of the soil surface to be tested, and calculate the classification difficulty index of each data point in the RGB data of the soil surface.

[0058] Alternatively, one can obtain the RGB data of the soil surface to be tested, perform preprocessing to obtain the preprocessed RGB data of the soil surface, and calculate the classification difficulty index of each data point in the preprocessed RGB data of the soil surface.

[0059] Specifically, the system acquires RGB data of the soil surface to be measured using high-definition industrial cameras, drone remote sensing, or handheld imaging devices. For example, soil surface RGB data refers to a three-dimensional digital matrix reflecting the spectral reflectance characteristics of the soil surface, collected by optical sensors. Each data point contains intensity values ​​for the red (R), green (G), and blue (B) channels, corresponding to the physical reflectance properties of a tiny unit on the soil surface. After obtaining the data, the system needs to perform digital preprocessing, such as uniformly adjusting the data acquisition density to a preset standard to ensure dimensional consistency in subsequent calculations. Based on this, the system assesses the classification difficulty of each data point, obtaining a classification difficulty index. The classification difficulty index is a quantitative indicator used to characterize the difficulty of correctly classifying the data point as either fractured or matrix-based. Typically, black data points in the center of fractures and light-colored data points in dry matrix areas have lower classification difficulty indices, while data points in the transition zone at the edge of fractures, shaded areas, or areas with gradual changes in moisture content have higher classification difficulty indices. Optionally, the method for calculating the classification difficulty index can be based on the distance between the color of the data point and the typical crack features, or it can be combined with the complexity of the local spatial variation of the data point. This embodiment does not limit the specific calculation algorithm.

[0060] The stratification threshold is determined based on the statistical distribution characteristics of the classification difficulty index, and the data points of the RGB data of the soil surface are divided into a predetermined number of difficulty levels.

[0061] In this embodiment, after calculating the classification difficulty index of all data points in the RGB data of the soil surface, the system performs statistical analysis on it. Since the numerical distribution of the difficulty index may differ under different soil types and lighting conditions, the system does not rely on a fixed empirical threshold, but rather adaptively determines the stratification threshold based on the current statistical distribution characteristics.

[0062] Specifically, the system can statistically analyze the histogram or cumulative distribution function of the classification difficulty index, and determine the critical values ​​(i.e., stratification thresholds) that can classify data points into different categories based on preset proportional requirements. Using these stratification thresholds, all data points in the soil surface RGB data are divided into multiple difficulty levels, such as low difficulty, medium difficulty, and high difficulty. The low difficulty level typically contains a large number of simple samples with distinct features, while the high difficulty level contains a smaller number of boundary samples or difficult examples crucial for model training. Through this stratification mechanism, the system can identify which regions in the soil surface RGB data are the key areas for model learning.

[0063] By adopting a sampling ratio positively correlated with the difficulty level, data points are extracted from each difficulty level to generate a discrete candidate sample set.

[0064] In this embodiment, to address the problem of insufficient boundary learning caused by the dominance of easily classified samples in traditional random sampling, a non-uniform sampling method is adopted, where the sampling ratio is positively correlated with the difficulty level. Specifically, for high-difficulty levels, the system allocates a higher sampling ratio, increasing the probability of selecting these difficult samples; for low-difficulty levels, although the total number of data points is enormous, the system allocates a lower sampling ratio to avoid redundant samples flooding the training set. Based on the determined sampling ratio, the system randomly samples within each level, ultimately aggregating all extracted data points into a discrete candidate sample set. The data points in the discrete candidate sample set are spatially discretely distributed, and their feature distribution is highly focused on key regions such as crack edges, achieving coverage of the most critical feature information with a smaller number of samples.

[0065] Obtain interactive annotation results for discrete candidate sample sets and construct a training dataset.

[0066] Specifically, the system presents a discrete set of candidate samples to the operator for manual verification. Unlike traditional manual drawing of region outlines, a point-to-point interactive mode is preferred. The system can highlight these discrete candidate data points on the original data, and the operator only needs to perform binary classification on these points, i.e., confirm whether they belong to the fracture class or the matrix class. If a data point is difficult to identify, the operator can also choose to skip it. The system receives these interactive annotation results, uses the RGB feature values ​​of the data points as input features, and the manually confirmed category as the label, to construct a paired training dataset. This reduces the workload of manual annotation while ensuring the quality of the annotated data.

[0067] A pre-configured classification model was trained online using the training dataset, and the trained classification model was used to classify all data points of the RGB data of the soil surface to obtain the classification results.

[0068] In this embodiment, a machine learning classification model is trained online using a constructed high-quality training dataset. Optionally, the classification model can employ algorithms such as decision trees, random forests, support vector machines, or backpropagation neural networks. Because the training dataset contains a large number of carefully selected difficult examples, the trained model has a stronger ability to discriminate fracture edges and complex regions. After training, the system applies the model to the entire RGB data of the soil surface under test, performing classification prediction for each data point and outputting the classification result for each data point as belonging to either a fracture or the matrix. This achieves generalization from sparse labeled samples to data point classification.

[0069] Soil porosity was calculated based on the classification results using RGB data of the soil surface.

[0070] Specifically, the soil porosity is calculated by dividing the total number of data points classified as fractures by the total number of RGB data points on the soil surface. To further improve the reliability of the results, the system can perform post-processing on the classification results before statistical analysis. For example, it can filter out isolated noise points and use morphological operations to fill in tiny cavities within the fractures. The final output soil porosity is a quantitative percentage that objectively reflects the degree of soil shrinkage and cracking, providing a scientific basis for farmland irrigation management or geotechnical engineering assessments.

[0071] This embodiment introduces a classification difficulty assessment mechanism to achieve targeted sampling and learning of difficult-to-classify samples in soil surface RGB data, thereby improving the accuracy of fracture rate calculation while ensuring annotation efficiency.

[0072] like Figure 2 As shown, in one possible implementation, the classification difficulty index of each data point in the RGB data of the soil surface is calculated, including:

[0073] Calculate the color space difficulty component and spatial neighborhood difficulty component of each data point in the RGB data of the soil surface;

[0074] The color space difficulty component and the spatial neighborhood difficulty component are weighted and fused based on preset weight coefficients to obtain the classification difficulty index.

[0075] The formula for calculating the classification difficulty index is:

[0076] D(x, y) = α·D color (x, y) + (1-α)·D spatial (x, y);

[0077] Where D(x, y) is the classification difficulty index of the data point at coordinates (x, y), D color (x, y) represents the color space difficulty components, D spatial (x, y) represents the spatial neighborhood difficulty component, and α is the weight coefficient.

[0078] This embodiment describes the construction process of the classification difficulty index D(x, y). For any data point with coordinates (x, y) in the RGB data of the soil surface, its classification difficulty index depends not only on the intensity of the color but also on the complexity of its surrounding environment. Therefore, the classification difficulty index is decomposed into two independent components: the color space difficulty component D. color (x, y) and spatial neighborhood difficulty component D spatial(x, y). The system integrates the two using a linear weighting formula. The classification difficulty index D(x, y) is typically normalized to between 0 and 1; a larger value indicates that the data point is more difficult to distinguish by a simple linear boundary. α is a preset weighting coefficient used to balance the importance of spectral features and local spatial variation features. In some preferred embodiments, the weighting coefficient α is set to a range of 0.5 to 0.8. This range is based on extensive experiments: in soil fracture identification, color features are generally more discriminative than local spatial variation features, therefore, a slightly larger weight is given to the color component. For example, when α is 0.7, it indicates that color features dominate the difficulty assessment.

[0079] like Figure 3 As shown, in a preferred implementation, calculating the color space difficulty component of each data point in the RGB data of the soil surface includes:

[0080] Extract the fracture reference anchor points and matrix reference anchor points from the RGB data of the soil surface, respectively;

[0081] Calculate the first color distance from the data point to the crack reference anchor point, and the second color distance from the data point to the matrix reference anchor point;

[0082] The difficulty component of the color space is calculated based on the degree of difference between the first color distance and the second color distance.

[0083] Specifically, to evaluate color ambiguity, the system needs to establish two reference points in the color space: a fracture reference anchor point and a matrix reference anchor point. The fracture reference anchor point represents the typical, purest fracture color in the image, usually deep black or dark brown, while the matrix reference anchor point represents the typical soil surface color, usually grayish-brown or light yellow. These two anchor points can be considered as two cluster centers in the feature space. For any data point, the system calculates its Euclidean distance to each of these two anchor points.

[0084] For example, the formula for calculating the difficulty component of a color space is:

[0085] D color (x, y) = 1 - |d crack (x, y)-d matrix (x, y)| / (d crack (x, y) + d matrix (x, y));

[0086] Where D color (x, y) represents the color space difficulty component of the data point at coordinates (x, y), d crack (x, y) represents the first color distance, i.e., the Euclidean distance from the data point to the crack reference anchor point, d matrix(x, y) represents the second color distance, i.e., the Euclidean distance from the data point to the matrix reference anchor point, and || represents the absolute value operation.

[0087] Specifically, when a data point is located in the intermediate transition region between the fissure and the matrix in the color feature space, its distance to the two anchor points is very close, i.e., d crack ≈d matrix When the numerator is close to 0, the value of the entire expression approaches 1, indicating that color classification is extremely difficult. Conversely, if a data point is significantly biased in one aspect, such as being extremely black, then its distance to the crack anchor point is extremely small while its distance to the matrix anchor point is very large. In this case, the ratio of the scores approaches 1, and the value of the entire expression approaches 0, indicating that color classification is extremely easy. By defining the normalized difference, the influence of light intensity on the absolute value of distance is effectively eliminated, focusing only on the relative color bias.

[0088] For example, the formula for calculating the spatial neighborhood difficulty component is as follows:

[0089] D spatial (x, y) = σ local (x, y) / σ max ;

[0090] Where D spatial (x, y) represents the spatial neighborhood difficulty component of the data point at coordinates (x, y), σ local (x, y) represents the standard deviation of gray values ​​within a preset local neighborhood window centered at the data point (x, y), σ max This represents the maximum local grayscale standard deviation of all data points in the RGB data of the soil surface.

[0091] In this embodiment, the edges of cracks are often accompanied by drastic changes in texture, while the center of cracks or flat soil surfaces have relatively uniform texture. Therefore, the grayscale change rate of local areas can be used as an important indicator for assessing the difficulty. Specifically, the system selects a local neighborhood window of size w×w centered on the data point to be tested (x, y). The size w of the local neighborhood window is usually set to 1% to 2% of the number of data points on the shorter side of the RGB data of the soil surface, and w is not less than 5. For example, for an image with 1000×1000 data points, the window size can be 15×15. After determining the window, the system calculates the standard deviation of the grayscale values ​​of all data points within the window, denoted as σ. local (x, y) reflects the local roughness. To normalize this index to the range of 0 to 1, the system also needs to calculate the maximum value σ of the local gray-level standard deviation of all data points in the entire image. max Spatial neighborhood difficulty component D spatial (x, y) is the ratio of the local standard deviation to the global maximum standard deviation. When D spatialA larger value indicates that the data point is in a region of abrupt texture change, such as the edge of a crack or an area of ​​weed interference, making classification more difficult; a smaller value indicates that the data point is in a flat region, making classification less difficult.

[0092] This embodiment proposes a dual-component weighted model of color space + spatial neighborhood, which comprehensively evaluates the classification difficulty of data points from two dimensions: spectral features and local spatial variation features.

[0093] For example, in some basic implementations, the system can directly extract anchor points based on a fixed quantile of the single-channel intensity distribution. Specifically, the system calculates the single-channel intensity distribution of the image, defining the set of data points with gray values ​​in the lowest 10% as the crack reference set and the set of data points with gray values ​​in the highest 10% as the matrix reference set. The RGB mean of all data points in these two sets is directly calculated and used as the crack reference anchor point and the matrix reference anchor point, respectively. This embodiment is simple to calculate, but the anchor points may shift when there is water reflection or local shadows.

[0094] like Figure 4 As shown, in a preferred embodiment, the extraction of fracture reference anchor points and matrix reference anchor points from the RGB data of the soil surface is achieved through an iterative refinement process, specifically including:

[0095] Based on the single-channel intensity distribution quantile statistics of soil surface RGB data, the initial fracture reference anchor point and the initial matrix reference anchor point are obtained.

[0096] Specifically, the system uses the following formula to calculate the grayscale value of each data point in the RGB data:

[0097] Gray(x,y)=0.299·R(x,y)+0.587·G(x,y)+0.114·B(x,y).

[0098] The grayscale distribution of all data points in the RGB data of the soil surface was statistically analyzed. Data points with grayscale values ​​at the lowest 10% quantile were extracted as the initial fracture reference set, and data points with grayscale values ​​at the highest 10% quantile were extracted as the initial matrix reference set. The RGB mean of each set was calculated as the initial reference anchor point. In other words, the RGB mean of these two sets was calculated and denoted as the initial fracture reference anchor point C. crack 0 and the initial matrix reference anchor point C matrix 0 .

[0099] Enter the iterative update step: calculate the class tendency of each data point relative to the current fracture reference anchor point and the current matrix reference anchor point.

[0100] Specifically, in the t-th iteration, the system utilizes the anchor point C obtained in the previous round. crack t-1 and C matrix t-1 Calculate the class preference for each data point in the RGB data of the soil surface. For example, the formula for calculating the class preference is:

[0101] ρ(x, y) = d matrix_curr (x, y) / (d) crack_curr (x, y) + d matrix_curr (x, y));

[0102] Where ρ(x, y) represents the class preference of the data point at coordinates (x, y); d crack_curr (x, y) represents the Euclidean distance from the data point to the current fracture reference anchor point, d matrix_curr (x, y) represents the Euclidean distance from the data point to the current matrix reference anchor. The class bias ρ(x, y) ranges from 0 to 1. When ρ is close to 1, it means that d matrix_curr Much greater than d crack_curr In other words, the closer the data point is to the fracture anchor point, the more likely it is to belong to the fracture class; conversely, when ρ is close to 0, it tends to belong to the matrix class; when ρ is close to 0.5, it indicates that the data point is in the fuzzy zone.

[0103] The pre-set confidence threshold is used to filter the category tendency, and the pre-stored fracture reference set and matrix reference set are updated based on the filtering results.

[0104] In other words, the class tendency is filtered using a preset confidence threshold, and high-confidence data points are extracted to update the pre-stored fracture reference set and matrix reference set.

[0105] In this embodiment, a purification mechanism is introduced to eliminate the interference of ambiguous boundary data points on anchor point calculation. The system sets a relatively small confidence threshold ε, with a recommended value range of 0.10 to 0.15. Two types of high-confidence samples are selected based on the class tendency ρ: the updated fracture reference set contains all data points with ρ(x,y)>1-ε, meaning that the system only selects those data points that are very confident of belonging to the fracture to participate in the next round of anchor point calculation; the updated matrix reference set contains all data points with ρ(x,y)<ε.

[0106] Calculate the mean of the updated fracture reference set and matrix reference set to obtain the new current fracture reference anchor point and the new current matrix reference anchor point.

[0107] Specifically, based on the selected clean sample set, the system recalculates its RGB mean to obtain the new anchor point C for the t-th iteration. crack t and C matrixt By eliminating interference from the intermediate transition region, the new anchor point will be closer to the true category center.

[0108] Repeat the iterative update steps until the change in the anchor point position is less than the preset convergence threshold, and use the finally converged anchor point as the crack reference anchor point and the matrix reference anchor point.

[0109] In this embodiment, the system repeatedly performs the steps of calculating the category tendency, updating the pre-stored fracture reference set and matrix reference set, and obtaining the new current fracture reference anchor point and the new current matrix reference anchor point. Each iteration fine-tunes the anchor point position. To determine whether the iteration has ended, the system calculates the displacement of the anchor point between the two iterations. Preferably, the change in anchor point position is calculated using the following formula:

[0110] Δt=||C crack t -C crack t-1 ||2+||C matrix t -C matrix t-1 ||2;

[0111] Where Δt is the change in the t-th iteration; |||2 represents the Euclidean norm operation, i.e., taking the vector length; C crack t and C matrix t These are the fracture reference anchor point and the matrix reference anchor point for the t-th iteration, respectively. The system has a preset convergence threshold δ, for example, 1.0 gray level. When Δt < δ, the algorithm is considered converged, iteration stops, and the current C is output. crack t and C matrix t This serves as the final reference anchor point. Furthermore, to prevent infinite loops, the system typically sets a maximum number of iterations T. max For example, 10 times. If the convergence condition is not met after reaching the maximum number of iterations, the current result is forcibly output. This iterative refinement mechanism can improve the accuracy of subsequent color space difficulty component calculations.

[0112] In a specific numerical case, assuming that the RGB data of a soil surface is initialized, the initial fracture reference anchor point C crack 0 The initial matrix reference anchor point is (35, 30, 28). matrix 0 The values ​​are (165, 145, 130). The confidence threshold ε is set to 0.12, and the convergence threshold δ is set to 1.0.

[0113] First iteration: After calculating the class bias of the entire map, the system selects data points with ρ > 0.88 to update the fracture reference set, and selects data points with ρ < 0.12 to update the matrix reference set. Calculate the new anchor point C. crack 1 For (32, 28, 26), C matrix 1 The values ​​are (170, 150, 135). The change Δ1 = ||(32, 28, 26) - (35, 30, 28)||2 + ||(170, 150, 135) - (165, 145, 130)||2 ≈ 4.12 + 8.66 = 12.78, which is greater than δ, so the iteration continues.

[0114] Second iteration: C is obtained after the update. crack 2 For (31, 27, 25), C matrix 2 The values ​​are (172, 152, 137). The change Δ2 ≈ 1.73 + 3.46 = 5.19, which is greater than δ, so the iteration continues.

[0115] Third iteration: C is obtained after the update. crack 3 For (31, 27, 25), C matrix 3 The values ​​are (173, 153, 138). The change Δ3 ≈ 0 + 1.73 = 1.73, which is greater than δ, so the iteration continues.

[0116] 4th iteration: C is obtained after the update. crack 4 For (31, 27, 25), C matrix 4 The value is (173, 153, 138). The change Δ4≈0, which is less than δ, so convergence is determined and the final anchor point is output.

[0117] It can be seen that after four iterations, the crack reference anchor point converged from the brighter (35, 30, 28) to the purer darker (31, 27, 25), effectively eliminating the interference of shadow area data points that may have been mixed in in the initial statistics.

[0118] This embodiment introduces an iterative refinement mechanism based on class tendency, which solves the problem that traditional static statistical methods are easily affected by abnormal highlights or shadows, and can obtain purer and more representative class centers.

[0119] In one embodiment of this application, the data points of the RGB data of the soil surface are divided into a predetermined number of difficulty levels, including:

[0120] The distribution of classification difficulty index of all data points in the RGB data of soil surface is statistically analyzed. The q1 quantile of the classification difficulty index is used as the first threshold, and the q2 quantile of the classification difficulty index is used as the second threshold.

[0121] Using the first and second thresholds, the data points are divided into low-difficulty, medium-difficulty, and high-difficulty layers;

[0122] The low-difficulty layer contains data points whose classification difficulty index is less than the first threshold; the medium-difficulty layer contains data points whose classification difficulty index is greater than or equal to the first threshold and less than the second threshold; and the high-difficulty layer contains data points whose classification difficulty index is greater than or equal to the second threshold.

[0123] This embodiment describes the use of statistical quantiles to establish adaptive stratification boundaries. In real-world field environments, the overall difficulty distribution of soil surface RGB data is dynamically changing. For example, in well-lit images with clearly defined cracks, the difficulty index of most data points is very low; while in images with uneven lighting or fine cracks, the overall difficulty index may be high. Using fixed empirical thresholds, such as 0.3 and 0.6, may result in empty high-difficulty strata in simple images or empty low-difficulty strata in complex images, leading to sampling failure. To address this issue, quantile statistics can be used.

[0124] Specifically, the system traverses the entire RGB data of the soil surface and statistically analyzes the numerical distribution of the classification difficulty index D for all data points. The q1 quantile value of this distribution is calculated as the first threshold θ1, and the q2 quantile value is calculated as the second threshold θ2. In some preferred embodiments, the q1 quantile value is set to a range of 0.5 to 0.7, for example, 0.6, meaning that regardless of the overall difficulty of the image, the system always classifies the relatively easiest-to-classify data points, approximately 60% of the total data points, into the low-difficulty layer. In some preferred embodiments, the q2 quantile value is set to a range of 0.85 to 0.95, for example, 0.9, meaning that the system always classifies the relatively most difficult-to-classify data points, approximately 10% of the total data points, into the high-difficulty layer. Low-difficulty layer L easy Medium difficulty level L medium and high difficulty level L hard The proportion of data points is relatively fixed, ensuring that each level has enough candidate data points for sampling, thus enhancing the algorithm's adaptability to different environments. In other words, the low-difficulty level corresponds to approximately 60% of the data points with the lowest classification difficulty index, while the high-difficulty level corresponds to approximately 10% of the data points with the highest classification difficulty index.

[0125] In a further embodiment, a sampling ratio positively correlated with the difficulty level is used, including:

[0126] The sampling ratio for each difficulty level is set according to the principle of inverse difficulty ratio allocation;

[0127] The sampling ratio for high, medium, and low difficulty levels is set as follows: P hard :P medium :P easy =β 2 :β:1;

[0128] Where P hard P medium and P easy These represent the sampling ratios for high, medium, and low difficulty levels, respectively, with β being a preset difficulty weighting factor, and β>1.

[0129] Specifically, to make the model pay more attention to those difficult-to-classify samples located at the edges of cracks and the boundaries of shadows, this embodiment does not simply increase the sampling amount of high-difficulty layers, but adopts an exponential proportional allocation strategy. hard P medium and P easy These represent the relative weights of a unit number of data points selected in the high, medium, and low difficulty levels, respectively. In some preferred embodiments, the difficulty weight factor β ranges from 2 to 5. For example, when β is set to 3, the sampling ratio becomes 9:3:1. This means that, under the same conditions, the probability of a data point in the high difficulty level being selected into the training set is 9 times that of a data point in the low difficulty level, and 3 times that of a data point in the medium difficulty level. The skew strategy forces the classification model to repeatedly learn these boundary samples during training, rapidly improving segmentation accuracy.

[0130] In a further embodiment, data points are extracted from each difficulty level. Specifically, based on a pre-set total number of samples, the sampling probability of each level is calculated according to the following formula, and random sampling is performed:

[0131] p easy =N total / (|L easy |+β·|L medium |+β 2 ·|L hard |);p medium =β·p easy ;p hard =β 2 ·p easy ;

[0132] Where p easy p medium and p hard Let N represent the probability of each data point being selected in the low, medium, and high difficulty levels, respectively. totalFor the total number of samples, |L easy |、|L medium | and |L hard | represents the number of data points contained in each level.

[0133] This embodiment provides a specific method for calculating sampling probability under a given total annotation budget constraint in practical engineering applications. Since the cost of manual annotation is typically limited, the system needs to preset the total sampling quantity N. total For example, 1000 points.

[0134] To illustrate the calculation process more clearly, a specific numerical calculation example is provided below: Assume a soil surface RGB data set contains 1,000,000 data points. After adaptive stratification (assuming q1 is 0.6 and q2 is 0.9), the number of data points in each stratum is as follows: Low difficulty layer | L easy |600,000; Medium difficulty level| L medium |300,000; High difficulty level| L hard The sample size is 100,000. Assume the preset total sample size N. total The number of data points is 1000, and the difficulty weighting factor β is set to 3. The system calculates the denominator Sum of the probability that each data point in the low difficulty level will be selected. weights :

[0135] Sum weights =600000+3×300000+9×100000=600000+900000+900000=2400000.

[0136] Calculate the fundamental probability p easy :

[0137] p easy =1000 / 2400000≈0.000417.

[0138] Then calculate the probabilities of other levels:

[0139] p medium =3×0.000417≈0.00125;

[0140] p hard =9×0.000417≈0.00375.

[0141] During actual sampling, the system generates a random number between 0 and 1 for each data point in the low-difficulty layer; if the number is less than 0.000417, it is selected. For each data point in the high-difficulty layer, if the random number is less than 0.00375, it is selected. The expected final sampling results are: low-difficulty layer sample count = 600000 × 0.000417 ≈ 250; medium-difficulty layer sample count = 300000 × 0.00125 ≈ 375; high-difficulty layer sample count = 100000 × 0.00375 ≈ 375. It can be seen that although the total number of data points in the high-difficulty layer only accounts for 10% of the entire image, its final contribution of training samples (375) exceeds that of the low-difficulty layer (250), which accounts for 60% of the entire image. This optimizes training efficiency, allowing the model to focus on key boundary regions.

[0142] This embodiment solves the problem of difficult sample capture under different lighting and geological conditions by dynamically adjusting the stratification threshold and exponentially weighted sampling.

[0143] According to one aspect of this application, a training dataset is constructed, comprising:

[0144] The data points contained in the discrete candidate sample set are visualized and marked on the RGB data of the soil surface.

[0145] In response to manual classification instructions for the labeled data points, the category label for each data point is determined, including fracture category and matrix category;

[0146] Extract the RGB color values ​​of the labeled data points as feature vectors, and combine the feature vectors with the corresponding category labels to construct the training dataset.

[0147] Specifically, after generating a discrete candidate sample set, the system displays the original RGB data of the soil surface on a graphical user interface, and overlays candidate data points onto the image using prominent markers, such as red crosses or dots. For ease of operation, the system supports local zoom-in functionality, allowing operators to observe details of the data points. Operators classify and confirm these discrete points using mouse clicks or keyboard shortcuts. For example, pressing the number key 1 confirms a fracture, pressing the number key 0 confirms matrix, and pressing the spacebar skips uncertain points. The system records these operation commands in real time and assigns a category label Y to each confirmed data point. i Its value set is {0, 1}. Simultaneously, the system reads the red, green, and blue channel values ​​of this data point in the original image, forming a feature vector X. i =[R i G i B i ]. The feature vector X i With category label Y iA training dataset is constructed by mapping each point to a specific location. Compared to the traditional method of manually outlining cracks in software such as Photoshop, the discrete point-based annotation method has more advantages: operators do not need to spend time depicting complex crack edges, but only need to perform simple binary judgments; in addition, the annotation objects are automatically selected by the algorithm, directly focusing on the most informative difficult sample, avoiding repetitive work on a large number of simple background areas.

[0148] In a preferred embodiment, calculating the soil porosity based on the classification results of the soil surface RGB data includes:

[0149] The classification results output by the classification model are subjected to median filtering to remove noise interference, resulting in filtered classification results.

[0150] The filtered classification results are binarized to obtain a binary matrix reflecting the fracture distribution.

[0151] The soil fracture rate is obtained by counting the number of fracture data points in the binary matrix of fracture distribution and calculating their proportion to the total number of RGB data points on the soil surface.

[0152] In this embodiment, since the classification model makes predictions based on data points, the output raw classification result map often contains some isolated noise points. For example, the reflection of soil particles may be misclassified as a fracture point, or tiny dust particles inside a fracture may be misclassified as matrix. To eliminate this noise, the system performs median filtering on the classification results.

[0153] Specifically, the system uses a sliding window of a preset size, such as 3×3 or 5×5, to traverse the classification result map, and uses the median of the classification results of the data points within the window as the new result for the center data point. Median filtering can effectively remove isolated noise points while protecting the edge features of the fractures from blurring. After filtering, the system converts the classification probability map into a strict fracture distribution binary matrix. Typically, a probability threshold of 0.5 is set; data points greater than 0.5 are assigned a value of 1, representing a fracture, and data points less than or equal to 0.5 are assigned a value of 0, representing the matrix. The fracture distribution binary matrix is ​​traversed, and the total number N of elements with a value of 1 is counted. crack Let N be the total number of data points in the image. total_pixels Soil Fragmentation Rate Crack Rate The calculation formula is:

[0154] Crack Rate =(N crack / N total_pixels )×100%;

[0155] The calculation result is the final output technical indicator, which is used to quantitatively assess the degree of soil cracking.

[0156] This embodiment achieves high-precision crack rate calculation by changing the traditional human-computer interaction mode from region labeling to point labeling and combining it with image morphology processing.

[0157] In one possible implementation, under constant lighting conditions and with a known degree of fracture development in a laboratory environment, the system can use preset fixed thresholds for difficulty stratification. For example, the first threshold θ1 can be set to 0.3, and the second threshold θ2 to 0.6. In this case, data points with a classification difficulty index less than 0.3 are directly assigned to the low-difficulty layer, those between 0.3 and 0.6 to the medium-difficulty layer, and those greater than 0.6 to the high-difficulty layer. This eliminates the need for full-map statistics and quantile calculations, thus improving computational speed.

[0158] In another possible implementation, for scenarios with extremely high real-time computational requirements, the system can employ a one-time static statistical method to extract anchor points. Specifically, after calculating the intensity distribution of a single channel, the system directly selects the RGB mean of the 10% of data points with the lowest grayscale values ​​as the crack reference anchor point, and selects the RGB mean of the 10% of data points with the highest grayscale values ​​as the matrix reference anchor point. Subsequent category bias calculations and iterative updates are then omitted. Although the anchor points extracted in this embodiment may contain a small amount of noise interference, they can still provide an effective benchmark for calculating the difficulty components of the color space when the image quality is good.

[0159] In another possible implementation, the system can employ a linear proportional allocation strategy. For example, the sampling ratio of high-difficulty, medium-difficulty, and low-difficulty levels can be set to 3:2:1, i.e., β:β-1:1, or other linearly decreasing relationships. Alternatively, in the simplest implementation, oversampling can be performed only on the high-difficulty levels, while the medium- and low-difficulty levels are undersampled proportionally. Although this embodiment does not focus on difficult examples as strongly as the exponential strategy, it still follows the idea of ​​a positive correlation with the difficulty level, and can optimize the training sample structure.

[0160] In one embodiment of this application, the adaptive calculation method for soil fissure rate based on classification difficulty gradient can also be:

[0161] Step 1: In Photoshop, use the selection tool combined with foreground and background color fill methods to mark the fracture data and matrix data in the fracture RGB dataset. For example, fracture areas can be marked as pure red (RGB values ​​255, 0, 0), and matrix areas can be marked as pure green (RGB values ​​0, 255, 0). During the marking process, it is important to note two points: first, mark representative areas, i.e., areas where the color is commonly seen in most fractures or most soil matrices; second, mark ambiguous areas, i.e., areas where the soil fractures and matrix appear similar in color.

[0162] Step 2: Based on the source dataset and the labeled dataset, construct a dataset for machine learning model training and inversion using a data stacking approach. For the labeled dataset, obtain the position and color of the labels using a traversal search algorithm, assigning a value of 1 to red labels and 0 to green labels. This dataset serves as the model training output set (dependent variable). For the source dataset, obtain the RGB three-channel values ​​of the data points at the corresponding label positions in the labeled dataset, serving as the model training input set (independent variable). Simultaneously, obtain the RGB three-channel values ​​of all positions in the source dataset using a traversal search, serving as the input set for model inversion.

[0163] Step 3: Based on the model training set, train the model using three machine learning algorithms: Decision Tree, BackPropagation Neural Network, and Random Forest. Evaluate the accuracy using an accuracy metric. The calculation formula is as follows:

[0164] Accuracy=(∑ i=1 n |S i -M i |) / n×100%;

[0165] Where n is the total number of data in the training set, S i M is the calculated value for the i-th model. i Let i be the i-th tag value.

[0166] Step 4: Select the model with the highest training accuracy, substitute the model inversion input set into the model, and output the inversion result, which is the preliminary result of RGB data segmentation of the crack. Output the single-channel intensity distribution, and the grayscale data of the data points is between 0 and 255.

[0167] Steps five and four have yielded generally good results in segmenting the data, but some glitches still exist. These glitches can be removed using median filtering. Median filtering replaces the gray value of each data point with the median of the gray values ​​of all data points within its neighborhood window. The filter size can be manually adjusted and optimized based on the size of the RGB data of the cracks and the size of the glitches. The filtered dataset is then subjected to binary processing to output a binary dataset, where each data point has a value of either 0 or 1, resulting in a binary matrix representing the crack distribution.

[0168] Step Six: Process the binary matrix data of fracture distribution to obtain the number of rows (x) and columns (y) of the matrix. The total data size is x*y. In the binary matrix data of fracture distribution, the areas with a value of 0 represent the soil matrix, and the areas with a value of 1 represent soil fractures. Summing the binary matrix data of fracture distribution yields the fracture area s. The formula for calculating the fracture ratio (Crackratio) is as follows:

[0169] Crackratio = s / (x*y)*100%.

[0170] This invention employs an iterative refinement-based difficulty assessment mechanism. By constructing a classification difficulty model that integrates spectral features and spatial texture, and introducing an iterative algorithm based on class bias to dynamically calibrate reference anchor points, it achieves accurate quantification of data point uncertainty. This effectively solves the failure problem of traditional static analysis methods when dealing with high-uncertainty data, enabling accurate identification of critical data points even under complex interference. An adaptive hierarchical and inverse difficulty sampling strategy is adopted. Data levels are adaptively divided based on the distribution characteristics of the statistical difficulty index, and exponential sampling weights are assigned to higher difficulty levels, forcing the training dataset to focus on high-value boundary samples. This changes the sample distribution structure, eliminates overfitting of the model to large amounts of simple and redundant data, and improves the accuracy of the final physical parameter inversion.

[0171] The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details of the above embodiments. Within the scope of the technical concept of the present invention, various equivalent transformations can be made to the technical solutions of the present invention, and these equivalent transformations all fall within the protection scope of the present invention.

Claims

1. An adaptive calculation method for soil porosity based on classification difficulty gradient, characterized in that, include: Obtain the RGB data of the soil surface to be tested, and calculate the classification difficulty index of each data point in the RGB data of the soil surface; The stratification threshold is determined based on the statistical distribution characteristics of the classification difficulty index, and the data points of the soil surface RGB data are divided into a predetermined number of difficulty levels. Using a sampling ratio positively correlated with the difficulty level, data points are extracted from each difficulty level to generate a discrete candidate sample set; Obtain interactive annotation results for discrete candidate sample sets and construct a training dataset; A pre-configured classification model was trained online using the training dataset, and the trained classification model was used to classify all data points of the RGB data of the soil surface to obtain the classification results. Calculate the soil fracture rate based on the classification results of the RGB data of the soil surface. Calculate the classification difficulty index for each data point in the RGB data of the soil surface, including: Calculate the color space difficulty component and spatial neighborhood difficulty component of each data point in the RGB data of the soil surface; The color space difficulty component and the spatial neighborhood difficulty component are weighted and fused based on preset weight coefficients to obtain the classification difficulty index. The formula for calculating the classification difficulty index is: D(x, y) = α·D color (x, y) + (1-α)·D spatial (x, y); Where D(x, y) is the classification difficulty index of the data point at coordinates (x, y), D color (x, y) represents the color space difficulty components, D spatial (x, y) represents the spatial neighborhood difficulty component, and α is the weight coefficient.

2. The method according to claim 1, characterized in that, Calculate the color space difficulty component of each data point in the RGB data of the soil surface, including: Extract the fracture reference anchor points and matrix reference anchor points from the RGB data of the soil surface, respectively; Calculate the first color distance from the data point to the crack reference anchor point, and the second color distance from the data point to the matrix reference anchor point; The difficulty component of the color space is calculated based on the degree of difference between the first color distance and the second color distance.

3. The method according to claim 2, characterized in that, The extraction of fracture reference anchor points and matrix reference anchor points from the RGB data of the soil surface is achieved through an iterative refinement process, specifically including: Based on the single-channel intensity distribution quantile statistics of soil surface RGB data, the initial fracture reference anchor point and the initial matrix reference anchor point are obtained; Enter the iterative update step: calculate the class tendency of each data point relative to the current fracture reference anchor point and the current matrix reference anchor point; The pre-set confidence threshold is used to filter the category tendency, and the pre-stored fracture reference set and matrix reference set are updated based on the filtering results; Calculate the mean of the updated fracture reference set and matrix reference set to obtain the new current fracture reference anchor point and the new current matrix reference anchor point; Repeat the iterative update steps until the change in the anchor point position is less than the preset convergence threshold, and use the finally converged anchor point as the crack reference anchor point and the matrix reference anchor point.

4. The method according to claim 2, characterized in that, The formula for calculating the color space difficulty component is: D color (x,y)=1-|d crack (x,y)-d matrix (x,y)| / (d crack (x,y)+d matrix (x,y)); Where D color (x, y) represents the color space difficulty component of the data point at coordinates (x, y), d crack (x, y) represents the first color distance, i.e., the Euclidean distance from the data point to the crack reference anchor point, d matrix (x, y) represents the second color distance, i.e., the Euclidean distance from the data point to the matrix reference anchor point, and || represents the absolute value operation.

5. The method according to claim 1, characterized in that, The formula for calculating the spatial neighborhood difficulty component is: D spatial (x,y)=σ local (x,y) / σ max ; Where D spatial (x, y) represents the spatial neighborhood difficulty component of the data point at coordinates (x, y), σ local (x, y) represents the standard deviation of gray values ​​within a preset local neighborhood window centered at the data point (x, y), σ max This represents the maximum local grayscale standard deviation of all data points in the RGB data of the soil surface.

6. The method according to claim 1, characterized in that, The data points of the RGB data of the soil surface are divided into a predetermined number of difficulty levels, including: The distribution of classification difficulty index of all data points in the RGB data of soil surface is statistically analyzed. The q1 quantile of the classification difficulty index is used as the first threshold, and the q2 quantile of the classification difficulty index is used as the second threshold. Using the first and second thresholds, the data points are divided into low-difficulty, medium-difficulty, and high-difficulty layers; The low-difficulty layer contains data points whose classification difficulty index is less than the first threshold; the medium-difficulty layer contains data points whose classification difficulty index is greater than or equal to the first threshold and less than the second threshold; and the high-difficulty layer contains data points whose classification difficulty index is greater than or equal to the second threshold.

7. The method according to claim 6, characterized in that, The sampling ratio is positively correlated with the difficulty level, including: The sampling ratio for each difficulty level is set according to the principle of inverse difficulty ratio allocation; The sampling ratio for high, medium, and low difficulty levels is set as follows: P hard :P medium :P easy =β 2 :β:1; Where P hard P medium and P easy These represent the sampling ratios for high, medium, and low difficulty levels, respectively, with β being a preset difficulty weighting factor, and β>1.

8. The method according to claim 7, characterized in that, Data points are extracted from each difficulty level. Specifically, based on a pre-set total number of samples, the sampling probability for each level is calculated using the following formula, and random sampling is performed: p easy =N total / (|L easy |+β·|L medium |+b 2 ·|L hard |);p medium =β·p easy ;p hard =b 2 ·p easy ; Where p easy p medium and p hard Let N represent the probability of each data point being selected in the low, medium, and high difficulty levels, respectively. total For the total number of samples, |L easy |、|L medium | and |L hard | represents the number of data points contained in each level.

9. The method according to claim 1, characterized in that, Construct the training dataset, including: The data points contained in the discrete candidate sample set are visualized and marked on the RGB data of the soil surface. In response to manual classification instructions for the labeled data points, the category label for each data point is determined, including fracture and matrix categories; Extract the RGB color values ​​of the labeled data points as feature vectors, and combine the feature vectors with the corresponding category labels to construct the training dataset.