Hydraulic concrete aggregate segmentation and counting method and system based on deep features
Patent Information
- Application Number
- CN202611085704.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-21
- Publication Date
- 2026-10-23
AI Technical Summary
[0009]针对上述问题,本发明的目的在于克服传统筛分法的效率底下的问题,基于图像处理技术,克服现有骨料分割方法的上述缺陷,提出基于深度特征的水工混凝土骨料分割计数方法及系统
[0030]本发明产生的有益效果包括:
Smart Images

Figure CN122966554A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water conservancy engineering and building material testing technology, and in particular to a method and system for segmenting and counting hydraulic concrete aggregates based on depth features. Background Technology
[0002] The gradation of aggregates in hydraulic concrete plays a decisive role in the mechanical properties and durability of the concrete. In engineering practice, traditional gradation testing and existing automatic grading methods mainly face the following technical challenges and bottlenecks:
[0003] (1) Traditional manual sieving method and its process
[0004] Traditional aggregate gradation testing relies heavily on manual sieving. The standard process involves sampling and sample preparation, washing to remove mud, drying and sieving, weighing and calculation. This process is extremely cumbersome and time-consuming, typically requiring hours to days, making it impossible to achieve real-time, precise control during concrete mixing at the construction site. Furthermore, manual operation easily introduces subjective judgment errors during sampling, washing, and reading, resulting in poor repeatability of test results.
[0005] (2) Segmentation algorithms based on traditional digital image processing
[0006] To achieve automated detection, early methods mainly employed traditional image segmentation techniques such as the Canny operator, Sobel operator, and watershed algorithm. However, these methods are highly sensitive to aggregate images, and their segmentation performance heavily relies on the rationality of manually designed feature operators and preset thresholds. In real-world scenarios with overlapping aggregates and blurred boundaries, oversegmentation and undersegmentation are prone to occur, resulting in significant gradation errors.
[0007] (3) Deep learning segmentation techniques based on convolutional neural networks (CNN) and Transformer
[0008] Deep learning-based aggregate image segmentation research mainly falls into two categories: CNN-based and Transformer-based methods. Convolutional neural networks (CNNs) gradually expand the receptive field through multi-layer pooling and stride convolution. However, in the feature extraction stage, the size of fine aggregates is extremely small, and their edge features occupy few pixels spatially. During the progressive downsampling process of deep networks, the edge and spatial location features of aggregates are gradually smoothed and filtered during the extraction of high-level semantic features, resulting in deep networks being unable to effectively represent dense small aggregates, leading to missed detections and undersegmentation problems. Although Transformers can establish long-distance pixel associations, their computational complexity increases quadratically due to calculating similarity across the entire image, limiting the processing of high-resolution features. Furthermore, the global interactive computation method easily weakens the weak boundary features of dense aggregates, resulting in a significant loss of boundary features. In the feature fusion stage, existing fusion methods mostly employ simple bilinear interpolation followed by pixel-by-pixel addition. This method lacks adaptive selective filtering, which causes high-frequency noise in shallow features to be mixed with semantic information in deep features with equal weight. This makes it impossible to recover lost aggregate details, blurs the location of aggregate boundary areas, and makes it impossible to accurately establish the mapping relationship between pixel area and actual aggregate quality, resulting in a large gradation detection error. Summary of the Invention
[0009] To address the aforementioned problems, the purpose of this invention is to overcome the low efficiency of traditional sieving methods. Based on image processing technology, it overcomes the shortcomings of existing aggregate segmentation methods by proposing a depth-feature-based method and system for segmenting and counting hydraulic concrete aggregates. By improving the feature extraction of the core algorithm and introducing edge enhancement and cross-scale adaptive fusion mechanisms, it effectively solves the problem of mixed aggregate types and diverse distributions in hydraulic concrete, which easily leads to over-segmentation and under-segmentation of stacked aggregates during the gradation process, resulting in large errors in aggregate gradation counting.
[0010] A depth-feature-based method for segmenting and counting hydraulic concrete aggregates, comprising a BC-GECO2 network including a BAHiera feature extraction module, a DFG-Edge edge enhancement module, a CSFM-GFFCA cross-scale feature interaction fusion module, and a joint loss function consisting of Focal and counting loss, the method including:
[0011] Acquire the image of the aggregate to be tested and reconstruct it into 1024×1024 pixels. Mark more than 3 rectangular target cue boxes. Use the ROI Align operator to crop and align the local features of the cue boxes from the feature map. Use MLP to transform it into a 256-dimensional feature map. Use cross attention and deformable attention to focus the high-dimensional features on the spatial center of the dense aggregate in space.
[0012] The BAHiera feature extraction module performs forward propagation on the input features and outputs feature maps S2, S3 and S4 at three different spatial scales.
[0013] The DFG-Edge edge enhancement module explicitly enhances the edges of features S2, S3, and S4, and outputs the enhanced features.
[0014] The extracted and enhanced multi-scale cascaded features of S2, S3, and S4 are processed by the CSFM-GFFCA cross-scale feature interaction fusion module to construct a dense query representation with high spatial localization, which is then fed into the SMA2 Mask decoder to output the predicted segmentation mask of each aggregate candidate target.
[0015] During the training phase, dynamic multi-objective gradient loss optimization is performed through the joint loss function to calculate the total loss, which includes global aggregate counting loss, small target counting loss for target pixels with dimensions ≤25×25, and Focal loss, where the small target counting weight is 0.3.
[0016] During the inference phase, a forward feature transfer calculation is directly performed on the input 1024×1024 pixel image to obtain the predicted segmentation mask. Non-maximum suppression is called to filter the overlap detection and generate an initial foreground connectivity mask binary map. The fine watershed edge segmentation line matrix is extracted adaptively through segmentation features, and the segmentation and counting result map is constructed and output.
[0017] Furthermore, the core BAHiera feature extraction module contains four cascaded sub-modules. In each BAHiera block, a binary self-attention mechanism is run: the mean of Q and K along the token and channel dimensions is calculated, Q and K are binarized using a quantization function, and the self-attention matrix is obtained by fusing the binarized matrix with a learnable bias. The value matrix V is decomposed channel by channel and quantized into an 8-bit integer using a scaling factor, and matrix multiplication is performed with the self-attention matrix to output enhanced features.
[0018] Furthermore, the core DFG-Edge edge enhancement module uses discrete wavelet transform to decompose the input features into high-frequency and low-frequency components. It calculates the gate weights of low-frequency and high-frequency features through global average pooling and linear layer interaction. The high-frequency features are selectively filtered through adaptive gated Hadamard product. The enhanced high-frequency features are added and fused with the original low-frequency components, and the dimensional space is reconstructed through bilinear interpolation.
[0019] Furthermore, the core CSFM-GFFCA cross-scale feature interaction fusion module uses 1×1 convolution to align the channel dimensions of S2, S3, and S4 to C=256, upsamples the small-scale features to align the spatial resolution, and inputs the aligned features of adjacent scales into the dual-branch adaptive GGFFCA module. Adaptive weighted cross-scale feature interaction is performed through shared parameter multi-head self-attention and scaling factor. The resulting features are input into a gated feedforward network, which is divided into pairs along the channel dimension. The channel gate signal is calculated by depthwise separable convolution and Tanh activation function to filter low-level high-frequency background noise. The denoised features are then passed through the RepC3 structure reparameterization module. Through step-by-step upsampling and repeated stacking of GGFFCA and RepC3, feature interaction at each scale is achieved, and dense query representation is constructed by concatenating and splicing along the channel dimension.
[0020] Furthermore, there are three rectangular target prompt boxes, and when selecting prompt boxes, try to select three prompt boxes where there is an overlap between coarse and fine aggregates.
[0021] Furthermore, the extraction process of the core watershed edge segmentation matrix is as follows: the uncut aggregate in the unsegmented state is predicted as a white area with a brightness of 1, and the background is identified as black with a value of 0. An initial foreground connected mask binary map is generated. Based on this, a fine watershed edge segmentation matrix is extracted adaptively through segmentation features, and the pixel brightness of the corresponding spatial coordinate point of the matrix is forcibly reset to a black zero value.
[0022] A depth-feature-based hydraulic concrete aggregate segmentation and counting system, used to perform the above method, includes:
[0023] An image acquisition device is used to acquire aggregate images in a darkroom environment. The device consists of a high-precision electronic scale, a vibrator, a uniform LED backlight panel, and a camera. The aggregate sample, which has been thoroughly stirred and weighed, is evenly spread on the backlight panel through high-frequency vibration. The LED backlight is turned on to highlight the edges of small particles and the orthographic projection angle is corrected to eliminate distortion. The image is then focused, captured, and saved.
[0024] The preprocessing unit is used to uniformly crop, scale, and reconstruct the acquired images to 512×512 pixels, remove blurry and jittery images, and perform fine pixel-level annotation to build a training dataset.
[0025] The processor and GPU collaborative computing unit is used to deploy and run the BC-GECO2 network, which includes the BAHiera feature extraction module, the DFG-Edge edge enhancement module, the CSFM-GFFCA cross-scale feature interaction fusion module, and a joint loss function composed of Focal and counting loss.
[0026] The display terminal is used to receive and output the segmentation and counting result diagrams.
[0027] Furthermore, the processor and GPU collaborative computing unit performs the following operations during the training phase: all parameters of the BAHiera backbone network are frozen, the epoch is set to 200, the AdamW optimizer is used, and the initial learning rate is 1×10⁻⁶. -4 The weight decay coefficient is 5×10 -5 The batch size is 4.
[0028] Furthermore, the processor and GPU collaborative computing unit performs the following operations during the inference phase: directly processes the input image with a fixed pixel size of 1024×1024 without using any image upsampling or block stitching strategies.
[0029] The beneficial effects of adopting the above technical solution are as follows:
[0030] The beneficial effects of this invention include:
[0031] 1. Significantly improved image segmentation capability for dense aggregates: The BAHiera module enhances the representation capability of dense small targets while maintaining high-resolution details through a binary self-attention mechanism, effectively avoiding the feature loss problem of fine aggregates during the downsampling process of deep networks, resulting in a 2.65% improvement in IoU for coarse aggregates and a 3.18% improvement in IoU for fine aggregates.
[0032] 2. Effective preservation of edge details in aggregate images: The DFG-Edge module utilizes the multi-directional high-frequency capture and interactive gating weight mechanism of discrete wavelet transform to specifically enhance the boundary response of dense small aggregates, suppress false edges and high-frequency environmental noise, and make up for the aggregate edge details lost by the backbone network due to downsampling, thereby improving the BIoU index by 3.97% and 1.69%, respectively.
[0033] 3. Enhanced quality of cross-scale feature fusion of aggregate images: The CSFM-GFFCA module achieves adaptive weighted fusion of features at adjacent scales through a learnable gating and symmetric bi-branch interaction mechanism, effectively suppressing shallow high-frequency noise and significantly enhancing the aggregate edge response channel, thus solving the edge blurring problem caused by simple bilinear interpolation fusion.
[0034] 4. Focused optimization of hard-to-classify pixels: The Focal loss function guides the model to focus optimization on hard-to-classify target pixels such as edges, which solves the problem of missed counts caused by the smoothing of dense aggregate features, and significantly reduces MAE and RMSE indicators.
[0035] 5. Real-time online detection capability: The entire inference process directly performs forward calculations on the 1024×1024 pixel image without the need for image upsampling or block stitching strategies. Combined with non-maximum suppression, it achieves rapid segmentation and counting, meeting the real-time online fine-grained control needs of construction sites.
[0036] 6. Improved efficiency in detecting aggregate gradation: Optimal performance was achieved on both coarse and fine aggregate datasets. The IoU, DICE, BIoU, MAE, and RMSE for coarse aggregate were 98.82%, 98.37%, 95.44%, 9.79, and 38.48, respectively, while those for fine aggregate were 92.39%, 91.46%, 90.38%, 13.40, and 44.57, respectively, outperforming comparable algorithms such as Mask-RCNN, SAM, and GECO2. Attached Figure Description
[0037] Figure 1 The overall network architecture diagram of BC-GECO2 provided by this invention;
[0038] Figure 2 The BAHiera, MHA, and BinaryAttention network structure diagrams provided by this invention;
[0039] Figure 3 The DFG-Edge network structure diagram provided by this invention;
[0040] Figure 4 The CSFM-GFFCA network structure provided by this invention;
[0041] Figure 5 A schematic diagram showing the number of prompt boxes provided by this invention;
[0042] Figure 6 The results of the segmentation and counting of coarse aggregate particles provided by the present invention;
[0043] Figure 7 The results of the fine aggregate particle segmentation and counting provided by the present invention. Detailed Implementation
[0044] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.
[0045] This invention proposes a depth-feature-based method and system for segmenting and counting aggregates in hydraulic concrete, using the BC-GECO2 (GECO2 with BAHiera and CSFM-GFFCA) network structure as follows: Figure 1As shown, it mainly consists of an input module, a BAHiera (Hiera with binary attention) feature extraction module, a DFG-Edge (Differentiable feature gating for edge enhancement) edge enhancement module, a CSFM-GFFCA (Cross scale fusion module based on gated feed-forward cross-attention network) cross-scale feature interaction fusion module, and a joint loss function optimization module composed of Focal and counting loss (core invention point four). See the appendix for the overall network architecture. Figure 1 .
[0046] Core BAHiera feature extraction module:
[0047] To extract rich depth and edge features of dense aggregates and avoid feature loss during feature extraction, a BAHiera module was designed based on the Hiera hierarchical feature pyramid structure. BAHiera utilizes hierarchical self-attention and a local-global feature fusion mechanism to enhance the representation of dense small targets while maintaining high-resolution details through cross-layer interaction. This module consists of four structurally similar BAHiera modules stacked together, progressively aggregating multi-scale contextual information. To further extract and fuse edge features, a DFG-Edge module was proposed. This module, based on a differentiable edge gradient operator and a gated feature fusion strategy, explicitly models and enhances the edge responses in mid- and high-level feature maps, effectively compensating for aggregate edge details lost due to downsampling in deep networks, compensating for aggregate target features, and improving the segmentation and detection accuracy of dense aggregates. The network structure is shown in the appendix. Figure 2 .
[0048] For input features After Layer Norm linear layer calculation , and The matrix is then processed through a BinaryAttention layer and a regularized Drop Path to output features. This enhances the network's ability to interact with aggregate features and prevents overfitting. Then, With input Perform skip connection fusion, then pass through an MLP and Drop Path layer. Finally, combine it with... Perform skip connections to obtain output features. BAHiera calculates the input as follows:
[0049] (1)
[0050] (2)
[0051] in, For the corresponding operation, , and For Layer Norm, Binary Attention, and MLP operations, This refers to the output characteristics of the corresponding operation.
[0052] like Figure 2 As shown in (b), the benchmark Hiera uses MHA (Multi-Head Attention) to achieve feature interaction. The benchmark MHA will input... Mapped to , and On the matrix, then and Multiply the weights of the directions and then... Matrix fusion in direction, outputting the final result:
[0053] (3)
[0054] in, The number of tokens. The Softmax activation function is used. However, MHA calculates similarity at all locations across all feature maps during the interaction process. In aggregate segmentation and detection tasks, this global computation method leads to feature redundancy, reducing network computational efficiency and making it easy for weak edge information of the aggregate to be lost due to "averaging" with background features. To address these limitations, the Binary Attention module proposed in this invention first calculates similarity based on the input features... Calculate separately , and Matrix, then and The matrix uses a scaled 1-bit quantization function. Calculate the linear matrix respectively and :
[0055] (4)
[0056] in, They are and Along the mean of the token and the channel. Utilizing and A matrix enhances edge details as follows:
[0057] (5)
[0058] in, For learnable bias, To Transpose it. Then, for The matrix is calculated through channel-wise decomposition and quantization respectively. and The input features are enhanced using Binary Attention to become:
[0059] (6)
[0060] in, The output features of Binary Attention and for Quantized 8-bit integers. for The dimension of a matrix.
[0061] Core DFG-Edge edge enhancement module
[0062] To address the feature loss bottleneck encountered during aggregate downsampling, this invention incorporates a differentiable feature-gated edge enhancement module (DFG-Edge) in series after the last three layers (S2, S3, and S4 feature layers) of the BAHiera hierarchical module. Through the multi-directional high-frequency capture and interactive gating weight mechanism of DWT, this module can specifically enhance the boundary response of dense small aggregates, suppress false edges and high-frequency environmental noise, thereby compensating for the aggregate edge details lost by the backbone network due to downsampling. See the appendix for its detailed structure. Figure 3 .
[0063] DFG-Edge first uses DWT to process the input features Decomposed into high frequency Low-frequency characteristics :
[0064] (7)
[0065] (8)
[0066] Then use them respectively and Calculate interaction weights:
[0067] (9)
[0068] (10)
[0069] (11)
[0070] in, and The weights are calculated based on high-frequency and low-frequency characteristics. It is a linear layer. and For ReLU and Sigmoid activation functions, This is the Hadamard product. Finally, DFG-Edge enhances the features and resizes the dimensions to:
[0071] (12)
[0072] Core CSFM-GFFCA cross-scale feature interaction fusion module
[0073] To address the issues of shallow noise and deep semantics being equally mixed and edges blurred in lightweight upsampling and fusion modules (LUMs) due to simple bilinear interpolation and element-wise addition, this invention designs a CSFM-GFFCA module, the structure of which is shown in the appendix. Figure 4 First, the channel dimensions of features S2, S3, and S4 are adjusted by 1×1 convolution. Then, small-scale features are linearly upsampled, and an adaptive weighted fusion of the two layers of features is achieved through a GGFCA-gated feature fusion module. This module utilizes a learnable gating signal to suppress noisy channels and highlight aggregate edge features. Next, a RepC3 reparameterization structure is introduced to improve the model's ability to understand the context of aggregates without increasing inference computation. Finally, by repeatedly stacking convolutions, RepC3, upsampling, and GGFCA operations, features are focused across scales and progressively fused. The output features of the last three RepC3 layers are concatenated along the channel dimension, generating a high-resolution dense query map that contains rich edge details and multi-level semantic information, effectively addressing the problem of small target feature loss in dense aggregate scenarios.
[0074] First, input features and The corresponding calculations are performed after 1×1 Conv and Liner layers respectively. , and The matrix is then used to weight and interactively complement the features of different branches as follows:
[0075] (13)
[0076] (14)
[0077] in, and Features are the results of feature interactions between adjacent features. To adapt to shared features among Mult Heads, the output features of GGFCA are finally represented as follows:
[0078] (15)
[0079] First, use a Conv layer and DWConv to segment the features according to channels. The features are output as:
[0080] (16)
[0081] in, The Tanh activation function is used. CSFM-GFFCA achieves adaptive weighted fusion of features at adjacent scales by introducing learnable gating and a symmetric bi-branch interaction mechanism, effectively suppressing shallow high-frequency noise and significantly enhancing the edge response channels of aggregates. Simultaneously, by repeatedly stacking RepC3 and Conv, upsampling, and GGFFCA, it achieves cross-scale progressive fusion of features, and concatenates the outputs of the last three RepC3 layers along the channel dimension, enabling the final high-resolution dense query map to simultaneously retain fine edge details and deep semantic information, accurately solving the problems of easy loss of small target features and blurred edges in dense aggregate scenarios.
[0082] Joint optimization design of core Focal and counting loss
[0083] In scenes with extremely dense fine aggregates, edge pixels account for a very small percentage of the overall image. To ensure accurate overall aggregate quantity response while forcing the model to focus on hard-to-classify aggregate boundaries, this invention constructs a multi-objective joint optimization function. The optimization loss function for the entire network is designed as follows:
[0084] (17)
[0085] in, This is the bounding box counting loss, used to calculate the counting accuracy of dense images. This is the counting loss for small targets (target pixel dimensions ≤ 25×25), used to ensure the counting accuracy of dense small targets. For the small target counting weight, this invention uses the same value setting as GECO2, which is 0.3.
[0086] Table of English and Chinese Abbreviations and Codes in this Invention
[0087]
[0088] The following comparison table of various experiments further clarifies the improvements of this invention:
[0089] Appendix Table 1: Comparison of ablation experiments for various improvement strategies
[0090] (M1 is the BAHiera module, M2 is the DFG-Edge module, M3 is the CSFM-GFFCA module, and M4 is the Focal loss function)
[0091]
[0092] Appendix Table 2 Comparison of ablation experiments for various improvement strategies
[0093]
[0094] All steps in this embodiment are completed within the computer software system by program instructions controlling the processor and GPU to perform collaborative computation.
[0095] (1) Static relationship
[0096] Experimental parameters and settings: BC-GECO2 uses the BAHiera backbone network to extract dense aggregate features and output multi-scale high-resolution features. The input image is presented with a fixed number of cue boxes. During training, all parameters of the BAHiera network are frozen, the epoch is set to 200, the AdamW optimizer is used, and the initial learning rate is 1×10⁻⁶. -4 The weight decay coefficient is 5×10 -5 The batch size was 4. Training was performed on a single NVIDIA 4080S GPU. Furthermore, during inference, the model directly processes the input image of a fixed 1024×1024 pixel size without using any image upsampling or block stitching strategies, and ultimately eliminates duplicate detections through non-maximum suppression.
[0097] Evaluation Metrics: A multi-dimensional evaluation approach was used to comprehensively assess the performance of BC-GECO2, covering both segmentation accuracy and counting accuracy. The metrics selected were Intersection over Union (IoU), Dice similarity coefficient (DICE), and Boundary Intersection over Union (BIoU), as well as Mean Absolute Error (MAE) and Root Mean Square Error (RMSE). In the segmentation and counting task of coarse and fine concrete aggregate particles, IoU and DICE were used to evaluate the overall overlap between the segmentation results and the ground truth labels. IoU measures the intersection-over-union ratio between the predicted particle region and the ground truth region, DICE is more sensitive to the segmentation of fine or cohesive aggregate particles, and BIoU focuses on the boundary regions of aggregate particles, used to evaluate the fineness of edge segmentation. For counting errors, MAE reflects the average absolute difference between the predicted and true particle counts in each image, while RMSE amplifies significant undercounting and miscounting during the counting process, more rigorously measuring the model's counting stability in complex stacking scenarios.
[0098] Dataset Construction: This experiment relies on a collaborative project between the National Natural Science Foundation of China and the Gansu Provincial Department of Water Resources. Coarse and fine aggregates (a total of 10 types of samples) were collected from 5 different sources. The samples were prepared in the laboratory by washing and drying in strict accordance with the technical standards of the "Code for Construction of Hydraulic Concrete" (SL677 / DL / T5144) and the "Test Procedure for Sand and Gravel Aggregates of Hydraulic Concrete" (DL / T5151). Data acquisition was conducted in a darkroom environment. A bottom-up device consisting of a high-precision electronic scale (0.01g range), a vibrator, a uniformly illuminated LED backlight, and a camera was used. The thoroughly mixed and weighed aggregate sample was uniformly spread on the backlight using high-frequency vibration. Subsequently, the LED backlight was turned on to highlight the edges of small particles, and orthographic projection was corrected to eliminate distortion. The image was then focused, captured, and saved. Finally, the images were uniformly cropped, scaled, and reconstructed to 512×512 pixels. After removing blurry and jittery images, fine pixel-level annotations were performed, thus constructing a pixel-level annotated dataset containing 4328 images of coarse aggregate and 5898 images of fine aggregate, laying the data foundation for the deep learning training of the algorithm model.
[0099] (2) Dynamic relationship
[0100] Image Standardization Reading and Prompt Guidance: The system first reads the image of the aggregate to be tested and automatically reconstructs it to a fixed 1024×1024 pixels. In subsequent inference, the system directly performs overall calculations on this image size without using any image upsampling or block stitching strategies. In this embodiment, the training set used during the training phase comes from the Engineering Quality Testing Laboratory of the Gansu Provincial Institute of Water Resources Science, and includes a total of 4328 coarse aggregate image pairs and 5898 fine aggregate image pairs, prepared according to the "Test Procedure for Sand and Gravel Aggregates in Hydraulic Concrete" (DL / T5151) standard after washing, drying, and labeling. The operating terminal acquires three or more rectangular target prompt boxes. The system runs the ROI Align operator to crop and align the local features of the prompt boxes from the feature map, and uses MLP transformation to convert them into 256-dimensional feature maps. Subsequently, through cross attention and deformable attention, the high-dimensional features are spatially focused on the spatial center of the dense aggregate.
[0101] BAHiera Backbone Network Feature Extraction: Feature data streams enter the BAHiera feature extraction network for forward propagation, during which all parameters of the backbone network remain frozen. The input image is fed into the BAHiera network containing four cascaded sub-modules, and a binary attention mechanism is run in each BAHiera block. In this computational sequence, the system first computes... and Along the mean of the token and channel dimensions, and using a quantization function to... and Binarization is performed, and then the binarized matrix is fused with the learnable bias to obtain the self-attention matrix. Then, the value matrix. The enhanced features are output by decomposing the data channel by channel, quantizing it into 8-bit integers using scaling factors, and then performing matrix multiplication with the calculated attention matrix. This effectively eliminates high-line noise interference caused by image compression. Through the cascaded feature flow of this hierarchical network, the backbone network ultimately outputs three feature maps at different spatial scales, namely S2, S3, and S4.
[0102] DFG-Edge Edge Enhancement Module: Features S2, S3, and S4 are input into their respective cascaded DFG-Edge modules for multi-directional explicit edge enhancement. Taking the S3 scale feature as an example, the feature is first input into a Discrete Wavelet Transform (DWT) unit, and decomposed through the corresponding wavelet filter kernel. In a single forward propagation, the sum of the low-frequency component and the high-frequency component containing high-frequency details of horizontal, vertical, and diagonal edges is obtained. Subsequently, the system uses global average pooling and a linear layer structure to interactively calculate the gating weights of the low-frequency and high-frequency features according to formulas (4) and (5) in the invention description. and Building upon this, high-frequency features are selectively filtered using adaptive gated Hadamard product calculation, enhancing aggregate particle boundary responses and suppressing background pseudo-edges. Finally, the enhanced high-frequency features obtained after filtering are added and fused with the original low-frequency components, and the dimensional space is reconstructed using bilinear interpolation to output the final edge-enhanced feature representation. This effectively avoids the loss of small-diameter fine aggregate features during downsampling and propagation throughout the feature flow.
[0103] The CSFM-GFFCA cross-scale feature interaction and fusion module performs progressive cross-scale fusion within the CSFM-GFFCA module using the following dynamic data interaction mechanism. First, the computing device uses 1×1 convolutions to align the channel dimensions of the extracted and enhanced S2, S3, and S4 multi-scale cascaded features to C=256, and upsamples the small-scale features to align the spatial resolution. Next, the system inputs the aligned features from adjacent scales into the dual-branch adaptive GGFFCA module, where adaptive weighted cross-scale feature interaction is performed through shared parameters, multi-head self-attention, and scaling factors. The resulting features are further input into a gated feedforward network, where they are equally divided along the channel dimension. The corresponding channel-gated signals are calculated using depthwise separable convolutions and the Tanh activation function to filter out low-level high-frequency background noise. The denoised features then pass through the reparameterization module RepC3, which can structurally fold and merge multiple branches during inference, significantly reducing computational overhead. By progressively upsampling and repeatedly stacking the aforementioned GGFCA and RepC3, the network gradually realizes the interaction between deep and shallow layers of features at each scale of S2, S3, and S4, and splices and cascades them in the channel dimension to construct a dense query representation with high spatial localization. Finally, it is fed into the SMA2Mask decoder, and forward propagation outputs the predicted segmentation mask of each aggregate candidate target.
[0104] Backpropagation and optimization of the loss function: During the backpropagation parameter training phase of the model, the system performs dynamic multi-objective gradient loss optimization using a single GPU. The processor and GPU calculate the total loss (Loss) in the current forward prediction state, which includes global aggregate counting loss, targeted counting loss for small micro-particle targets, and Focal loss for focusing on difficult-to-classify and difficult-to-detect pixel categories in segmentation boundary regions.
[0105] Aggregate Particle Segmentation and Counting Results: When the computing device switches to inference prediction mode, the system processes the input 1024×1024 pixel image and performs the following dynamic online gradation evaluation steps. The system directly performs a forward feature transfer calculation on the image to obtain the predicted aggregate probability and preliminary segmentation mask for all selected target areas. The system internally calls non-maximum suppression (NMS) to filter overlap detection. Subsequently, using the predicted feature boundary map calculated forward, the uncut aggregate in the unsegmented state is predicted as a white area with a brightness of 1, and the background is identified as black with a value of 0, generating an initial foreground connectivity mask binary map. Based on this, the system adaptively extracts a fine watershed edge segmentation line matrix through segmentation features and forcibly resets the pixel brightness of the corresponding spatial coordinate points of the matrix to black zero values, thereby directly constructing and outputting the segmentation and counting result map to the display terminal.
[0106] (3) Effects
[0107] Experiment on setting the number of prompt boxes: (attached) Figure 5 As shown in the figure, (a), (b), (c), and (d) represent the experimental results of cue boxes for fine aggregates, with the three columns of visualizations representing the input image with cue boxes, the counting statistics, and the segmentation results, respectively. It can be seen that in the segmentation results of fine aggregate technology, the model's counting becomes more accurate as the number of cue boxes increases; the counting results are consistent when there are three and four cue boxes. Figures (e), (f), (g), and (h) represent the experimental results of cue boxes for fine aggregates, with the three columns of visualizations representing the input image with cue boxes, the counting statistics, and the segmentation results, respectively. It can be seen that in both coarse and fine aggregates, the number of cue boxes causes errors in the segmentation counting results, and the impact of the number of cue boxes is greater as the amount of aggregate increases. The counting results are more accurate when there are three cue boxes. Therefore, to uniformly measure the superiority of the BC-GECO2 of this invention and the effectiveness of the improvement strategy, this invention combines the original GECO2 cue box manufacturing requirements and standards, selects cue boxes with the same position and number on the test set, and in the process of selecting cue boxes, tries to select three cue boxes with overlapping parts for subsequent ablation experiments and comparative experiments.
[0108] Ablation experiment results validate: Appendix Table 1 shows the superiority of each improved strategy in coarse and fine aggregate segmentation and counting. All four innovative improved strategies have a positive promoting effect on the segmentation and counting results. On the coarse aggregate dataset, compared with the baseline model, the IoU, DICE, and BIoU indices improved by 2.65%, 2.64%, and 3.97%, respectively, while the MAE and RMSE indices decreased by 3.38 and 8.81, respectively. On the fine aggregate dataset, compared with the baseline model, the IoU, DICE, and BIoU indices improved by 3.18%, 7.43%, and 1.69%, respectively, while the MAE and RMSE indices decreased by 10.45 and 22.49, respectively. This demonstrates that BAHiera extracts richer dense aggregate depth and edge features, avoiding the loss of aggregate features during feature extraction, and achieving better results in fine aggregate particle size. DFG-Edge further enhances the edge response of aggregate particle targets, suppresses interference from non-target regions, makes the edge information of aggregate particles clearer, and reduces the probability of missed detections. CSFM-GFFCA achieves adaptive weighted fusion of features at adjacent scales by introducing a learnable gating and symmetric bi-branch interaction mechanism. This effectively suppresses shallow high-frequency noise and significantly enhances the edge response channels of aggregates, precisely addressing the key issues of easy loss of small target features and blurred edges in dense aggregate scenarios. Finally, the introduced Focal loss function allows the model to focus optimization on hard-to-classify target pixels such as edges during training, resolving the undercount phenomenon caused by the relatively smooth features of dense aggregates.
[0109] Comparative Experiment Results Verification: To verify the effectiveness and comparability of BC-GECO2 in aggregate segmentation and counting, comparative experiments were conducted using Mask-RCNN, SAM, SAM-Med2D, TransUnet, DINOv3, VRP-SAM, and GECO2. Appendix Table 2 shows that on the coarse aggregate particle dataset, BC-GECO2 achieved the highest IoU, DICE, BIoU, MAE, and RMSE indices, at 98.82%, 98.37%, 95.44%, 9.79, and 38.48 respectively. This indicates that the BAHiera module can extract rich dense aggregate depth and edge features, effectively avoiding aggregate loss during feature extraction, and performs better in fine aggregate particle size analysis. DFG-Edge further enhances the edge response of aggregate particles and suppresses interference from non-target regions, making edge information clearer and reducing the probability of missed detections. CSFM-GFFCA achieves adaptive weighted fusion of adjacent scale features through learnable gating and symmetric dual-branch interaction mechanisms, significantly enhancing the edge response channels of aggregates. Combined with the Focal loss function guiding the model to focus on hard-to-classify pixels such as edges, this addresses the issues of easily lost small target features and counting errors caused by blurred edges in dense aggregate scenarios. Compared to algorithms SAM, Mask-RCNN, GECO2, and VRP-SAM, it also demonstrates advantages in segmentation performance on coarse aggregate datasets. This is because SAM, based on the Transformer architecture, uses cue-driven and pixel-level dense prediction to directly generate high-resolution segmentation masks without retraining on specific datasets. Its zero-sample transfer capability effectively solves the segmentation failure problem caused by blurred aggregate edges and low gray-scale contrast in concrete borehole images. Mask-RCNN employs a two-stage "detection + segmentation" optimization framework, predicting bounding boxes and pixel-level masks in parallel based on RPN candidate regions, and using instance-level feature alignment to achieve accurate separation of densely stacked aggregates. GECO2 employs a multi-scale, hierarchical query aggregation mechanism to progressively fuse target prototype information across different receptive fields, generating dense query representations to simultaneously capture large-scale irregular stones and small-scale aggregate particles. Its inter-scale feature interactions effectively balance global context and local details. VRP-SAM embeds a visual reference cue encoder within the SAM, transforming the annotation information of a small number of reference images into generalized priors based on a meta-learning strategy. This ensures robust segmentation capabilities against aggregate morphology and texture variations even in new sample scenarios. On a fine aggregate particle dataset, BC-GECO2 achieves IoU, DICE, BioU, MAE, and RMSE scores of 92.39%, 91.46%, 90.38%, 13.40, and 44.57, respectively, demonstrating that the proposed BC-GECO2 algorithm can perform segmentation and counting tasks on datasets with varying coarse and fine aggregate particle sizes, exhibiting strong generalization ability and stability.
[0110] Comparative visualization results: See the appendix for the visualization results of the segmentation count on the coarse aggregate dataset. Figure 6 Four typical scenarios were selected: the first row shows a dense coarse aggregate scenario, the second row shows a scenario with overlapping coarse aggregates, the third column shows a sparse scenario with background interference, and the fourth column shows a dense scenario with blurred boundaries. In the dense coarse aggregate scenario, Mask-RCNN, SAM-Med2D, TransUnet, and DINOv3 all exhibit segmentation of adhered objects. SAM, GECO2, VRP-SAM, and BC-GECO2 show better segmentation results, and the counting result of BC-GECO2 is closer to the Ground Truth count. In the scenario with overlapping coarse aggregates, TransUnet and DINOv3 both exhibit oversegmentation of overlapping aggregates, GECO2 exhibits undersegmentation, and BC-GECO2 has a lower counting error. In the sparse scenario with background interference, Mask-RCNN, SAM-Med2D, and DINOv3 exhibit undersegmentation or oversegmentation, causing statistical bias, while BC-GECO2's counting result is accurate. In dense boundary blurring scenes, Mask-RCNN, SAM, SAM-Med2D, TransUnet, DINOv3 and GECO2 all exhibit undersegmentation or oversegmentation. VRP-SAM and BC-GECO2 show better segmentation results, and the BC-GECO2 of this invention does not show any counting errors.
[0111] See the appendix for the visualization results of the segmentation count on the fine aggregate dataset. Figure 7Four typical scenarios were selected: the first row shows a scenario with densely stacked small fine aggregates; the second row shows a scenario with overlapping small aggregates; the third column shows a scenario with densely stacked aggregates that are similar in appearance; and the fourth column shows a scenario with sparse backgrounds and complex, blurred boundaries. In the scenario with densely stacked small fine aggregates, all algorithms exhibited varying degrees of undersegmentation or oversegmentation. This is because when aggregate particles are smaller than a certain pixel size, the boundaries are blurred, the gray-level contrast between adjacent aggregate particles is low, and noise is difficult to distinguish from the real edges. This results in the algorithm lacking sufficient discriminative cues to accurately separate adhered particles, leading to undersegmentation or oversegmentation. Furthermore, the small fine aggregates contain extremely limited pixel features, causing the deep learning feature extraction network to activate only a very few or even a single feature point in the corresponding feature map after downsampling, losing the original shape and boundary cues. However, based on the counting results, the BC-GECO2 algorithm of this invention has a count of 620, which is closer to the GT algorithm's 623. In scenarios with small overlap of aggregates, Mask-RCNN, SAM-Med2D, TransUnet, and DINOv3 all exhibit segmentation phenomena of adhered targets. SAM, GECO2, VRP-SAM, and BC-GECO2 show better segmentation results, and the counting result of BC-GECO2 in this invention is closer to the Ground Truth counting value. In dense aggregate segmentation scenarios with similar appearances, both SAM-Med2D and TransUnet exhibit oversegmentation of overlapping aggregates. Mask-RCNN, SAM, DINOv3, GECO2, VRP-SAM, and BC-GECO2 show superior segmentation results. Furthermore, the ground truth (GT) is 350, compared to Mask-RCNN (249), SAM (281), SAM-Med2D (259), TransUnet (273), DINOv3 (286), GECO2 (342), VRP-SAM (317), and BC-GECO2 (347). This indicates that the BC-GECO2 algorithm's count is closer to the true value. In sparse background, complex boundary, and blurred scenarios, all comparison algorithms show superior segmentation results, with the BC-GECO2 algorithm's count being closer to the true value (see the attached table for English abbreviations and codes).
[0112] Appendix 3: Comparison of English Abbreviations and Codes
[0113]
[0114] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, technical solutions formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.
Claims
1. A depth-feature-based method for segmenting and counting hydraulic concrete aggregates, using the BC-GECO2 network as the mainstream segmentation and counting method, characterized in that... The BC-GECO2 network includes a BAHiera feature extraction module, a DFG-Edge edge enhancement module, a CSFM-GFFCA cross-scale feature interaction fusion module, and a joint loss function composed of Focal and counting loss; the core method and system flow include: The aggregate image is acquired and reconstructed into 1024×1024 pixels. More than three rectangular target cue boxes are selected. The local features of the cue boxes are cropped and aligned from the feature map using the ROI Align operator. The MLP transformation is used to convert it into a 256-dimensional feature map. The high-dimensional features are focused on the spatial center of the dense aggregate through cross attention and deformable attention. The BAHiera feature extraction module performs forward propagation on the input features and outputs feature maps S2, S3, and S4 at three different spatial scales. The DFG-Edge edge enhancement module explicitly enhances the edges of features S2, S3, and S4, and outputs the enhanced features. The extracted and enhanced multi-scale cascaded features of S2, S3, and S4 are processed by the CSFM-GFFCA cross-scale feature interaction fusion module to construct a dense query representation with high spatial localization. This representation is then fed into the SMA2 Mask decoder to output the predicted segmentation mask of each aggregate candidate target and counted to complete the overall process of the system. During the training phase, dynamic multi-objective gradient loss optimization is performed through the joint loss function to calculate the total loss, which includes global aggregate counting loss, small target counting loss for target pixels with dimensions ≤25×25, and Focal loss, where the small target counting weight is 0.
3. During the inference phase, a forward feature transfer calculation is directly performed on the input 1024×1024 pixel image to obtain the predicted segmentation mask. Non-maximum suppression is called to filter the overlap detection and generate an initial foreground connectivity mask binary map. The fine watershed edge segmentation line matrix is extracted adaptively through segmentation features, and the segmentation and counting result map is constructed and output.
2. The method for segmenting and counting hydraulic concrete aggregates based on depth features according to claim 1, characterized in that, The core BAHiera feature extraction module contains four cascaded sub-modules. In each BAHiera block, a binary self-attention mechanism is run: the mean of Q and K along the token and channel dimensions is calculated, Q and K are binarized using a quantization function, and the self-attention matrix is obtained by fusing the binarized matrix with a learnable bias. The value matrix V is decomposed channel by channel and quantized into an 8-bit integer using a scaling factor, and matrix multiplication is performed with the self-attention matrix to output enhanced features.
3. The method for segmenting and counting hydraulic concrete aggregates based on depth features according to claim 1, characterized in that, The DFG-Edge edge enhancement module uses discrete wavelet transform to decompose the input features into high-frequency and low-frequency components. It calculates the gate weights of low-frequency and high-frequency features through global average pooling and linear layer interaction. The high-frequency features are selectively filtered through adaptive gated Hadamard product. The enhanced high-frequency features are added and fused with the original low-frequency components, and the dimensional space is reconstructed through bilinear interpolation.
4. The method for segmenting and counting hydraulic concrete aggregates based on depth features according to claim 1, characterized in that, The core CSFM-GFFCA cross-scale feature interaction fusion module uses 1×1 convolution to align the channel dimensions of S2, S3, and S4 to C=256, upsamples the small-scale features to align the spatial resolution, and feeds the aligned features of adjacent scales into the dual-branch adaptive GGFFCA module. Through shared parameter multi-head self-attention and scaling factor, adaptive weighted cross-scale feature interaction is performed. The resulting features are input into a gated feedforward network, which is divided into pairs along the channel dimension. The channel gate signal is calculated by depthwise separable convolution and Tanh activation function to filter low-level high-frequency background noise. The denoised features are then passed through the RepC3 structure reparameterization module. Through stepwise upsampling and repeated stacking of GGFFCA and RepC3, feature interaction at each scale is achieved, and dense query representation is constructed by concatenating and splicing along the channel dimension.
5. The method for segmenting and counting hydraulic concrete aggregates based on depth features according to claim 1, characterized in that, The system requires manual selection of three rectangular target prompt boxes, and when selecting prompt boxes, try to select three prompt boxes with overlapping parts of aggregate particles.
6. The method for segmenting and counting hydraulic concrete aggregates based on depth features according to claim 1, characterized in that, The extraction process of the core watershed edge segmentation line matrix is as follows: the uncut aggregate in the unsegmented state is predicted as a white area with a brightness of 1, and the background is identified as black with a value of 0. An initial foreground connected mask binary map is generated. Based on this, a fine watershed edge segmentation line matrix is extracted adaptively through segmentation features, and the pixel brightness of the corresponding spatial coordinate point of the matrix is forcibly reset to black zero value.
7. A depth-feature-based hydraulic concrete aggregate segmentation and counting system, used to perform the method according to any one of claims 1 to 6, characterized in that, include: An image acquisition device is used to acquire aggregate images in a darkroom environment. The device consists of a high-precision electronic scale, a vibrator, a uniform LED backlight panel, and a camera. The aggregate sample, which has been thoroughly stirred and weighed, is evenly spread on the backlight panel through high-frequency vibration. The LED backlight is turned on to highlight the edges of small particles and the orthographic projection angle is corrected to eliminate distortion. The image is then focused, captured, and saved. The system preprocessing unit is used to uniformly crop, scale, and reconstruct the acquired images to 512×512 pixels, remove blurry and jittery images, and perform fine pixel-level annotation to build a training dataset. The processor and GPU collaborative computing unit is used to deploy and run the BC-GECO2 network, which includes the BAHiera feature extraction module, the DFG-Edge edge enhancement module, the CSFM-GFFCA cross-scale feature interaction fusion module, and a joint loss function composed of Focal and counting loss. The display terminal is used to receive and output the segmentation and counting result diagrams.
8. The hydraulic concrete aggregate segmentation and counting system based on depth features according to claim 7, characterized in that, The processor and GPU co-computing unit performs the following operations during the training phase: all parameters of the BAHiera backbone network are frozen, the epoch is set to 200, the AdamW optimizer is used, and the initial learning rate is 1×10⁻⁶. -4 The weight decay coefficient is 5×10 -5 The batch size is 4.
9. The hydraulic concrete aggregate segmentation and counting system based on depth features according to claim 7, characterized in that, The processor and GPU co-computing unit performs the following operations during the inference phase: directly processes the input image with a fixed pixel size of 1024×1024 without using any image upsampling or block stitching strategies.