Rock mass classification method and device based on rock characteristics

The XGBoost model optimized by SMOTE-NC and TGCOA algorithms, combined with the improved YOLO11n-seg model, solves the problem of scarce high-risk surrounding rock samples in tunnel construction, generates reasonable samples, and improves the accuracy and safety of surrounding rock grade identification, thereby enhancing the safety and engineering applicability of tunnel construction.

CN122176401APending Publication Date: 2026-06-09XI'AN UNIVERSITY OF ARCHITECTURE AND TECHNOLOGY +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XI'AN UNIVERSITY OF ARCHITECTURE AND TECHNOLOGY
Filing Date
2026-03-23
Publication Date
2026-06-09

Smart Images

  • Figure CN122176401A_ABST
    Figure CN122176401A_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of tunnel engineering construction geology judgment, aiming at the problem of surrounding rock grade missing judgment caused by weak model generalization ability and insufficient attention to minority class samples by classification model due to the scarcity of high-risk surrounding rock samples, a surrounding rock grading method and device based on rock slag characteristics are proposed, the method generates synthetic samples conforming to the rock slag gradation and color distribution law on the basis of multi-dimensional rock slag characteristics by introducing the SMOTE-NC method with physical constraints, and dynamically optimizes the sample weight in XGBoost by combining the TGCOA algorithm, realizes high recall rate and high precision identification of high-risk surrounding rock grade, and significantly improves the engineering applicability of the surrounding rock grade prediction model and the safety of tunnel construction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of geological assessment technology for tunnel engineering construction, and in particular to a method and apparatus for classifying surrounding rock based on the characteristics of rock debris. Background Technology

[0002] During tunnel construction, the morphological characteristics and composition of rock debris generated by blasting are crucial for determining the surrounding rock grade, directly impacting construction safety control and tunneling efficiency optimization. In recent years, with the rapid development of computer vision and machine learning technologies, image-based rock debris feature extraction and surrounding rock grade classification methods have gradually replaced traditional manual assessment, showing promising application prospects. However, current methods still face several key challenges in practical applications.

[0003] First, the problem of sample imbalance is extremely prominent: due to the natural distribution characteristics of geological conditions, the number of samples of high-risk surrounding rocks (such as Class IV and V) is significantly less than that of general surrounding rocks. This causes the classification model to over-rely on majority class samples during training, resulting in poor generalization ability and a high rate of false negatives in identifying high-risk levels. This can lead to serious engineering accidents such as untimely support and landslides. Second, although data augmentation techniques are widely used to alleviate the problem of sample scarcity, traditional methods such as SMOTE-NC do not introduce the inherent constraint mechanism of rock debris physical properties when synthesizing new samples. For example, gradation parameters must meet a strict order of magnitude, and each component of color features must meet the constraints of non-negativity and a sum of 1. Otherwise, invalid samples that do not conform to the actual characteristics of rock debris are easily generated. Such "noise" samples will interfere with model training and reduce its reliability and engineering applicability. Furthermore, even if data augmentation achieves a balance in the number of samples, the loss function design of traditional machine learning models still tends to optimize the overall accuracy and does not give sufficient weight to minority class samples. This causes the model to still favor the majority class when making decisions, resulting in limited performance in identifying high-risk surrounding rocks.

[0004] In summary, to address the issues of weak model generalization ability due to the scarcity of high-risk surrounding rock samples in existing technologies, the lack of physical rationality in samples generated by traditional data augmentation methods, and the underestimation of surrounding rock grades caused by insufficient attention to minority class samples by classification models, there is an urgent need for a data augmentation method that can integrate the physical rules of rock debris to ensure the rationality and interpretability of the synthesized samples. At the same time, it should be combined with an optimization algorithm that can dynamically adjust sample weights and force the model to focus on high-risk samples, so as to fundamentally improve the comprehensive performance and engineering practical value of the surrounding rock grade prediction model. Summary of the Invention

[0005] In view of the above problems, this application provides a method and device for classifying surrounding rock based on rock slag characteristics. On the basis of multi-dimensional rock slag characteristics, the SMOTE-NC method with physical constraints is introduced to generate synthetic samples that conform to the gradation and color distribution rules of rock slag. The sample weights in XGBoost are dynamically optimized by combining the TGCOA algorithm, so as to achieve high recall and high accuracy identification of high-risk surrounding rock grades, significantly improving the engineering applicability of the surrounding rock grade prediction model and the safety of tunnel construction.

[0006] In a first aspect, embodiments of this application provide a method for classifying surrounding rocks based on rock debris characteristics, particularly suitable for identifying high-risk surrounding rocks under conditions of sample imbalance. The method includes: Rock debris features are acquired, and rock debris feature sample sets for different surrounding rock grades are obtained based on the rock debris features; the rock debris features include rock debris particle size parameters, color feature vectors, and contour sharpness coefficients; By improving the SMOTE-NC algorithm and constraining the physical properties of rock slag, the unbalanced rock slag feature sample set is expanded to establish a training dataset. An XGBoost-TGCOA grading model was constructed and trained on the training dataset. The trained XGBoost-TGCOA grading model was then used as a prediction model for the surrounding rock grade. The characteristics of the rock debris generated by blasting are input into the surrounding rock grade prediction model to obtain the surrounding rock grade prediction model output by the surrounding rock grade prediction model.

[0007] Optionally, the improved SMOTE-NC algorithm, based on constraints of the physical properties of rock slag, expands the unbalanced rock slag feature sample set to obtain a balanced training dataset, including: The samples in the unbalanced rock slag feature sample set are divided into numerical features and color features according to the physical properties of rock slag, resulting in a numerical feature subset and a color feature subset; the numerical features include rock slag particle size parameters and profile sharpness coefficient; Samples that do not meet the first and second physical constraints are removed from the numerical feature subset and the color feature subset to obtain the compliant sample set; The compliance numerical features in the compliance sample set are standardized, and the k nearest neighbors are selected from the compliance sample set by K-nearest neighbor selection to obtain the nearest neighbor sample set. Based on the nearest neighbor sample set, numerical feature interpolation results are generated through linear interpolation, and numerical feature interpolation correction is performed on numerical feature interpolation results that do not meet the first physical constraint condition. Based on the nearest neighbor sample set, color feature interpolation results are generated through linear interpolation, and color feature interpolation results that do not meet the second physical constraint condition are corrected. Repeatedly perform numerical feature interpolation correction and color feature interpolation correction until the unbalanced surrounding rock feature sample set is expanded to the preset sample size or reaches the preset sample expansion factor, to obtain the expanded rock slag feature sample set. The expanded rock slag feature sample set and the original balanced rock slag feature sample set are used as training datasets.

[0008] Optionally, the step of correcting the numerical feature interpolation results that do not meet the first physical constraint includes: Determine whether the current numerical feature interpolation result satisfies the first physical constraint condition. If not, proceed to the next step. The first physical constraint condition is: ; ; in, This represents the particle size value corresponding to a cumulative area percentage of 10%. This represents the particle size value corresponding to a cumulative area percentage of 30%. This represents the particle size value corresponding to a cumulative area ratio of 60%. This represents the maximum value of the major axis dimension of all rock debris. This represents the average sharpness of the profile of all rock fragments. Numerical feature interpolation correction is performed according to the following constraint correction rules: 1) If ,but ; 2) If ,but ; 3) If ,but ;

[0009] 4) If Then force set to ; in, , , These represent the particle size interpolation values ​​corresponding to cumulative area percentages of 10%, 30%, and 60%, respectively. Interpolation of the maximum value of the major axis dimension of all rock debris; This represents the interpolation of the contour sharpness.

[0010] Optionally, the step of correcting the color feature interpolation results that do not meet the second physical constraint includes: Determine whether the color feature interpolation result satisfies the second physical constraint. If not, proceed to the next step. The second physical constraint is as follows: ; in, For color characteristics, For color levels, ; Color feature interpolation is performed according to the following boundary constraint rules and normalization constraint rules; 1) If Then it is corrected to ; 2) If Then it is corrected to ; in, The result is the color feature interpolation. 3) Calculate the sum of the color feature interpolation results for each color level. ,like Then, the color feature interpolation results are corrected by normalization: ; in, This is the interpolation result of the color features after normalization correction.

[0011] Optionally, the XGBoost-TGCOA grading model is constructed and trained on the training dataset, and the trained XGBoost-TGCOA grading model is used as the surrounding rock grade prediction model: The weights of samples in the training dataset are dynamically adjusted using the stingless bee optimization algorithm TGCOA to obtain a weight-optimized training dataset. The weighted training dataset is input into the XGBoost model to optimize the key hyperparameters of the XGBoost model and establish the XGBoost-TGCOA hierarchical model. The validated XGBoost-TGCOA classification model was used as the prediction model for surrounding rock grade.

[0012] Optionally, the step of dynamically adjusting the sample weights in the training dataset using the Stingless Bee Optimization Algorithm (TGCOA) includes: The sample weights of high-risk surrounding rock grades in the training dataset are used as optimization variables, and the search space is set as follows: ,in, The number of samples representing high-risk surrounding rock grades in the training dataset; Generate multiple sets of random weights to cover the weight search range; During the global search phase, new combinations of sample weights are explored globally. During the balanced exploration and development phase, the sample weight combination is locally optimized. During the local optimization phase, the sample weights are adjusted by slightly perturbing the current optimal weight vector. The above three stages are executed iteratively until the maximum number of iterations is reached or the objective function converges, at which point the optimal weights are output.

[0013] Optionally, the objective function is: ; in, For the first Number of samples of surrounding rock grade For the first The accuracy of the surrounding rock classification For the first Recall rate for Class I surrounding rock grades The weighted average F1 score.

[0014] Secondly, embodiments of this application provide a surrounding rock classification device based on rock slag characteristics, implemented using the above-described method, the device comprising: The acquisition module is used to acquire the characteristics of rock debris of different surrounding rock grades, and to obtain rock debris characteristic sample sets of different surrounding rock grades based on the rock debris characteristics; the rock debris characteristic sample sets of different surrounding rock grades are divided into balanced rock debris characteristic sample sets and unbalanced rock debris characteristic sample sets. The sample expansion module is used to expand the unbalanced rock slag feature sample set by improving the algorithm through SMOTE-NC and based on the constraints of rock slag physical properties, and to establish a training dataset. The model building module is used to input the training dataset into the XGBoost-TGCOA grading model, and use the trained XGBoost-TGCOA grading model as the surrounding rock grade prediction model. The output module is used to input the acquired rock debris features into the surrounding rock grade prediction model to obtain the surrounding rock grade prediction model output by the surrounding rock grade prediction model.

[0015] Compared with the prior art, the specific beneficial effects of the present invention are as follows: First, this invention addresses the problem that traditional SMOTE-NC interpolates numerical features of minority class samples to generate new samples, but fails to consider the inherent physical rules of rock slag characteristics, which can easily generate samples that violate engineering realities. The invention improves the traditional SMOTE-NC method through a three-layer design of constraint screening, interpolation generation, and dynamic correction. The improved SMOTE-NC method based on physical constraints is used to enhance and expand the unbalanced rock slag feature dataset, generating a balanced rock slag feature sample set for high-risk surrounding rock grades. This achieves dataset balancing while ensuring that all generated samples conform to the physical characteristics of rock slag. Secondly, this invention constructs an XGBoost hierarchical model (XGBoost-TGCOA hierarchical model) that integrates the TGCOA sample weight optimization mechanism. This model uses a balanced dataset enhanced with physical constraints SMOTE-NC as input and dynamically adjusts the weights of training samples using the Trapa Bee Colony Optimization Algorithm (TGCOA), thereby strengthening the model's ability to identify high-risk samples. Combining XGBoost's advantages in handling high-dimensional feature coupling relationships, a high-precision classification mapping from rock debris parameters to surrounding rock grades is achieved. Experimental results show that this model significantly improves the recall rate of high-risk surrounding rock grades while maintaining overall classification accuracy, providing reliable technical support for risk pre-control during tunnel engineering construction. Attached Figure Description

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

[0017] Figure 1 This is a distribution map of the number of surrounding rock grade data.

[0018] Figure 2 This is the confusion matrix of the XGBoost model.

[0019] Figure 3 It is an improved SMOTE-NC algorithm + XGBoost model confusion matrix.

[0020] Figure 4 It is an improved SMOTE-NC algorithm + XGBoost-TGCOA model confusion matrix.

[0021] Figure 5 This is the overall framework diagram for constructing a surrounding rock grade prediction model.

[0022] Figure 6 This is the distribution of the number of samples in the dataset after the enhancement of the high-risk surrounding rock grade.

[0023] Figure 7 This is a basic flowchart of the XGBoost-TGCOA algorithm.

[0024] Figure 8 It is the result of comparing the actual surrounding rock grade with the predicted surrounding rock grade on the validation set.

[0025] Figure 9This is a structural diagram of the improved YOLO11n-seg model.

[0026] Figure 10 These are comparison images of model segmentation results; Figure 10 In the image: (a) is the original rock debris image, (b) is the YOLO11_seg segmentation result, and (c) is the segmentation result of the improved model. Detailed Implementation

[0027] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.

[0028] Example 1: This example provides a method for classifying surrounding rock based on rock debris characteristics, including the following steps: Step 1: Extract the characteristics of rock debris from different surrounding rock grades generated by blasting, and obtain rock debris characteristic sample sets for different surrounding rock grades based on the rock debris characteristics; the rock debris characteristics include rock debris particle size parameters, color feature vectors, and contour sharpness coefficients; Furthermore, the original image of the rock debris generated by blasting is first acquired through an image acquisition device. Then, the rock debris segmentation result image is obtained through an improved segmentation model based on YOLO11n-seg. Based on the rock debris segmentation result image, the rock debris particle size parameter, color feature vector and contour sharpness coefficient are extracted.

[0029] The latest YOLO11-seg model includes a backbone, a neck, and a head. However, the multi-scale edge enhancement module (MEEM) in the backbone of the existing YOLO11-seg model only focuses on spatial domain edge features, which is a limitation. Based on the multi-scale edge enhancement module, a spatial frequency enhancement sub-module is introduced to obtain the multi-scale spatial frequency fusion enhancement module (MSFEM). Therefore, this application proposes an improved segmentation model based on YOLO11n-seg, such as... Figure 9 As shown, the improved segmentation model based on YOLO11n-seg is based on the YOLO11n-seg model. It is obtained by introducing a spatial frequency fusion enhancement module into the backbone network of the YOLO11n-seg model and replacing the neck network with the TripleGD-Neck module.

[0030] The multi-scale spatial frequency fusion enhancement module includes a separable convolutional layer, three parallel branches, a spatial frequency enhancement submodule and a feature stitching layer located after each parallel branch; wherein, the depthwise separable convolutional layer is a 5×5 depthwise separable convolution, which significantly reduces the computational load while being used to extract global contour information from the rock debris image. ; Three parallel branches are connected to a depthwise separable convolutional layer, and then passed through different scales ( , , The convolution kernels operate in parallel to accurately capture the multi-scale features of rock debris particles, and utilize... Average pooling reduces the feature map size, thus reducing the computational burden on subsequent operations. Each parallel branch outputs a multi-scale feature map. , , ; Each parallel branch is followed by a spatial frequency enhancement submodule, which is used to enhance the spatial and frequency domain details and textures in the multi-scale feature images, resulting in multi-scale spatial-frequency enhanced features. , , ; The feature concatenation layer is used to concatenate the multi-scale spatial frequency enhancement features output from the three parallel branches through a Concat operation, integrating information from different dimensions, and then... Convolution adjusts the dimensions and removes redundancy to obtain spatial frequency enhanced fusion features.

[0031] The spatial frequency enhancement submodule first segments the input multi-scale features through channel segmentation, and then inputs the segmented features into the spatial domain branch and the frequency domain branch respectively. Next, in the spatial domain branch, average pooling is used to separate the low-frequency background and high-frequency edges in the image, enhancing the clarity of the rock debris boundary and obtaining spatial features. At the same time, in the frequency domain branch, FFT transformation combined with low-pass filtering is used to separate low-frequency redundancy and extract high-frequency texture features. Finally, the SimAM attention mechanism is introduced to weightedly fuse the spatial features and high-frequency texture features, and the fused enhanced spatial frequency features are output through convolution.

[0032] Because the existing YOLO algorithm's Neck network relies on fixed convolutions and upsampling to achieve feature fusion, it suffers from an inherent flaw of feature dimension imbalance, resulting in limited accuracy in multi-scale slag recognition and difficulty in simultaneously detecting particles of different sizes and resolving their contours. To address this, this application introduces the GD-Neck module, which can construct multi-scale feature associations through a collection-distribution process. However, the traditional GD-Neck uses a Low-GD and High-GD dual-branch architecture. When applied to feature extraction of medium-scale slag particles, it suffers from a large span between shallow and deep feature fusion, and the easy loss of medium-scale details. Therefore, this application further improves the traditional GD-Neck model, resulting in the TripleGD-Neck module.

[0033] The TripleGD-Neck module is based on the original GD-Neck framework in YOLO11n-seg. After adding the Middle-GD branch, it forms a three-branch structure of Low-GD, Middle-GD, and High-GD, which are used to extract and fuse small-grained, medium-grained, and large-grained rock debris, respectively. Each branch includes a feature alignment module FAM, a feature information fusion module IFM, and a feature information distribution module Inject with the same structure. Compared with FAM, IFM, and Inject in the original GD-Neck, the FAM alignment operation logic in TripleGD-Neck remains unchanged, but the reference size and the range of input features are adjusted according to the small, medium, and large scales of the rock debris. The IFM of each branch uses the RepConv-Blocks module to extract features, abandoning the Transformer module to avoid a surge in computation. The structure of the Inject module of each branch remains unchanged. Furthermore, FAM uses the size of the intermediate input feature map input2 as a benchmark, downsampling the larger feature map input1 using average pooling and upsampling the smaller feature map input3 using bilinear interpolation to unify the feature map sizes. Then, a concat operation is used to obtain the merged features. The IFM module includes a convolutional module (Conv), a RepConv-Blocks module, and a split operation. The merged features output by FAM are input into the RepConv-Blocks module for multi-scale feature semantic association to generate global fused features. Then, convolutional Conv is used to adjust the channels to adapt to the size of different feature levels. Finally, a split operation is used to split the global fused features into two global features, Inject_output1 and Inject_output2, on the channel, and then feature fusion is performed with features from different levels. The Inject module employs a lightweight self-attention mechanism, taking local features x_local (such as S2 layer features) at the current scale and global features x_global (such as Inject_output1) generated by IFM as input. If the sizes are inconsistent during the fusion process, they can be handled by average pooling or bilinear interpolation. After RepConv-Blocks further extracts and fuses the features, the final output is the enhanced target-scale features (such as B3), realizing the supplementation and enhancement of local details by global semantics.

[0034] To verify the optimization effect of the improved segmentation model based on YOLO11n-seg, ablation experiments were conducted using the original YOLO11_seg model as a benchmark, with core indicators such as precision, recall, mAP50 (average precision at IoU=0.5) and mAP50-95 (mean average precision in the IoU range of 0.5-0.95). The specific experimental results are shown in Table 2. Table 2 Ablation Experiment Results ; As shown in Table 2, the performance indicators of both the MSFEM and TripleGD-Neck modules reached the highest, proving that the MSFEM and TripleGD-Neck modules of this invention can improve the feature representation ability of complex rock debris images and enhance the multi-scale rock debris recognition accuracy. Furthermore, through... Figure 10 By comparing the original rock debris image, the segmentation results of the original YOLO11_seg model, and the segmentation output of the improved segmentation model based on YOLO11n-seg, the significant advantages of the improved segmentation model based on YOLO11_seg proposed in this invention in detail processing such as small particle detection and blurred boundary repair are intuitively demonstrated, and the improved segmentation model's adaptability to complex rock debris scenes is effectively verified.

[0035] Furthermore, the specific steps for calculating rock debris features using the rock debris segmentation result image include: A1: Input the acquired rock debris image into the trained improved segmentation model based on YOLO11n-seg, and output the rock debris segmentation result image; A2: Extract the geometric features of the rock debris segmentation result image based on the pixel-physical scale coefficient of the image and the reference object; the geometric features include the actual major axis, actual minor axis, actual perimeter of the contour, and actual area of ​​the rock debris; Furthermore, A2 includes: A2.1: Calculate the number of pixels of the reference object in the image, establish the mapping relationship between pixels and actual size, and thus determine the pixel-physical ratio coefficient of the pixel length and actual physical length of the rock slag segmentation result image; By establishing a scale mapping relationship between the pixel length and the actual physical length of the rock debris segmentation image using a pre-defined reference object of known size in the image, the pixel-physical scale coefficient is obtained. for: ; Assuming the actual length of the reference object is known to be 60cm, corresponding to an image width of 640 pixels, the actual length represented by each pixel in the current rock debris segmentation image can be calculated using the above formula: ; This pixel-to-physical scale factor serves as the core basis for all subsequent geometric parameter calculations, ensuring that pixel-level measurement results can be accurately converted into physical dimensions.

[0036] A2.2: Extract the pixel contour information of each slag block in the slag segmentation result image to determine the contour of each slag block; Based on the rock slag segmentation results image, pixel-level contour information of each segmented region (slag block) in the image is extracted to fully capture the boundary details of the rock slag particles, providing accurate boundaries for subsequent geometric calculations.

[0037] A2.3: Based on pixel contour information, the minimum bounding rectangle algorithm is used to generate the minimum rectangle that encloses the contour, and the actual axial length of each slag block is determined according to the minimum rectangle and the pixel-physical ratio coefficient. For the contour of each slag block (segmentation region) in the slag segmentation result image, the minimum bounding rectangle (MBR) algorithm is used to generate the minimum rectangle that encloses the contour. The long side and short side of the minimum rectangle are used as the major axis and minor axis of the slag block, respectively. The major axis and minor axis are converted from pixel value (i.e. pixel axis length) to actual length (unit: cm) through pixel-physical scaling coefficient to obtain the actual axis length (including the length of the major axis and minor axis) of each slag block. The formula for converting actual shaft length is: ; A2.4: Count the number of pixels within the outline of each slag block, determine the pixel area of ​​the slag block, and convert the pixel area into the actual area according to the pixel-physical ratio coefficient; The pixel area of ​​each slag block can be obtained by counting the number of pixels within its outline. Then, the pixel area can be converted into the actual physical area using the following formula (unit: ): ; The obtained actual area value is used as a key parameter to characterize the size of the slag block and is used for subsequent gradation analysis; A2.5: Based on the pixel sequence of each slag block outline, obtain the outline pixel perimeter of the slag block, and convert the outline pixel perimeter into the actual outline perimeter according to the pixel-physical ratio coefficient. The pixel sequence of each rock debris block contour is recorded by the contour tracking algorithm. After scale conversion, the actual perimeter of the contour (unit: cm) is obtained, which provides basic data for the calculation of shape features such as roughness index. .

[0038] A3: Calculate the rock slag particle size parameters based on the geometric features of the rock slag segmentation result image; Furthermore, A3 includes: A3.1: Divide the rock debris particles in the image into multiple particle size intervals based on the actual long axis of the rock debris, and count the number of rock debris in each particle size interval and the area ratio of the particle size interval. Furthermore, the area ratio of the particle size range refers to the ratio of the total area of ​​all rock debris particles in the particle size range to the actual area of ​​the entire rock debris region.

[0039] A3.2: Based on the maximum value of the actual long axis of all rock slag particles within the particle size range, the maximum particle size of rock slag in each particle size range is obtained; Furthermore, the maximum value (in cm) of the actual major axis of all rock debris particles in each particle size range is taken as the maximum particle size of that range. Used to reflect the maximum particle size boundary of a particle group, i.e. ,in, Let be the actual major axis of the i-th rock debris particle; A3.3: Arrange the actual area of ​​the slag particles in each particle size range in ascending order, and obtain the first characteristic particle size based on the particle size values ​​when the cumulative area ratio is 10%, 30%, and 60%. Second characteristic particle size and third characteristic particle size The cumulative area percentage is the area percentage obtained by successively adding the area percentages of each particle size range, starting from the smallest particle size range. Furthermore, the cumulative area percentage refers to the result obtained by successively adding up the area percentages of all particle size intervals, starting from the smallest particle size interval. For example, if [0~2) accounts for 5% + [2~4) accounts for 5% = cumulative 10%, then the particle size interval [2~4) is the first characteristic particle size. .

[0040] A3.4: The non-uniformity coefficient of rock slag is obtained based on the ratio of the third characteristic particle size to the first characteristic particle size; Furthermore, the coefficient of non-uniformity The coefficient of non-uniformity is used to measure the degree of non-uniformity in particle size distribution. The larger the non-uniformity coefficient, the wider the particle size distribution range. .

[0041] A3.5: The first product is obtained based on the first characteristic particle size and the third characteristic particle size. The curvature coefficient of the rock slag is obtained based on the ratio of the square of the second characteristic particle size to the first product. Furthermore, the curvature coefficient Used to evaluate the smoothness of particle size distribution curves, reflecting the proportion of intermediate particle sizes, and .

[0042] A3.6: The roughness index is determined by accumulating the percentage of the total area of ​​the rock slag particles that are greater than the upper limit of each particle size range to the actual area of ​​the entire rock slag region; Furthermore, the roughness index The roughness index is used to reflect the dispersion of particle size distribution. A higher roughness index indicates a higher proportion of large-diameter particles, resulting in a more dispersed particle size distribution.

[0043] in, The total area of ​​all rock debris particles (unit: ); The total area of ​​all particles with a diameter greater than or equal to the upper limit of the i-th particle size range (unit: Taking the aforementioned particle size ranges [0~2), [2~4), [4~6), [6~8), [8~10), [10~15), [15~20), [20~30) as an example, when i=2, The total area of ​​all particles whose particle size is greater than or equal to the upper limit 2 of the first particle size range [0~2), i.e. The total area of ​​particles with a diameter ≥ 2 cm, when i = 3, The total area of ​​all particles with a diameter greater than or equal to the upper limit 4 of the second particle size range [2~4), i.e. The total surface area of ​​particles with a diameter ≥ 4 cm; This represents the total number of groups, i.e., the number of particle size ranges.

[0044] A4: Calculate the contour sharpness coefficient based on the rock slag segmentation result image; The smoothness of the contour edges of rock debris generated during tunnel excavation or rock fracturing is closely related to the integrity, strength, and other mechanical properties of the surrounding rock. Generally, rock debris particles with sharp edges and irregular heights originate from fractured, jointed surrounding rock; conversely, rock debris with smooth edges and rounded corners often comes from surrounding rock with good integrity and high strength. To objectively quantify the sharpness of the contour edges of rock debris particles and establish its correlation with surrounding rock characteristics, a formula for calculating the Contour Sharpness Coefficient (CSC) is proposed. This parameter transforms the geometric angular characteristics (morphological features) of the rock debris contour into a calculable quantitative index. The contour sharpness coefficient allows for the inference of the integrity or degree of fracturing of the surrounding rock through morphological analysis of the rock debris.

[0045] Specifically, A4 includes: A4.1: Obtain the first [item] from the rock debris segmentation result image. A binary mask image of the first rock fragment is obtained; then, the closed contour of the rock fragment is extracted using the Canny edge detection algorithm to obtain the second... The outline pixel set of a rock slag ,in This represents the perimeter in pixels of the rock debris outline. Indicates the perimeter in pixels. The number of pixels. To improve efficiency while maintaining computational accuracy, adaptive sampling of the contour pixel set is required, with the number of sampling points... The calculation formula is: ; in, This is the floor function. The above formula is for larger rock debris ( Sampling 1 point every 10 pixels, for smaller rock debris ( Twenty sampling points are forcibly retained to fully capture basic morphological features. Using the above method, a set of evenly spaced sampling points uniformly distributed on the closed contour can be obtained. .

[0046] A4.2: For equally spaced sampling point sets Each sampling point in The angle between two adjacent sides is calculated using adjacent vectors. Define the vectors for two adjacent sides: the forward vector... (from the current sampling point) Point to the previous sampling point ), backward vector (from the current sampling point) Point to the next sampling point Since the contour is closed, special treatment is required for the boundary points: when hour, ;when hour, .

[0047] Sampling points The angle of the outline at the location Calculated using the vector dot product formula: ; In the formula, For vectors and dot product, They are vectors , The length of the module.

[0048] It should be noted that, For interior angles of the contour, the concavity or convexity is determined by the vector direction during calculation. When the interior angle of a concave angle is greater than 180°, the exterior angle is used. This serves as the actual turning angle, avoiding misjudgment of the angle of the concave contour. Finally, the convex point... and the concave point Unified as , It is a turning angle. The smaller the value, the sharper the inflection point. This is obtained through the method described above. It can directly reflect the degree of edge transition, providing a quantitative basis for subsequent angle judgment.

[0049] A4.3: Based on the classification of turning angle types, count the number of different types of edges in each rock debris profile, and calculate the weighted sum of the number of different types of edges. Use the ratio of the weighted sum to the total number of edges as the profile sharpness coefficient of each rock debris. Specifically, to comprehensively characterize the overall sharpness of the edges and corners of a single rock fragment profile, it is necessary to base it on the turning angle. Perform weighted statistics. The size of the edges is used to classify them into three categories: When the included angle When the angle is sharp, the weight is 20, where 20 represents the original point values ​​on the left and right sides of that point; when the angle is... When the angle is relatively sharp, the weight is 10; when the angle is... When the angle is smooth, the weight is 0.

[0050] Define intermediate variables Used for statistics The weighted sum of the sharpness of the edges in the profile of the rock debris. The ratio of the weighted sum of different edge angles to the total number of edge angles is used as the profile sharpness coefficient of a single rock fragment. , and The calculation formulas are as follows: ; ; In the formula, This represents the number of sampling points (i.e., the total number of edges and corners). The larger the value, the more pronounced the contours and the more uneven the edges of the rock debris.

[0051] A4.4: The contour sharpness coefficients of all rock debris in the binary mask image are summed and averaged to obtain the overall contour sharpness coefficient of the rock debris segmentation result image; Furthermore, if the binary mask image contains To comprehensively reflect the angular features of the rock fragments in the image, the sharpness coefficient of all rock fragments is averaged to obtain the overall contour sharpness coefficient of the rock fragment segmentation result image: ; This indicator can be used to compare the differences in the angular features of rock debris in different images, thereby inferring the integrity or degree of fragmentation of the surrounding rock. The higher the value, the more fractured the surrounding rock that produces these rock fragments; conversely, the lower the value, the better the integrity of the surrounding rock.

[0052] A5: Based on the rock slag segmentation result image, extract the rock slag color features to obtain the rock slag color feature vector; Furthermore, A5 includes: A5.1: Obtain the binarized image of the rock slag segmentation result image and extract the mask contour of the target area; Furthermore, after binarizing the rock slag segmentation result image, the image can be converted into a black and white binary form to obtain a binary image; the mask contour of the target area is extracted by the contour detection algorithm and marked on the original image with a green contour line, which can accurately locate the edge shape of the target.

[0053] A5.2: Based on the mask contour of the target region, the original unsegmented initial rock debris image is cropped, retaining the target region within the contour and removing redundant background to obtain a cropped image containing only rock debris; A5.3: Statistically analyze the pixel values ​​of each rock debris region in the cropped image containing only rock debris, calculate the brightness value, and use the brightness value as the color feature of the rock debris; The formula for calculating the brightness value is: ,in These represent the pixel values ​​of the red, green, and blue channels of the image, respectively.

[0054] A5.4: The color features are divided into different color levels using the quantile partitioning method. The proportion of each color level in each rock debris image is counted. The color feature vector of each rock debris image is obtained by using the proportion of color level as the dimension. Furthermore, to achieve quantitative analysis of color features, a data-driven quantile classification method is used to divide the color features into different color levels. In this embodiment, the color features are divided into five levels. The specific classification steps are as follows: 1) Data collection: The brightness values ​​of all surrounding rock grades of rock debris are summarized as the color characteristic benchmark.

[0055] 2) Quantile Calculation: The 20%, 40%, 60%, and 80% quantiles of the luminance data are calculated using the np.quantile function in the NumPy library. These quantiles are then combined with 0 and 255 to form the boundaries of the five levels. The boundary points for the five levels are 0, 100, 125, 145, 170, and 255. Therefore, the five color level intervals are as follows: Color level b1: [0, 100); Color level b2: [100, 125); Color level b3: [125, 145); Color level b4: [145, 170); Color level b5: [170, 255].

[0056] Dividing color features into different color levels can adapt to the distribution characteristics of rock slag color, making the level division in the middle brightness range more dense and better distinguishing the color features of different levels of rock slag.

[0057] 3) Grade mapping: Map the brightness value of each rock fragment to the corresponding grade to achieve the discretization of color features.

[0058] To comprehensively characterize the color features in the images, the color feature vector of each color grade of rock debris was constructed by statistically analyzing the proportion of rock debris of each color level in a single real-time acquired rock debris image. The specific steps are as follows: 1) Color grade frequency statistics: Count the color grades of all rock debris in a single image and calculate the proportion of the number of rock debris of each color grade to the total number of all rock debris. For example, the proportion of color grade b1 = the number of rock debris with color in the b1 range / the total number of rock debris.

[0059] 2) Feature vector construction: Construct the color feature vector of the rock debris image using the proportion of color level as the dimension (e.g., [color level b1 proportion, color level b2 proportion, ..., color level b5 proportion]); A6: Establish the rock slag feature matrix based on the rock slag particle size parameters, profile sharpness coefficient, and rock slag color feature vector.

[0060] Specifically, the characteristics of the obtained rock debris are shown in Table 1.

[0061] Table 1. Definition and Calculation Method of Rock Slag Characteristics ; Step 2: Using the SMOTE-NC improved algorithm, based on the constraints of the physical properties of rock slag, the unbalanced rock slag feature sample set is expanded to establish a training dataset. According to industry standards such as the "Design Specifications for Highway Tunnels, Volume 1: Civil Engineering" (JTG 3370.1-2018) and the "Design Specifications for Railway Tunnels" (TB 10003-2016), surrounding rock is typically classified into five levels: Class I (stable), Class II (basically stable), Class III (poorly stable), Class IV (unstable), and Class V (extremely unstable). Among these, the number of samples for high-risk surrounding rock (such as Class IV and Class V) is significantly less than that for general surrounding rock levels. This leads to the classification model over-reliance on majority class samples during training, resulting in poor generalization ability and a high false negative rate for high-risk levels. Therefore, to address this problem, this invention optimizes the traditional SMOTE-NC (Synthetic Minority Over-sampling Technique for Nominal and Continuous) method and expands the sample set of high-risk surrounding rocks (such as Class IV and V) with significant imbalance. Its core lies in embedding the constraints of rock debris physical properties into the entire process of virtual sample generation, avoiding invalid samples from the source and ensuring the engineering rationality of the augmented data.

[0062] Traditional SMOTE-NC methods generate new samples by interpolating the numerical features of minority class samples. While this can expand the sample base, it fails to consider the inherent physical rules governing rock debris characteristics. For example, gradation parameters must meet strict ordering requirements, and color parameters must conform to proportional constraints. This can easily lead to the generation of samples that do not conform to engineering realities (e.g., ...). The gradation, color ratio, and parameters not equal to 1 (these factors ultimately affect the stability and reliability of the grading model) are considered. Therefore, in this embodiment, an improved SMOTE-NC algorithm is obtained through a three-layer design of constraint screening, interpolation generation, and dynamic correction to ensure that all generated samples conform to the physical properties of rock slag. Figure 1 The distribution map of the number of surrounding rock grade data shows that the number of samples of grades IV and V is significantly lower than that of other grades, with grade V having the fewest samples. It is an unbalanced sample set and the core target of data augmentation.

[0063] Optionally, step 2 may include the following sub-steps: Step 2.1: Separate the samples in the unbalanced rock slag feature sample set according to the physical properties of the rock slag to obtain a numerical feature subset and a color feature subset; Specifically, the rock debris feature sample set is divided into a balanced rock debris feature sample set and an unbalanced rock debris feature sample set. The unbalanced rock debris feature sample set is a dataset of high-risk surrounding rock grades (such as Grade IV and Grade V) with a significantly smaller sample size than that of general surrounding rock grades. Specifically, it can be Grade V surrounding rock, and the rock debris feature sample set of Grade V surrounding rock is denoted as... ,in The sample size is [number], and each sample contains 13 dimensions of rock debris features; Next, the samples in the rock debris feature sample set of Class V surrounding rock are divided into two categories according to the physical properties of the rock debris: one is numerical features, which include gradation parameters (i.e., particle size parameters) and profile sharpness. These features have clear physical dimensions and numerical constraints; the other is color features, which represent the proportion of different colors of rock debris and need to satisfy the constraint that the sum is 1. This results in a subset of numerical features composed of numerical features and a subset of color features composed of color features.

[0064] Step 2.2: Remove samples from the numerical feature subset and color feature subset that do not meet the physical constraints, and obtain a compliant sample set consisting of compliant numerical feature subset and color feature subset; When cleaning samples from the numerical feature subset and the color feature subset respectively, outlier samples that violate physical constraints are removed; the physical constraints include: The first physical constraint on the numerical characteristics: (1); (2); Second physical constraint on color features: (3); in, For color characteristics, For color levels, ; This represents the particle size value corresponding to a cumulative area percentage of 10%. This represents the particle size value corresponding to a cumulative area percentage of 30%. This represents the particle size value corresponding to a cumulative area ratio of 60%. This represents the maximum value of the major axis dimension of all rock debris. This represents the average sharpness of the profile of all rock fragments. When cleaning samples in the numerical feature subset, non-compliant samples are excluded according to equations (1) and (2). When cleaning samples in the color feature subset, non-compliant samples are excluded according to equation (3). After sample cleaning, compliant cleaned numerical feature subsets and color feature subsets can be obtained. Combining the two yields a compliant sample set. ,Will As a foundation for subsequent data enhancement, ensure that all underlying data used thereafter is compliant.

[0065] Step 2.3: Standardize the compliance numerical features in the compliance sample set, and select the k nearest neighbors from the compliance sample set using K-nearest neighbor selection to obtain the nearest neighbor sample set; Specifically, due to the inconsistent numerical feature scales, it is necessary to first process the compliant sample set. The numerical feature samples in the matrix are standardized using the RobustScaler method (based on quantiles to eliminate the influence of outliers) to transform them to the same scale, thus eliminating the interference of dimensional differences on distance calculation and obtaining the standardized numerical feature matrix. The color features are values ​​in the range [0,1], which do not require standardization and can be directly used to obtain the color feature matrix. ; Again and For each seed sample, calculate its Euclidean distance to other samples. The initial screening process involves selecting the k nearest neighbors (usually k=5) based on both numerical and color features to obtain the nearest neighbor set of the compliant sample set. ,in, Let be the i-th nearest neighbor sample, which is a numerical feature or a color feature.

[0066] Step 2.4: Based on the nearest neighbor sample set, generate numerical feature interpolation results through linear interpolation, and perform dynamic correction on the numerical feature interpolation results based on the first physical constraint condition; Furthermore, to ensure the orderliness of rock slag parameters (gradation parameters) and... To ensure the nonnegativity of , the following operations are required: First, linear interpolation. Randomly select a nearest neighbor sample with numerical features from the nearest neighbor sample set. Generate interpolation coefficients that follow a uniform distribution. And through interpolation coefficients Linear interpolation is performed on the numerical features of each compliant sample set: ; in, Representative gradation parameters and the sharpness of the outline , This represents the i-th gradation parameter or profile sharpness. Represents the j-th gradation parameter or profile sharpness. This represents the newly generated interpolated sample, i.e., the numerical feature interpolation result; Secondly, constraint correction. For interpolation results that do not meet the first physical constraint conditions, i.e., do not satisfy equations (1)-(2), correction is performed according to the following principles: like ,but ; like ,but ; like ,but ; like Then force set to ; in, These represent the particle size interpolation values ​​corresponding to cumulative area percentages of 10%, 30%, and 60%, respectively. Interpolation of the maximum value of the major axis dimension of all rock debris; Interpolation representing the sharpness of the contour; Through the above dynamic correction, the non-negativity of the interpolated samples is ensured, which conforms to the physical meaning.

[0067] Step 2.5: Based on the nearest neighbor sample set, generate color feature interpolation results through linear interpolation, and perform boundary correction on the color feature interpolation results based on the second physical constraint condition, and normalize the boundary correction results. To ensure consistency with the color feature distribution of the original samples, the following steps are used to generate compliant color feature interpolation results: First, initial generation based on sample interpolation. Similar to numerical feature sample interpolation, seed samples are generated from the compliant sample set. Color features of neighboring samples in the nearest neighbor sample set The corresponding color parameters are introduced. Perform linear interpolation to obtain the initial color feature interpolation result. : Secondly, corrections are made to the color feature interpolation results that do not meet the second physical constraint, i.e., do not satisfy equation (3), specifically including: 1) Boundary constraint correction. This applies to the initial interpolation results. May exceed For interval issues, perform boundary correction if... Then it is corrected to Since the proportion of a single color cannot exceed 100%, it is directly set as the upper limit; if Then it is corrected to Since the color percentage cannot be negative, it is directly set to the lower limit value.

[0068] 2) Normalization constraint correction. Calculation The sum ,Right now ,like Then, the sum is normalized using the formula. After correction, the final color feature interpolation result is obtained. : ; The above formula ensures that the final generated color feature interpolation sample satisfies both the non-negativity and summation to 1 constraints, and maintains consistency with the color feature pattern of the original sample.

[0069] Step 2.6: Repeat steps 2.4-2.5 until the unbalanced surrounding rock feature sample set is expanded to the same sample size as other balanced surrounding rock feature sample sets or reaches the preset sample expansion factor, to obtain the expanded balanced rock slag feature sample set, and use the balanced rock slag feature sample set and the expanded balanced rock slag feature sample set as training datasets. Specifically, for each seed sample Repeat the above interpolation process for numerical and color feature samples until the sample set size for high-risk surrounding rock grades (such as Class V surrounding rock samples) is expanded to a level comparable to the sample size for other surrounding rock grades. In this embodiment, taking the expansion of Class V surrounding rock samples as an example, to balance the need for sample balance and the model's generalization ability, the sample expansion factor is set to 6, resulting in a total of 678 Class V surrounding rock samples after expansion (e.g., ...). Figure 6 As shown in the figure, the sample size is comparable to that of Class IV surrounding rock, while avoiding data distribution shift or model overfitting caused by excessive generation of virtual samples. Finally, a training dataset can be obtained, consisting of Class I, Class II, Class III, Class IV, and Class V expanded surrounding rock sample sets.

[0070] Step 3: Construct the XGBoost-TGCOA grading model and train it on the training dataset. Use the trained XGBoost-TGCOA grading model as the surrounding rock grade prediction model.

[0071] Although the SMOTE-NC method, which uses physical rules to generate compliant virtual samples, effectively alleviates the problem of sample scarcity for high-risk surrounding rock grades and provides a relatively balanced dataset for model training, the limited number of original minority class samples means that over-reliance on synthetic samples can still lead to overfitting. Traditional machine learning models are often dominated by majority class samples during training, resulting in insufficient ability to identify high-risk surrounding rock grades, which may lead to serious consequences such as tunnel collapse and construction accidents. Therefore, this embodiment constructs an XGBoost hierarchical model (XGBoost-TGCOA) that integrates the TGCOA sample weight optimization mechanism.

[0072] Optionally, such as Figure 5 As shown, step 3 includes the following steps: Step 3.1: Dynamically adjust the sample weights in the training dataset using the Stingless Bee Optimization Algorithm (TGCOA) to obtain the weight-optimized training dataset; Traditional XGBoost models assume equal weights for all training samples, making it difficult to address class imbalance and resulting in a low proportion of loss for high-risk samples in the total loss. To address this, this invention introduces the Stingless Bee Optimization Algorithm (TGCOA), which dynamically optimizes sample weights through a biomimetic intelligent search strategy, thereby increasing the model's attention to minority class samples.

[0073] Optionally, combined Figure 7 Step 3.1 includes the following sub-steps: Step 3.1.1: Use the sample weights of high-risk surrounding rock grades in the training dataset as optimization variables to set the search space. ,in, The number of samples representing high-risk surrounding rock grades in the training dataset; For the obtained balanced training dataset Its sample weight vector is ,in, for The first in The weights of each sample, for The number of samples in the dataset, to avoid overfitting due to excessive weights, needs to meet the following requirements. Therefore, the search space is defined as That is, the value of each weight ranges from 0 to 1.

[0074] Step 3.1.2: Generate multiple sets of random weights (stingerless wasp individuals) to cover the weight search interval; Step 3.1.3: In the global search phase, explore new combinations of sample weights globally; In the initial global search phase of optimization, a cooling tremor strategy is used to simulate the strong tremor behavior of stingless wasps in a low-temperature environment, thus avoiding getting trapped in local optima. The sample weight calculation formula for this phase is as follows: ; in, The coefficient of performance is the cooling factor. The maximum number of iterations, For individual indexes; Step 3.1.4: In the balanced exploration and development phase, locally optimize the sample weight combination; In the transition phase of optimization, a spiral construction strategy is used to simulate the spiral nesting trajectory of stingless bees. The randomness of the Cauchy distribution is combined to enhance search diversity, and the sample weights are optimized. ; in, , , For the helix angle, , .

[0075] Step 3.1.5: In the local optimization stage, adjust the sample weights by slightly perturbing the current optimal weight vector; In the later stages of local optimization, a heating and vibration strategy is used to simulate the slight nest-building movements of stingless wasps in a warm environment, enabling fine-grained local search. This approach is suitable for local optimization in the later stages of optimization. By slightly perturbing the current optimal weight vector, the sample weights for high-risk surrounding rock grades are fine-tuned. ; in, For the first Round One weight vector; For the first The globally optimal weight vector of the wheel; This represents the average deviation of the bee colony. The size of the bee colony (take 2~5). Selected randomly Individual indexes; The disturbance coefficient is taken as 0.2~0.3. This is the temperature coefficient (taken as 0.03).

[0076] Step 3.1.6: Iteratively execute steps 3.1.3-3.1.5 until the maximum number of iterations is reached or the objective function converges, and output the optimal weights; In this embodiment, the merits of the sample weight allocation scheme are evaluated based on the fitness function. The fitness value is used as the optimization objective function to minimize the error rate. :

[0077] in, For the first Number of samples of Class I surrounding rock grade For the first The accuracy of the surrounding rock classification For the first Recall rate for Class I surrounding rock grades The weighted average F1 score, The calculation method is as follows: based on the number of samples in each category For The scores are weighted and summed, then divided by the total number of samples. It can better reflect the overall performance of the model on imbalanced datasets.

[0078] This fitness function prioritizes performance on the minority class, avoiding the bias of conventional accuracy towards the majority class. When The smaller the value, the better the model performance; TGCOA updates the weight vector iteratively until... The system converges or reaches the maximum number of iterations, outputting the optimal weights to obtain the training dataset with optimized weights. Since samples retain their class attributes in a balanced training dataset, further optimization of the sample weights for high-risk rock mass levels, especially those for levels IV and V, can improve the predictive model's ability to identify high-risk rock mass levels.

[0079] Step 3.2: Input the weighted training dataset into the XGBoost model, optimize the key hyperparameters of the XGBoost model, and obtain the XGBoost-TGCOA hierarchical model; XGBoost is an ensemble learning algorithm based on an additive model. It iteratively constructs and weights multiple weak classifiers to fit complex nonlinear relationships. Its suitability for rock slag classification tasks is reflected in: its ability to handle multiple feature inputs, suitable for 13-dimensional rock slag feature modeling; strong robustness to outliers, adapting to the natural fluctuations in rock slag data; and strong model interpretability, allowing for the identification of key classification indicators through feature importance ranking. XGBoost mainly consists of the following components: (1) Objective function The core of XGBoost is to minimize the regularized objective function, the first... The objective function of the round iteration is: ; in, For the front The predicted value of the trees, For the first The output of each tree. Loss function. To measure the deviation between the model's predicted values ​​and the actual values, this embodiment uses cross-entropy loss for a multi-classification task of surrounding rock (5 levels). ; in For the number of categories, For the sample The true label, It is a model for categories The predicted probability. Regularization term. The formula used to control model complexity is: ; in, This represents the number of leaf nodes in the tree. For the first The weight of each leaf node, These are the hyperparameters that control the complexity of the tree structure and the strength of the weight penalty, respectively, and need to be tuned through cross-validation.

[0080] (2) Tree splitting rules XGBoost uses pre-sorting and a greedy algorithm to construct the CART tree, and selects the optimal split point by calculating the feature split gain, ensuring that each split minimizes the objective function. The split gain formula is: ; in, Let be the sum of the gradients and the sum of the second derivatives of the samples in the left subtree, respectively. This is the value corresponding to the right subtree. When If splitting reduces the objective function, the split is effective; otherwise, splitting stops. This rule can automatically select the features that contribute the most to the classification.

[0081] As mentioned above, this application uses the XGBoost model as the classifier. First, cross-validation is employed to optimize the key hyperparameters of the XGBoost classifier. The specific key hyperparameters are shown in Table 3. These parameters effectively control the risk of overfitting while ensuring the model has strong feature fitting ability, thereby improving the model's generalization performance. Using the XGBoost model after the last hyperparameter optimization, an XGBoost-TGCOA hierarchical model is established. Table 3 Key Hyperparameters of XGBoost ; Step 3.3: Divide the weighted training dataset into a training set and a validation set. Train the XGBoost-TGCOA grading model on the training set and use the XGBoost-TGCOA grading model that has passed the validation on the validation set as the surrounding rock grade prediction model.

[0082] To comprehensively evaluate the stability and generalization ability of the XGBoost-TGCOA grading model, stratified 5-fold cross-validation was employed. In each fold iteration, the training data in the weighted training dataset was divided into an in-fold training set and an in-fold validation set. The in-fold training set was used for model training, while the in-fold validation set was used to calculate performance metrics such as accuracy, weighted F1 score, and recall for each class. The validated XGBoost-TGCOA grading model was then used as the rock mass classification prediction model for rock mass classification.

[0083] The XGBoost-TGCOA classification model uses a balanced dataset enhanced with physical constraints SMOTE-NC as input and dynamically adjusts the weights of training samples using a stingless bee optimization algorithm, which can enhance the model's ability to identify high-risk samples. Combining XGBoost's advantages in handling high-dimensional feature coupling relationships, it achieves a high-precision classification mapping from rock debris parameters to surrounding rock grades.

[0084] Step 4: Input the characteristics of the rock debris produced by blasting into the surrounding rock grade prediction model to obtain the surrounding rock grade prediction model output by the surrounding rock grade prediction model.

[0085] Experimental Case: To fully verify the performance of the XGBoost-TGCOA-based classification model, the present invention (improved SMOTE-NC algorithm + XGBoost-TGCOA model) was compared with the basic XGBoost model and the improved XGBoost model (improved SMOTE-NC algorithm + XGBoost model). The precision, recall, F1 score and overall accuracy of each model at different surrounding rock grades were obtained, and the results are shown in Table 4.

[0086] Table 4 Prediction results of different models ; As shown in Table 4, the basic XGBoost model has an overall accuracy of 0.75, but its ability to identify high-risk surrounding rocks such as Class IV and V is poor. In particular, the accuracy for Class V surrounding rocks is only 0.38, indicating a serious risk of misclassifying other categories as Class V, which is detrimental to engineering safety assessment. After introducing the physical constraint SMOTE-NC into the improved XGBoost model, the F1 score (f1-score) for Class V surrounding rocks in the intermediate model increased from 0.51 to 0.68, and the overall accuracy improved to 0.81. This demonstrates that generating reasonable samples through physical constraints can effectively improve the model's learning ability for minority classes. Further introducing the TGCOA sample weight optimization mechanism, the model proposed in this invention achieves accurate identification of high-risk surrounding rocks while maintaining balanced performance across categories. The F1 score for Class V surrounding rocks further improved to 0.88, and the overall accuracy reached 0.89. Crucially, the accuracy rate for Class V surrounding rock increased significantly from 0.58 to 0.90, indicating that the model significantly reduced the false alarm rate when identifying high-risk surrounding rock, demonstrating its strong engineering applicability.

[0087] like Figure 2 , Figure 3 and Figure 4The confusion matrices for the three models are shown. The vertical axis represents the actual surrounding rock grade, the horizontal axis represents the grade predicted by the model, the diagonal elements represent the number of correctly classified samples, and the off-diagonal elements reflect misclassification. A comprehensive comparison shows that the improved measures proposed in this invention (improved SMOTE-NC+XGBoost-TGCOA) effectively improve the classification accuracy of Grade V surrounding rock, directly demonstrating the significant effect of this invention in improving the accuracy of high-risk grade identification.

[0088] This model first employs the physically constrained SMOTE-NC method to enhance the rock debris data, generating five levels of surrounding rock samples to achieve dataset balance. Subsequently, the TGCOA stingless bee optimization algorithm is used to dynamically optimize the model weights, and XGBoost is combined to construct a surrounding rock grade prediction model. Figure 8 As shown in the figure, the experimental results of the model on the validation set show that the predicted surrounding rock grade of some validation samples is compared with the actual grade. It can be seen that the prediction results of most samples are accurate, and only a few predictions have certain deviations, which further verifies the effectiveness of the model.

[0089] Example 2: This example provides a surrounding rock classification device based on rock slag characteristics, implemented based on the method in the above examples. The device includes: The acquisition module is used to acquire the characteristics of rock debris of different surrounding rock grades, and to obtain rock debris characteristic sample sets of different surrounding rock grades based on the rock debris characteristics; the rock debris characteristic sample sets of different surrounding rock grades are divided into balanced rock debris characteristic sample sets and unbalanced rock debris characteristic sample sets. The sample expansion module is used to expand the unbalanced rock slag feature sample set by improving the algorithm through SMOTE-NC and based on the constraints of rock slag physical properties, and to establish a training dataset. The model building module is used to input the training dataset into the XGBoost-TGCOA grading model, and use the trained XGBoost-TGCOA grading model as the surrounding rock grade prediction model. The output module is used to input the acquired rock debris features into the surrounding rock grade prediction model to obtain the surrounding rock grade prediction model output by the surrounding rock grade prediction model.

[0090] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0091] Finally, it should be noted that in this text, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0092] The above provides a detailed description of the surrounding rock classification method and apparatus based on rock slag characteristics provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and its core ideas. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for classifying surrounding rock based on the characteristics of rock debris, characterized in that, The method includes: Rock debris features are acquired, and rock debris feature sample sets for different surrounding rock grades are obtained based on the rock debris features; the rock debris features include rock debris particle size parameters, color feature vectors, and contour sharpness coefficients; By improving the SMOTE-NC algorithm and constraining the physical properties of rock slag, the unbalanced rock slag feature sample set is expanded to establish a training dataset. An XGBoost-TGCOA grading model was constructed and trained on the training dataset. The trained XGBoost-TGCOA grading model was then used as a prediction model for the surrounding rock grade. The characteristics of the rock debris generated by blasting are input into the surrounding rock grade prediction model to obtain the surrounding rock grade prediction model output by the surrounding rock grade prediction model.

2. The method according to claim 1, characterized in that, The improved SMOTE-NC algorithm, based on constraints of the physical properties of rock slag, expands the unbalanced rock slag feature sample set to obtain a balanced training dataset, including: The samples in the unbalanced rock slag feature sample set are divided into numerical features and color features according to the physical properties of rock slag, resulting in a numerical feature subset and a color feature subset; the numerical features include rock slag particle size parameters and profile sharpness coefficient; Samples that do not meet the first and second physical constraints are removed from the numerical feature subset and the color feature subset to obtain the compliant sample set; The compliance numerical features in the compliance sample set are standardized, and the k nearest neighbors are selected from the compliance sample set by K-nearest neighbor selection to obtain the nearest neighbor sample set. Based on the nearest neighbor sample set, numerical feature interpolation results are generated through linear interpolation, and numerical feature interpolation correction is performed on numerical feature interpolation results that do not meet the first physical constraint condition. Based on the nearest neighbor sample set, color feature interpolation results are generated through linear interpolation, and color feature interpolation results that do not meet the second physical constraint condition are corrected. Repeatedly perform numerical feature interpolation correction and color feature interpolation correction until the unbalanced surrounding rock feature sample set is expanded to the preset sample size or reaches the preset sample expansion factor, to obtain the expanded rock slag feature sample set. The expanded rock slag feature sample set and the original balanced rock slag feature sample set are used as training datasets.

3. The method according to claim 2, characterized in that, The step of correcting the numerical feature interpolation results that do not meet the first physical constraint condition includes: Determine whether the current numerical feature interpolation result satisfies the first physical constraint condition. If not, proceed to the next step. The first physical constraint condition is: ; ; in, This represents the particle size value corresponding to a cumulative area percentage of 10%. This represents the particle size value corresponding to a cumulative area percentage of 30%. This represents the particle size value corresponding to a cumulative area ratio of 60%. This represents the maximum value of the major axis dimension of all rock debris. This represents the average sharpness of the profile of all rock fragments. Numerical feature interpolation correction is performed according to the following constraint correction rules: 1) If ,but ; 2) If ,but ; 3) If ,but ; 4) If Then force set to ; in, , , These represent the particle size interpolation values ​​corresponding to cumulative area percentages of 10%, 30%, and 60%, respectively. Interpolation of the maximum value of the major axis dimension of all rock debris; This represents the interpolation of the contour sharpness.

4. The method according to claim 3, characterized in that, The step of correcting the color feature interpolation results that do not meet the second physical constraint includes: Determine whether the color feature interpolation result satisfies the second physical constraint. If not, proceed to the next step. The second physical constraint is as follows: ; in, For color characteristics, For color levels, ; Color feature interpolation is performed according to the following boundary constraint rules and normalization constraint rules; 1) If Then it is corrected to ; 2) If Then it is corrected to ; in, The result is the color feature interpolation. 3) Calculate the sum of the color feature interpolation results for each color level. ,like Then, the color feature interpolation results are corrected by normalization: ; in, This is the interpolation result of the color features after normalization correction.

5. The method according to claim 4, characterized in that, The XGBoost-TGCOA grading model is constructed and trained on the training dataset. The trained XGBoost-TGCOA grading model is then used as the surrounding rock grade prediction model. The weights of samples in the training dataset are dynamically adjusted using the stingless bee optimization algorithm TGCOA to obtain a weight-optimized training dataset. The weighted training dataset is input into the XGBoost model to optimize the key hyperparameters of the XGBoost model and establish the XGBoost-TGCOA hierarchical model. The validated XGBoost-TGCOA classification model was used as the prediction model for surrounding rock grade.

6. The method according to claim 5, characterized in that, The dynamic adjustment of sample weights in the training dataset using the TGCOA (Thornless Bee Optimization Algorithm) includes: The sample weights of high-risk surrounding rock grades in the training dataset are used as optimization variables, and the search space is set as follows: ,in, The number of samples representing high-risk surrounding rock grades in the training dataset; Generate multiple sets of random weights to cover the weight search range; During the global search phase, new combinations of sample weights are explored globally. During the balanced exploration and development phase, the sample weight combination is locally optimized. During the local optimization phase, the sample weights are adjusted by slightly perturbing the current optimal weight vector. The above three stages are executed iteratively until the maximum number of iterations is reached or the objective function converges, at which point the optimal weights are output.

7. The method according to claim 6, characterized in that, The objective function is: ; in, For the first Number of samples of surrounding rock grade For the first The accuracy of the surrounding rock classification For the first Recall rate for Class I surrounding rock grades The weighted average F1 score.

8. The method according to claim 1, characterized in that, The rock debris features were obtained based on an improved segmentation model based on YOLO11n-seg.

9. The method according to claim 8, characterized in that, The improved segmentation model based on YOLO11n-seg uses the YOLO11n-seg model as its basic framework and introduces a spatial frequency fusion enhancement module into the backbone network of the original YOLO11n-seg model. At the same time, the neck network of the original YOLO11n-seg model is replaced with the TripleGD-Neck module.

10. A surrounding rock classification device based on rock debris characteristics, implemented according to the method described in any one of claims 1-7, characterized in that, The device includes: The acquisition module is used to acquire the characteristics of rock debris of different surrounding rock grades, and to obtain rock debris characteristic sample sets of different surrounding rock grades based on the rock debris characteristics; the rock debris characteristic sample sets of different surrounding rock grades are divided into balanced rock debris characteristic sample sets and unbalanced rock debris characteristic sample sets. The sample expansion module is used to expand the unbalanced rock slag feature sample set by improving the algorithm through SMOTE-NC and based on the constraints of rock slag physical properties, and to establish a training dataset. The model building module is used to input the training dataset into the XGBoost-TGCOA grading model, and use the trained XGBoost-TGCOA grading model as the surrounding rock grade prediction model. The output module is used to input the acquired rock debris features into the surrounding rock grade prediction model to obtain the surrounding rock grade prediction model output by the surrounding rock grade prediction model.