A concrete crack detection method based on image recognition
Patent Information
- Application Number
- CN202610447892.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-07
- Publication Date
- 2026-06-26
AI Technical Summary
Existing deep learning-based concrete crack detection models suffer from high computational resource consumption, slow inference speed, and insufficient accuracy and robustness in complex environments, making it difficult to meet the needs of real-time on-site detection, especially in terms of insufficient extraction of feature information for slender, weak, and irregular cracks.
A YOLO-PDGS target detection model is constructed. The C3K2_DFM module is used to extract multi-scale features through parallel processing of multi-shape convolution kernels and dynamic gating mechanism. The P2SA-FPN module and GALA module are combined to fuse deep and shallow features. The detection head captures crack features through channel compression and multi-directional differential convolution. Lightweight optimization is performed through DepGraph pruning and BCKD knowledge distillation.
It achieves lightweight concrete crack detection, improves the detection accuracy and robustness of the model under complex backgrounds, meets the needs of real-time detection, significantly optimizes the number of parameters and computational load, achieves a detection accuracy of 84.0%, and is adaptable to different lighting conditions and complex backgrounds.
Smart Images

Figure CN122289235A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing and structural health monitoring technology, specifically relating to a concrete crack detection method based on image recognition. Background Technology
[0002] As a core component of infrastructure, concrete structures are prone to cracking and defects during their service life due to environmental stress, material deterioration, construction defects, and other factors.
[0003] Concrete structures are core components of infrastructure such as bridges, tunnels, and buildings. During their long-term service, they are highly susceptible to various cracks on their surface due to environmental stress, material degradation, load variations, and construction defects. These cracks are important early indicators of structural health deterioration, and accurate and efficient detection of them is crucial for preventing structural damage, ensuring public safety, and implementing scientific operation and maintenance.
[0004] Traditional crack detection methods primarily rely on manual inspections, with inspectors observing and recording using the naked eye or simple tools (such as crack width comparison cards and microscopes). This method suffers from inherent drawbacks, including low efficiency, high subjectivity, high risk (e.g., working at heights or inside tunnels), and difficulty in achieving large-scale, full-coverage structural inspections. With the development of digital image processing technology, automatic detection methods based on traditional image processing algorithms have emerged, typically including steps such as image noise reduction, contrast enhancement, binarization, and edge detection. However, these methods are highly sensitive to factors such as ambient lighting, background texture, and image noise, have high computational complexity, and poor generalization ability, making them unsuitable for the complex and varied scenarios in real-world engineering projects, resulting in unsatisfactory detection accuracy and robustness.
[0005] Currently, deep learning-based detection methods, represented by Convolutional Neural Networks (CNNs) and object detection models such as YOLO and Faster R-CNN, provide new solutions for automatic crack detection. These methods can automatically learn deep features of cracks from large amounts of data, exhibiting stronger feature representation and generalization capabilities. However, existing deep learning-based crack detection models still have significant shortcomings: on the one hand, many models have complex structures and a large number of parameters, requiring substantial computational resources during detection inference, resulting in slow inference speeds and difficulty in meeting the needs of real-time or near-real-time on-site detection; on the other hand, existing models are poorly designed in terms of multi-scale feature extraction and fusion, failing to fully capture the feature information of complex cracks on concrete surfaces (such as slender, weak, and irregularly shaped cracks) at different scales, especially under complex background interference, where the detection accuracy and robustness of the models still need improvement.
[0006] Therefore, it is necessary to design a lightweight concrete crack detection method to improve the above-mentioned problems, so as to meet the urgent need for efficient and automated inspection in actual engineering.
[0007] Invention / Invention Content To address the problems of existing technologies, this invention provides a concrete crack detection method based on image recognition, comprising: Acquire images of cracks to be detected in concrete structures; A YOLO-PDGS target detection model is constructed, and the crack image to be detected is input into the YOLO-PDGS target detection model to detect the number, size, location and category information of cracks; The YOLO-PDGS target detection model is based on the YOLOv11 model and includes an input layer, a backbone network, a feature fusion layer, and a detection head. The backbone network includes a C3K2_DFM module, whose input is connected to the input layer and whose output is connected to the feature fusion layer. The C3K2_DFM module is used to extract multi-scale features of crack images and suppress background redundancy information through parallel processing of multi-shape convolution kernels and dynamic gating mechanism. The feature fusion layer includes a P2SA-FPN module and a GALA module connected in sequence. The P2SA-FPN module is used to introduce the shallow feature map of the P2 layer of the YOLOv11 basic framework and supplement and fuse it with the deep feature maps of the P3-P5 layers output by the C3K2_DFM module. The GALA module is used to achieve the collaborative fusion of shallow and deep features and output multi-scale fused features that have both edge details and semantic information. The detection head is used to perform fine-grained perception, localization, and classification of the multi-scale fusion features, and to reduce the number of model parameters through channel compression; Furthermore, the C3K2_DFM module includes the MD-IncepConv submodule, the AMFA submodule, and the AMDM submodule; The MD-IncepConv submodule employs parallel square convolution kernels, horizontal stripe convolution kernels, and vertical stripe convolution kernels. It performs independent channel convolution processing on the input features through depth-separable convolution to simultaneously capture the planar texture features and multi-directional elongated features of the crack. The AMFA submodule divides the input features into two groups of sub-features along the channel dimension, and feeds them into the MD-IncepConv submodule with different receptive fields. The output features are concatenated by channels and then unified by 1×1 convolution to achieve the aggregation of multi-scale features. The AMDM submodule fuses the output features of the AMFA submodule with gated linear units through convolution operations, generates activation features and gated features through double convolution, and uses the Sigmoid gating mechanism to weight and modulate the feature stream, dynamically filtering effective crack features and suppressing background redundancy information. Furthermore, the P2SA-FPN module includes a shallow feature introduction unit, a semantic enhancement module, and a RAU unit; The shallow feature introduction unit connects the shallow feature map of layer P2 and the deep feature maps of layers P3-P5 of the C3K2_DFM module; The RAU unit unifies the feature channel dimensions of P2 layer and P3-P5 layer through 1×1 convolution, and generates an attention weight map through the Sigmoid function. It then achieves dynamic weighted fusion of deep and shallow layer features through element-wise multiplication. The semantic enhancement module enhances the weighted and fused features through 3×3 convolution, and outputs deep semantic features and spatial detail features; Furthermore, the GALA module includes a feature compression unit, two pairs of local-global attention sub-modules, and a feature fusion unit; The feature compression unit unifies the deep semantic features of the deep feature map with the spatial detail features of the shallow feature map through 1×1 convolution, and adds the two features to generate a preliminary fusion feature. The local-global attention submodule is divided into two groups. One group uses 2×2 patch partitioning to extract local detail features of the crack, and the other group uses 4×4 patch partitioning to extract global context features. Each submodule completes feature modeling through expansion, averaging, FFN calculation, feature selection and reshaping. The feature fusion unit concatenates local detail features and global context features by channel, and then reconstructs features by sequentially performing reparameterized convolution and 1×1 convolution. Furthermore, the detection head includes a channel compression module, a shared detail enhancement convolution module, a regression branch, and a classification branch; The channel compression module performs channel unification and normalization on the multi-scale features of layers P2-P5 through 1×1 convolution and group normalization, thereby reducing statistical bias and the number of model parameters. The shared detail enhancement convolutional module includes five directional convolutional branches: central difference convolution, angular difference convolution, horizontal difference convolution, vertical difference convolution, and ordinary convolution. Each branch uses a 3×3 convolutional kernel, and its weights are fused into a combined filter after training to capture multi-directional fine-grained features of cracks. The regression branch uses a discrete focus loss framework to accurately locate crack bounding boxes; the classification branch is used for the identification of four types of cracks; the regression branch and the classification branch share a channel compression module and a detail enhancement convolution module. Furthermore, the detection head dynamically adjusts the feature contribution weights at each scale using a learnable scaling factor.
[0008] Furthermore, the detection method also includes performing lightweight optimization on the initially trained YOLO-PDGS target detection model through a lightweight optimization unit to obtain the final lightweight crack detection model; The lightweight optimization includes: the lightweight optimization unit is equipped with a DepGraph pruning subunit and a BCKD knowledge distillation subunit. The DepGraph pruning subunit analyzes the inter-layer and intra-layer parameter dependencies of the P2SA-FPN module, C3K2_DFM module, GALA module and detection head in the model, generates a network dependency graph, and performs channel-level batch pruning along the dependency path. Then, the BCKD knowledge distillation subunit uses the unpruned YOLO-PDGS model as the teacher model and the pruned lightweight model as the student model. Through joint training with binary classification distillation loss and unstructured intersection-union distillation loss, the knowledge of the teacher model is transferred to the student model to recover the accuracy loss caused by pruning and obtain the final lightweight crack detection model.
[0009] Furthermore, the DepGraph pruning subunit adopts a low-level pruning algorithm. By analyzing the inter-layer and intra-layer parameter dependencies of the P2SA-FPN module, C3K2_DFM module, GALA module and detection head in the model, a network dependency graph is generated, and channel-level batch pruning is performed along the dependency path. The BCKD knowledge distillation subunit adopts the logic distillation method. Through joint training with binary classification distillation loss and unstructured intersection-union ratio distillation loss, during the distillation process, the pruned lightweight model is set as the student model and the unpruned YOLO-PDGS model is set as the teacher model. The knowledge of the teacher model is transferred to the lightweight student model to recover the model accuracy loss caused by pruning.
[0010] The beneficial effects that this application can produce include: 1) This application constructs a YOLO-PDGS fully automatic target detection model based on YOLOv11, which realizes end-to-end intelligent identification of concrete cracks. The model autonomously extracts the essential features of cracks through large-scale data training, eliminating the dependence on manually designed operators. Combined with a systematic data augmentation strategy, the robustness of the model under different lighting conditions, complex backgrounds and noise interference is significantly enhanced, thereby greatly improving the environmental adaptability and working condition stability of the detection system. 2) This application adopts a collaborative strategy of high-performance backbone network and lightweight post-optimization; at the model structure level, by introducing the C3K2_DFM module based on depthwise separable convolution and the detection head structure with channel compression capability, the feature expression capability is improved while the parameter growth is effectively controlled; further, DepGraph structured pruning and BCKD knowledge distillation are integrated as necessary optimization steps in model construction, and the model parameter size is compressed to 0.97M and the computational cost is reduced to 4.3 GFLOPs without losing detection accuracy, achieving significant optimization of model size and computational efficiency, and meeting the performance requirements of edge computing devices for real-time inference; 3) This application sets up a multi-level feature enhancement and fusion mechanism. Through the parallel design of multi-shape convolution kernels and dynamic weight mechanism in the C3K2_DFM module, it achieves targeted extraction of multi-directional extension features of cracks. The P2SA-FPN module introduces shallow detail features and performs attention-guided fusion with deep semantic features, enhancing the ability to finely depict crack contours. Furthermore, the local-global attention alignment mechanism of the GALA module is used to improve the model's ability to perceive and distinguish low-contrast cracks and complex-shaped cracks. The multi-directional differential convolution fusion structure adopted in the detection head further enhances the capture of crack edges and texture details. Through the synergistic effect of various modules of the model and subsequent pruning and distillation optimization, this application achieves 84.0% mAP on the public test set, with detection accuracy significantly better than the current mainstream models, while maintaining extremely low parameter and computational costs, achieving the best balance between accuracy and efficiency. Attached Figure Description
[0011] Figure 1 This is a schematic diagram of the overall framework structure of the YOLO-PDGS model of the present invention; Figure 2 A schematic diagram of the YOLOv11 model structure, which serves as the basic framework; Figure 3 This is a schematic diagram of the semantic enhancement module structure in the P2SA-FPN module of the present invention; Figure 4 This is a schematic diagram of the C3K2_DFM module structure of the present invention; Figure 5 This is a schematic diagram of the MD-IncepConv submodule and AMFA submodule structure of the present invention; Figure 6 This is a schematic diagram of the AMDM submodule and convolutional gated linear unit structure of the present invention; Figure 7 This is a schematic diagram of the GALA module structure of the present invention; Figure 8 This is a schematic diagram of the local-global attention submodule structure in the GALA module; Figure 9 This is a schematic diagram of the shared detail enhancement convolutional detection head structure of the present invention; Figure 10 This is a schematic diagram of the enhanced convolutional module structure of the present invention; Figure 11 This is a schematic diagram of the DepGraph pruning algorithm of this invention; Figure 12 This is a flowchart of the BCKD knowledge distillation method of the present invention; Figure 13 This is an example diagram illustrating the data augmentation method of the present invention applied to this application; Figure 14 This is a graph showing the change in the number of crack samples of each category before and after data enhancement according to the present invention; Figure 15 This is a schematic diagram comparing the computational load of the model before and after channel compression in this invention; Figure 16 This is a schematic diagram comparing the parameter values of the model before and after pruning in this invention; Figure 17 This is a schematic diagram comparing the precision-recall curves of different models in this invention; Figure 18 This is a schematic diagram comparing the number of parameters, computational load, and inference speed of different models in this invention. Figure 19 This is a visual comparison of the detection results of the present invention in various crack scenarios. Detailed Implementation
[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0013] Example 1 Please see Figure 1-19 This invention provides a concrete crack detection method based on image recognition, comprising: Acquire images of cracks to be detected in concrete structures; A YOLO-PDGS target detection model is constructed, and the crack image to be detected is input into the YOLO-PDGS target detection model to detect the number, size, location and category information of cracks; The YOLO-PDGS target detection model is based on the YOLOv11 model and includes an input layer, a backbone network, a feature fusion layer, and a detection head. The backbone network includes a C3K2_DFM module, whose input is connected to the input layer and whose output is connected to the feature fusion layer. The C3K2_DFM module is used to extract multi-scale features of crack images and suppress background redundancy information through parallel processing of multi-shape convolution kernels and dynamic gating mechanism. The feature fusion layer includes a P2SA-FPN module and a GALA module connected in sequence. The P2SA-FPN module is used to introduce the shallow feature map of the P2 layer of the YOLOv11 basic framework and supplement and fuse it with the deep feature maps of the P3-P5 layers output by the C3K2_DFM module. The GALA module is used to achieve the collaborative fusion of shallow and deep features and output multi-scale fused features that have both edge details and semantic information. The detection head is used to perform fine-grained perception, localization, and classification of the multi-scale fusion features, and to reduce the number of model parameters through channel compression; Furthermore, the C3K2_DFM module includes a depthwise separable convolutional submodule (MD-IncepConv), a multi-shape convolutional adaptive feature aggregation submodule (AMFA), and an adaptive multi-scale dynamic modulation module (AMDM). The MD-IncepConv submodule employs parallel square convolution kernels, horizontal stripe convolution kernels, and vertical stripe convolution kernels. It performs independent channel convolution processing on the input features through depth-separable convolution to simultaneously capture the planar texture features and multi-directional elongated features of the crack. The AMFA submodule divides the input features into two groups of sub-features along the channel dimension, and feeds them into the MD-IncepConv submodule with 3×3 and 5×5 receptive fields respectively. After the output features are concatenated by channels, the channel dimension is unified by 1×1 convolution to achieve the aggregation of multi-scale features. The AMDM submodule fuses the output features of the AMFA submodule through a convolutional gated linear unit (ConvolutionalGLU), generates activation features and gated features through double convolution, and uses a sigmoid (activation) gating mechanism to weight and modulate the feature stream, dynamically filtering effective crack features and suppressing background redundancy information. It should be noted that the P2SA-FPN module is an improved feature pyramid network based on the P2 layer and incorporating scale-aware attention, while the C3K2_DFM module is a lightweight module that integrates dual-convolutional kernel cross-stage feature extraction and dynamic feature fusion. Based on the C3K2 architecture, this module extracts multi-scale spatial features through dual-branch convolutions and embeds a DFM dynamic fusion mechanism to adaptively weight and fuse global context and local detail features. While maintaining low parameter and computational costs, it significantly improves the feature representation ability and detection accuracy of small targets (such as cracks and defects). The C3K2_DFM module, as the core feature extraction unit of the YOLO-PDGS model backbone network, is designed to address the technical problems of the traditional C3K2 module, such as insufficient adaptability to feature capture of concrete cracks (slender shape, multi-directional distribution, and low contrast characteristics), redundant parameters, and low computational efficiency. Its aim is to improve the extraction accuracy and resistance to background interference of multi-scale crack features while maintaining a lightweight model. This module achieves its functionality through the following technical means: A depthwise separable convolutional submodule is employed, using a parallel design of square convolutional kernels (3×3), horizontal stripe convolutional kernels (1×5), and vertical stripe convolutional kernels (5×1). These kernels are adapted to features such as planar texture, horizontal elongation, and vertical elongation of cracks, respectively, enabling simultaneous capture of local features at multiple scales and in multiple directions. The specific module structure is as follows: Figure 5 As shown in (b); Square convolutional kernels excel at extracting overall texture information within a local neighborhood, making them suitable for capturing planar features; horizontal and vertical stripe convolutional kernels focus on fine, elongated cracks with a smaller pixel footprint. The depthwise separable convolution of each branch can be represented as: (2.4) in, c For channel index, ( x , y () represents spatial coordinates. w i For the first i Each branch convolution kernel weight, K i × K j The kernel size is the convolution kernel size. P i , P j For corresponding filling. Depthwise separable convolution can perform convolution on each channel independently, preserving spatial information while significantly reducing computational complexity. Through parallel combination of multi-shaped convolution kernels, the model can capture multi-scale, multi-directional local features at the same level, effectively adapting to the diverse manifestations of cracks in complex backgrounds.
[0014] Furthermore, to address the varying importance of different crack morphologies to features, the module introduces a dynamic weighting mechanism. Weight vectors are generated through a global information extraction mechanism. ,satisfy , representing the contribution of different convolutional branches. The fused features are given by a weighted sum: (2.5) The weight generation depends on the global statistical features of the input, and is adaptively adjusted by a lightweight network. This helps the model automatically adjust its attention to features in different directions according to the specific crack texture, thereby enhancing the flexibility of expression and the ability to distinguish. Building upon this, the multi-scale orientation information modeling capability is further extended through the AMFA submodule. This module divides the input features into two groups of sub-features along the channel dimension, which are then fed into the MD-IncepConv submodule with different convolutional receptive field configurations to form a multi-scale orientation perception path. One group uses a smaller convolutional kernel (3×3) to focus on local details, while the other group uses a larger receptive field (5×5) to capture long-range structural information. After modeling along different path directions, the output features are concatenated and fused along the channel dimension, and a 1×1 convolution is used to unify the channel dimension, enhancing the consistency and information reconstruction capability of multi-scale orientation perception. The specific structure is as follows: Figure 5 As shown; The AMDM submodule fuses the output features of the AMFA submodule with gated linear units via convolution, generating activation and gated features through double convolution: (2.6) Subsequently, the characteristic flow is adjusted through a gating mechanism. ; This represents an element-wise multiplication operation, which performs weighted modulation of the feature map in both the channel and spatial dimensions. σ The sigmoid function ensures that the gated features are between 0 and 1, dynamically selecting and amplifying key activation features while suppressing irrelevant noise. The specific structure of AMDM is as follows: Figure 6 As shown.
[0015] Finally, the C3K2_DFM module efficiently combines the lightweight residual module C3K2 with AMDM. The C3K2 module is responsible for the rapid fusion and initial representation of shallow features, ensuring the stability and hierarchical progression of information transmission. Replacing C3K2 with AMDM, with its powerful multi-directional feature extraction and gating mechanism, further mines and optimizes the representation of deep crack features. The synergistic effect of the overall structure realizes the dynamic fusion and optimization of multi-scale, multi-directional, and multi-level features, significantly improving the model's ability to capture complex crack morphologies and its recognition accuracy. Furthermore, the P2SA-FPN module includes a shallow feature introduction unit, a semantic enhancement module, and a RAU unit; The shallow feature introduction unit connects the shallow feature map of layer P2 and the deep feature maps of layers P3-P5 of the C3K2_DFM module; The RAU unit unifies the feature channel dimension of P2 layer and P3-P5 layer to 64 through 1×1 convolution, and generates an attention weight map through the Sigmoid function. Dynamic weighted fusion of deep and shallow layer features is achieved through element-wise multiplication. The semantic enhancement module enhances the weighted and fused features through 3×3 convolution with 128 convolution kernels, thereby strengthening the consistency and discriminative power of feature expression and outputting deep semantic features and spatial detail features. It should be noted that the P2SA-FPN module, as the core feature fusion unit of the YOLO-PDGS model, aims to solve the technical problems in traditional FPN structures, such as inconsistent semantic levels between shallow and deep features, and insufficient fusion of edge details and global semantics, which lead to blurred contours and insufficient localization accuracy of concrete cracks (especially fine cracks). This is to improve the accuracy and robustness of crack detection in complex backgrounds. The module achieves its functionality through the following technical means: The shallow feature introduction unit simultaneously acquires the shallow feature map of layer P2 and the deep feature maps of layers P3-P5 of the C3K2_DFM module through direct access via dual paths and pre-adaptation of feature dimensions. This lays the foundation for the dynamic weighted fusion of the subsequent RAU unit. The specific access logic is as follows: Access path design Access to shallow feature maps in P2 layer: P2 layer is an early feature layer in the YOLOv11 basic framework, close to the input layer. It has not undergone deep processing by the C3K2_DFM module, directly preserving the original edges and subtle textures of concrete cracks, as well as other spatial details. The shallow feature introduction unit extracts P2 layer feature maps directly from the front end of the YOLOv11 backbone network through a dedicated feature channel, without requiring additional feature transformation or downsampling, ensuring no loss of spatial detail.
[0016] Access to deep feature maps in layers P3-P5: Layers P3-P5 are the output feature layers of the C3K2_DFM module. After parallel processing by multi-shape convolutional kernels and dynamic gating filtering by this module, they possess strong semantic expressive capabilities (such as the overall shape of cracks and category-related features). The shallow feature introduction unit directly receives the feature maps of layers P3, P4, and P5 output by the C3K2_DFM module through the direct connection interface between modules, ensuring the complete transmission of deep semantic features.
[0017] 2. Pre-adaptation processing after access The feature maps of the P2 layer and P3-P5 layers have different channel dimensions (the original dimensions are not uniform), but the shallow feature introduction unit is only responsible for "feature introduction" and does not perform dimension unification operations. It only performs two basic preprocessing operations: Feature integrity verification: Filter out invalid features (such as zero-value feature maps) caused by network propagation to ensure that all accessed feature maps are valid outputs; Feature alignment: Through simple spatial coordinate calibration, the feature maps of P2 layer (high resolution) and P3-P5 layer (low resolution, downsampled) maintain a spatial correspondence, avoiding positional shifts during subsequent fusion.
[0018] 3. Connection logic with subsequent modules The shallow feature introduction unit simultaneously feeds the preprocessed shallow feature map of layer P2 and the deep feature maps of layers P3-P5 to the RAU unit (recalibration attention unit) of the P2SA-FPN module. The RAU unit completes the channel dimension unification (the default unification is 64 dimensions) through 1×1 convolution and generates an attention weight map, ultimately realizing the dynamic weighted fusion of deep and shallow features.
[0019] The role of the shallow feature introduction unit is to accurately capture and directly transmit features. Through a dual-path direct connection design, it simultaneously acquires two types of complementary features and ensures feature effectiveness and spatial alignment through basic preprocessing, providing high-quality input for subsequent fusion operations.
[0020] A shallow feature map (P2 layer) and deep feature maps (P3-P5 layers) are introduced. The shallow feature map provides rich details and structural textures of the crack edges, while the deep feature maps provide highly discriminative semantic information, forming a complementary relationship. A semantic enhancement module (SA) and a re-calibration attention unit (RAU) are combined to guide the effective fusion of shallow edge information and deep semantic information, thereby achieving fine-grained characterization of the crack contour and accurate recalibration of the target location. The specific module structure is as follows: Figure 3 As shown. The outputs of RAU are concatenated using a 3×3 convolution. The process of the RAU module function PAU(·,·) can be represented as: The process of concatenating the outputs of RAU using a 3×3 convolution, and the RAU module function PAU(·,·) can be represented as: (2.1) (2.2) in, T 1. T 2 represents the input features, which are then subjected to linear mapping and the Sigmoid function. By reducing the channel dimension to 32, the feature map is obtained. , This is point-by-point multiplication. This is the reverse operation, achieved by eliminating features. This redefines inaccurate and coarse estimates as accurate and complete prediction maps. Through convolution operations, treating a 1×1 convolution as a linear mapping process, the overall SA process can be represented as: (2.3) in, It is a 3×3 convolution with batch normalization and ReLUctant activation layers. It contains deep semantic information resulting from the fusion of the third and fourth layers. This contains rich boundary details of the first layer. It is a splicing operation along the channel dimension. This is the output of the SA module. Compared to the traditional FPN structure, the SA module introduces a bidirectional fusion mechanism between high- and low-resolution features, significantly enhancing the information interaction capability between features, thereby improving the multi-scale feature fusion effect. Furthermore, the GALA module includes a feature compression unit, two pairs of Local-Global Attention sub-modules, and a feature fusion unit. The feature compression unit unifies the channel dimensions of the input deep semantic features and spatial detail features to 256 through 1×1 convolution, and the two features are added together to generate a preliminary fusion feature. The local-global attention submodule is divided into two groups. One group uses 2×2 patch partitioning to extract local detail features of the crack, and the other group uses 4×4 patch partitioning to extract global context features. Each submodule completes feature modeling through unfolding, averaging, feed-forward network (FFN) calculation, feature selection and reshaping. The feature fusion unit concatenates local detail features and global context features by channel, and then reconstructs features by passing them sequentially through reparameterized convolution and 1×1 convolution to enhance information interaction and semantic consistency. It should be noted that the semantically guided local-global fusion module (GALA), as the core unit for feature enhancement in the YOLO-PDGS object detection model of this invention, aims to solve technical problems in traditional feature fusion processes, such as the separation of local details and global contextual information, inconsistency in semantic levels of features at different scales, and insufficient representation of weak crack features. This, in turn, improves the model's ability to perceive and detect concrete cracks in complex backgrounds, with low contrast and irregular shapes. This module achieves its core function through the following collaborative technical means: A dual-path input processing mechanism is adopted, which integrates deep semantic features from the backbone network and spatial detail features from the upsampled path. After unifying the channel dimension through 1×1 convolution, preliminary fusion features are generated, laying the foundation for local-global modeling. Two pairs of local-global attention submodules are integrated to process input features from different resolution paths: high-level semantic features from the deep layers of the backbone network and spatial detail features from the upsampled path. First, the input features are compressed through 1×1 convolutions, their dimensions are unified, and then they are summed to form preliminary fusion information. This is followed by 3×3 convolutions to further extract joint semantic features. The compressed features from these two paths are then input into two LocalGlobalAttention modules. One branch uses a smaller patch partition (2×2) to establish local structural information, while the other branch uses a larger patch partition (4×4) to extract richer contextual semantic information. Structurally, the features output from the local and global paths are first concatenated by channel to restore the spatial dimension, and then fused with the previous fusion results. The fusion strategy sequentially employs concatenated compressed convolution, reparameterized convolution (RepConv), and 1×1 convolution to generate output features. This hierarchical attention fusion mechanism preserves detail information while integrating deep semantic information, contributing to improved detection accuracy. The specific structure of the GALA module is as follows: Figure 7 As shown.
[0021] The local-global attention submodule first utilizes unfolding and reshaping operations to... Divided into a set of spatially contiguous blocks ( ), and averaged the values of each channel ( Linear computation is performed using FFN. Subsequently, an activation function is applied to obtain the probability distribution of the linear computation features in the spatial dimension, and their weights are adjusted accordingly. The specific module structure is as follows: Figure 8 As shown. In the weighted results, feature selection is used to choose task-relevant features from the labels and channels. Specifically, it is assumed that... The weighted result can be expressed as .in, Indicates the first i Each output label has a feature selection function applied. The resulting output is... ,in and These are task-specific parameters. It is a cosine similarity function, whose value is restricted to the range [0, 1]. As a task embedding, it is used to specify which tags are task-relevant (measured by cosine similarity) and reweight them, thus simulating the tag selection process. Subsequently, it applies to each tag... PA linear transformation is used to select channels, followed by reshaping and interpolation operations to ultimately generate local detail features. and global context features .
[0022] Stacking and integrating three GALA modules into the YOLOv11 detection head not only achieves effective fusion of multi-scale contextual features but also significantly improves the model's attention modeling ability for crack regions, especially weak and narrow targets. Particularly in real-world scenarios with complex backgrounds and uneven lighting, the local-global interaction mechanism and semantic cue guidance strategy introduced by GALA provide more discriminative prior knowledge and contextual compensation, thereby enhancing the robustness and generalization ability of the overall detection system. Furthermore, the detection head includes a channel compression module, a shared detail enhancement convolution module, a regression branch, and a classification branch; The channel compression module performs channel unification and normalization on the multi-scale features of layers P2-P5 through 1×1 convolution and group normalization, thereby reducing statistical bias and the number of model parameters. The shared detail enhancement convolutional module includes five directional convolutional branches: central difference convolution, angular difference convolution, horizontal difference convolution, and vertical difference convolution. Each branch uses a 3×3 convolutional kernel, and the weights are fused into a combined filter after training. The activation function is SiLU, which is used to capture multi-directional fine-grained features of cracks. The regression branch adopts the DFL discrete regression framework with 4×16 output channels for accurate crack bounding box localization; the classification branch has 4 output channels for four types of cracks and shares a channel compression module and a detail enhancement convolution module. The detection head dynamically adjusts the contribution weights of features at each scale through a learnable scaling factor, and stacks two layers of shared detail enhancement convolutional modules to strengthen the integration of fine-grained features, thereby improving the detection accuracy and scale adaptability for slender, fine, and irregular cracks.
[0023] It should be noted that the Shared Detail-enhanced Convolutional Detection Head (SDCD), as the core detection output unit of the YOLO-PDGS target detection model in this invention, enhances the detection head's ability to detect fine-grained targets while maintaining overall inference efficiency and controllable model parameters. This detection head first introduces a channel compression module with a unified dimension in each scale feature branch to facilitate the subsequent implementation of a shared detail modeling structure. It then introduces structurally consistent and parameter-shared detail-enhanced convolutional modules in all scale features, thereby capturing the consistent structural features of crack targets at all scales. This improves the detection head's sensitivity to spatial boundaries and directional structures, reducing inconsistencies in detection results and localization errors across scales. The specific model structure is as follows: Figure 9 As shown.
[0024] Assume the first i The feature maps output by each detection layer are First, the features at each scale are processed by channel unification and normalization through independent one-dimensional convolution and group normalization (GN) operations layer by layer. The mapping function can be expressed as: (2.7) Here, σ represents the activation function. This process mainly achieves channel dimensionality reduction and nonlinear transformation, reducing model complexity while preserving key semantic information. Compared to the traditional BatchNorm, GN is more robust to mini-batch training and reduces the decline in generalization ability caused by statistical bias.
[0025] Subsequently, a shared convolutional module is used to uniformly process the feature layers to enhance feature sharing capabilities. The core detail enhancement convolutional module (DEConv_GN) is based on a multi-directional convolutional kernel weight fusion design, introducing five directional convolutional branches to address the diversity of spatial texture information: Central difference convolution (CDC), angular difference convolution (ADC), horizontal difference convolution (HDC), vertical difference convolution (VDC), and vanilla convolution (VC). The specific structure is as follows: Figure 10 As shown. Weights of each branch. and bias After fusion, the global convolutional weights and biases can be determined: (2.8) This fusion strategy is equivalent to constructing a multi-directional response combined filter within the spatial receptive field, enhancing the convolutional layer's ability to perceive complex textures and object boundaries. It can be viewed as a process of processing the input feature map. By applying a weighted average set of spatial filters, local features in each direction are effectively captured, thus alleviating the limitations of single-directional convolutional kernels in feature representation. The features after the fusion of convolutional kernels can be represented as: (2.9) The fusion module not only improves the spatial resolution and texture details of features, but also enhances the model's expressive power by introducing non-linearity through the activation function. To further improve the continuous capture of detailed information, two stacked detail-enhancing convolutional modules are connected in parallel to form a deep detail-enhancing channel. This allows for repeated integration of local multi-directional features, capturing richer edge information and texture changes, and improving the detection head's adaptability to subtle targets and complex backgrounds.
[0026] In the regression branch, the detector head output is designed to be a joint form including class prediction and bounding box regression. The four coordinate regressions of the bounding boxes are processed using a Discrete Focal Loss (DFL) framework, predicting each bounding box boundary as a discrete distribution vector of length reg_max, specifically with 4 × reg_max prediction channels. The joint class prediction channels are... n c The output tensor dimension can be represented as: (2.10) This allows each prediction unit to simultaneously carry fine-grained boundary regression information and class probability distribution.
[0027] Finally, to ensure effective fusion and scale adaptation of multi-scale features, the module introduces a learnable scaling factor. α i (Scale module) dynamically adjusts the regression output for each scale, enabling the model to adaptively adjust the contribution weights of features at different scales in the final prediction. Specifically: (2.11) in, Corresponding to the regression branch, For each category branch, the Concat operation combines the two results to form a complete prediction output. This design not only improves training stability but also ensures computational efficiency during inference.
[0028] Furthermore, the detection method also includes performing lightweight optimization on the initially trained YOLO-PDGS target detection model through a lightweight optimization unit to obtain the final lightweight crack detection model; The lightweight optimization includes: the lightweight optimization unit is equipped with a DepGraph pruning subunit and a BCKD knowledge distillation subunit. The DepGraph pruning subunit analyzes the inter-layer and intra-layer parameter dependencies of the P2SA-FPN module, C3K2_DFM module, GALA module and detection head in the model to generate a network dependency graph, and performs channel-level batch pruning along the dependency path. Then, the BCKD knowledge distillation subunit uses the unpruned YOLO-PDGS model as the teacher model and the pruned lightweight model as the student model. Through joint training with binary classification distillation loss and unstructured intersection-union distillation loss, the knowledge of the teacher model is transferred to the student model to recover the accuracy loss caused by pruning and obtain the final lightweight crack detection model. The DepGraph pruning subunit adopts a low-level pruning algorithm. It generates a network dependency graph by analyzing the inter-layer and intra-layer parameter dependencies of the P2SA-FPN module, C3K2_DFM module, GALA module and detection head in the model, and performs channel-level batch pruning along the dependency path. The BCKD knowledge distillation subunit employs a logical distillation method. Through joint training with binary classification distillation loss and unstructured intersection-union (IUU) distillation loss, the pruned lightweight model is set as the student model, while the unpruned YOLO-PDGS model is used as the teacher model. The knowledge from the teacher model is transferred to the lightweight student model to recover the model accuracy loss caused by pruning. Through this "prune first, then distill" optimization strategy, the final model retains the detection accuracy of the original model as much as possible while significantly reducing the number of parameters. It should be noted that the lightweight optimization unit, as a necessary component and final optimization step in the construction of the YOLO-PDGS target detection model, includes a DepGraph pruning subunit and a BCKD distillation subunit. This unit is used to achieve extreme lightweighting of the model while maintaining detection accuracy, thus meeting the deployment requirements of edge computing devices. As the core component for the engineering implementation of the YOLO-PDGS target detection model of this invention, the lightweight optimization unit aims to address the issue of increased parameter and computational loads after improvements to the model using P2SA-FPN, C3K2_DFM, GALA modules, and the SDCD detection head. By systematically integrating DepGraph structured pruning and BCKD knowledge distillation, extreme lightweighting and real-time optimization of the model can be achieved while ensuring the accuracy of concrete crack detection, ultimately resulting in a lightweight crack detection model adapted to the deployment needs of mobile devices, edge devices, and other engineering scenarios. The DepGraph pruning subunit employs a low-level pruning algorithm. It generates a network dependency graph by analyzing the inter-layer and intra-layer parameter dependencies of the P2SA-FPN, C3K2_DFM, GALA modules, and the detector head within the model, and performs channel-level batch pruning along the dependency paths. The low-level pruning algorithm models the parameter dependencies in the network, thereby achieving efficient model structure compression. It creates a network grouping matrix based on the local dependencies between adjacent layers, automatically resolving and managing the interdependencies between parameter groups, achieving batch and consistent pruning operations. This effectively reduces the difficulty of manual intervention and improves the safety and efficiency of pruning.
[0029] For the local dependencies between adjacent layers, the feature representation of each layer can be... f i Decompose into input f i - and output f i + To describe a simple stacked network: (2.12) Among them, symbols Representing network connections, Equation 2.12 shows that the dependencies within each layer can be categorized into two types: inter-layer dependencies and intra-layer dependencies. Inter-layer dependencies are formed by direct connections between adjacent layers, where the output of one layer corresponds to the same intermediate feature as the input of the next layer. When pruning the output of the previous layer, the input of the next layer must maintain the same pruning method to ensure consistent feature dimensions. Intra-layer dependencies can be further divided into two types: the first type involves independent inputs and outputs, which are pruned separately, exhibiting strong decoupling; the second type involves highly coupled inputs and outputs, requiring the same pruning layout, where the pruning operation simultaneously affects the dimensions of both inputs and outputs.
[0030] In deep networks, to effectively describe the aforementioned dependencies, the pruning layout of different layers needs to be predefined to clarify the dependency graph structure. For example, Figure 11 (a) illustrates the process of grouping adjacent layers using the DepGraph algorithm in CNNs networks. f Starting with 4+, recursively search for all other accessible nodes and group them into the same group for pruning. Figure 11 In (b), different pruning layouts are used for the input and output of the convolutional network. f 4- and f 4+ has no intra-layer dependencies. This indicates that there is an intra-level dependency, and a consistent pruning method should be used.
[0031] Based on the inter-layer and intra-layer dependencies in the model, the network can be modeled using DepGraph: (2.13) In the formula, ij represents two adjacent network layers, sch represents the network layout, ∧ and ∨ represent "OR" and "AND" in the logical relation, respectively, and T indicates that the dependency is true.
[0032] Based on the inter-layer and intra-layer dependencies in the model, the network can be modeled using DepGraph: (2.13) In the formula, ij ∧ represents two adjacent network layers, sch represents the network layout, ∧ and ∨ represent "OR" and "AND" in logical relations respectively, and T indicates that the dependency is true.
[0033] The binary classification distillation loss and the unstructured IoU distillation loss are combined as the total distillation loss, improving the integrity and performance of the distillation strategy. The specific process is as follows: Figure 12 As shown; The BCKD method proposes an unstructured localization distillation loss that utilizes the most basic positional relationship (IoU) between two bounding boxes as the distillation target. Localization maps are obtained from the teacher and student models, and for a given input sample... X , will come from the i The corresponding localization predictions for the teacher and student models at each location are expressed as follows: and Obtaining results through anchor location and positioning prediction. X The bounding boxes of the teacher and student models can be obtained by the decoder using the following formula: (2.23) (2.24) in, A i Indicates the first i Anchor, and For the bounding boxes obtained from the teacher and student models, Decoder represents the decoder operation. Meanwhile, and IoU between them is denoted as Furthermore, by incorporating the loss weighting strategy proposed in classification tasks to focus on extracting important samples, the localization distillation loss can be expressed as follows: (2.25) Therefore, the total loss of the BCKD method is obtained by adding the two parts from equations 2.22 and 2.25, as shown in equation 2.26, where and This is a hyperparameter.
[0034] (2.26) Example 2 To further verify the feasibility of this method, the method described in Example 1 (the complete method including lightweight optimization) was compared with several current mainstream detection methods. First, images of concrete surface cracks from different engineering scenarios (such as tunnel lining, building walls, bridge piers, etc.) were acquired. The professional annotation tool LabelImg was used to accurately annotate the cracks in the acquired images, classifying them into four categories based on their morphological characteristics: horizontal cracks, vertical cracks, diagonal cracks, and multi-branch cracks. Annotation information included the crack's bounding box location (top left corner coordinates, bottom right corner coordinates) and category label. A total of 12,568 valid crack images were annotated, containing 18,743 crack instances.
[0035] The labeled image dataset was randomly divided into a training set (8798 images), a validation set (2513 images), and a test set (1257 images) in a 7:2:1 ratio. The 1257 images in the test set were used solely for final model performance evaluation throughout the experiment and did not participate in any training or validation phases, ensuring the objectivity and fairness of the evaluation results. To improve the model's generalization ability and robustness, data augmentation was performed on the training set images. The image augmentation library (Albumentations) was used to perform augmentation operations including contrast adjustment, tone transformation, random rotation and flipping, random image cropping, adding Gaussian noise, and simulating different lighting conditions (e.g.,...). Figure 13 (As shown). This approach effectively expands the data scale and balances the number of samples in each category (e.g., Figure 14 (as shown), and adapt the model to more varied actual shooting environments.
[0036] like Figure 14 As shown in (a), the number of crack instances for each category differs significantly before and after enhancement. The number of diagonal crack samples is only one-third that of multi-branched cracks, indicating a highly imbalanced category distribution. To address this issue, images containing diagonal cracks were specifically augmented during enhancement to increase the number of samples in this category. Figure 14As can be seen from (b) to (d), the enhanced crack data are more evenly distributed, effectively mitigating the model bias caused by class imbalance. Furthermore, the enhanced images are more concentrated in the target area while retaining richer spatial distribution features, further improving the model's adaptability and robustness in complex scenarios. The preprocessed training set images were input into the lightweight optimized YOLO-PDGS model for training. The standard YOLO training process was used, with SGD as the optimizer, an initial learning rate of 0.01, momentum of 0.937, and weight decay of 0.0005. Loss functions included classification loss (BCE Loss) and regression loss (DFL and CIoU Loss). The number of training epochs was set to 300, and the batch size to 16. During training, a validation set was used to monitor model performance and prevent overfitting. After training, an independent test set was used for final evaluation of the model. Key evaluation metrics included precision, recall, F1 score, mean precision, and model inference speed. Ablation experiments (Table 2.2) validated the effectiveness of each improved module, and comparative experiments with mainstream models such as YOLOv7, YOLOv8, YOLOv9, YOLOv10, YOLOv11, and Faster R-CNN were conducted (Table 2.4). Figure 18 This fully demonstrates the comprehensive performance advantages of the model in this application. The effectiveness of each improved module was verified through ablation experiments. The results of the ablation experiments included performance indicators such as detection precision, recall, and mean precision (mAP). The specific results are shown in Table 2.2.
[0037] In Table 2.2, YOLOv11n represents the n-type structure of the original model, YOLO-PE represents the model after introducing the P2SA-FPN module into the original structure, and YOLO-PD, YOLO-PDG, and YOLO-PDGS are models that sequentially fuse the improved modules C3K2_DFM, GALA, and SDCD detection heads based on the aforementioned improved models. As can be seen from the table, the original model YOLOv11n has initially demonstrated certain detection performance, with an mAP of 77.9%. Although stacking multiple modules can cause some fluctuations in individual metrics, the final optimized model (YOLO-PDGS) achieved the highest scores on key metrics, with mAP50 and Precision improved by 5.4% and 5.5% respectively compared to YOLOv11, confirming the effectiveness of the proposed improvements.
[0038] Table 2.2 Ablation results of the YOLO-PDGS model
[0039] Model lightweight optimization experiment results: In order to obtain a lightweight model suitable for edge deployment while ensuring detection accuracy, this invention introduces a systematic lightweight optimization step in the model construction process. First, a uniform channel number compression method is adopted, that is, the number of feature channels in each stage is reduced to 1 / 4 of the original, so as to reduce the number of parameters of each layer feature map in convolution calculation. Figure 15 The comparison shows the changes in computational load of the model before and after compression at different stages. After channel compression, the overall floating-point operation volume of the improved model is significantly reduced from the original 19.1 GFlops (billion floating-point operations) to 10.6 GFlops, and the parameter size is reduced from 4.57 million parameters (M parameters) to 2.58M parameters.
[0040] Based on this, the DepGraph pruning method performs targeted pruning of the network structure, setting the pruning rate speed_up to 1.4 to maintain a balance between compression efficiency and performance, and to avoid excessive pruning that could cause a significant drop in accuracy. Figure 16 The comparison of model parameters before and after pruning shows that the computational cost and number of parameters have been further reduced, to 4.3 GFlops and 0.97 M parameters respectively, which is a significant improvement compared to before pruning. Although model pruning methods significantly reduce computation and storage requirements, the model accuracy will decrease to some extent because channel compression and weight pruning inevitably weaken the model's feature representation ability. Figure 17 By comparing the mAP results of the original model, the improved model, and the pruned model, it can be seen that the number of parameters of the pruned model is significantly reduced, but the mAP drops to 82.5%, indicating a significant performance loss. To mitigate the accuracy degradation caused by pruning and improve the model's generalization ability, the BCKD distillation method is used to enhance the accuracy of the pruned model. During distillation, the pruned lightweight model is used as the student model, while the unpruned YOLOv11s-PDGS model, trained with the same hyperparameters, is used as the teacher model. YOLOv11s-PDGS has a computational cost of 124 GFlops and achieves an mAP of 87%, representing a 3.7% improvement over the improved n-model. Table 2.3 compares the accuracy and parameter count of each model before and after distillation. The table shows that the YOLOv11n model has a significant advantage in terms of parameter count, but its detection accuracy is relatively insufficient. The improved model significantly improves detection accuracy, but the parameter count increases exponentially, affecting detection efficiency. Using the "pruning + distillation" method proposed in the previous section, the accuracy loss caused by pruning is effectively recovered without significantly increasing the number of parameters. The resulting lightweight model (YOLO-PDGS-distilled) maintains a computational cost of 4.3 GFlops and 0.97M parameters while increasing mAP to 84.0%, achieving a balance between detection accuracy and model lightweighting, and providing a feasible solution for the application of lightweight target detection models.
[0041] Table 2.3 Comparison of accuracy and parameter count before and after model lightweighting
[0042] As can be seen from the results in Table 2.3, after a complete model building and lightweight optimization process, the final YOLO-PDGS lightweight crack detection model achieved excellent results in three key indicators: parameter quantity (0.97M), computational cost (4.3GFlops), and detection accuracy (mAP 84.0%). This verifies the effectiveness of the overall technical solution proposed in this invention, which includes the lightweight optimization process of "pruning + distillation". The lightweight crack detection model of YOLO-PDGS obtained in this invention was compared and evaluated with current mainstream target detection models (including YOLOv7, YOLOv8, YOLOv9, YOLOv10, YOLOv11, Efficientdet, Faster R-CNN, Retinanet, and SSD) on the same test set (1,257 images). The results are shown in Table 2.4 and... Figure 18 As shown; As shown in Table 2.4, YOLOv11n performs best in both Precision and F1 Score, indicating a strong advantage in balancing the accuracy of positive sample identification with overall prediction, making it particularly suitable for scenarios with high detection accuracy requirements but relatively relaxed speed requirements. In contrast, Faster R-CNN performs best in Recall and mAP, demonstrating its superior ability to capture the integrity of cracked targets and its overall detection accuracy. However, due to its complex two-stage structure, its inference speed is significantly lower than that of the YOLO series models, making it unsuitable for tasks with high real-time requirements. YOLOv7 and YOLOv8 achieve speeds of 128.6 FPS and 135.9 FPS respectively, ranking among the top models and demonstrating strong real-time detection capabilities. However, their accuracy performance is relatively limited, exhibiting an imbalance between speed and accuracy.
[0043] Compared to the models mentioned above, the YOLO-PDGS lightweight crack detection model obtained in this invention achieves the highest values in all four accuracy metrics: Precision (84.0%), Recall (77.9%), F1 Score (80.8%), and mAP (84.0%), fully demonstrating its comprehensive advantages in crack detection tasks. Meanwhile, this model achieves an inference speed of 112.8 FPS, slightly lower than the lightweight YOLO model, but significantly better than classic detection models such as Faster R-CNN, balancing the dual requirements of detection accuracy and computational efficiency.
[0044] Table 2.4 Comparison of Evaluation Indicators for Each Model
[0045] To more intuitively compare the differences between different models in terms of parameter size and computational efficiency, Figure 18 The results show a comparison of the number of parameters, computational cost, and inference speed of each model. The results demonstrate that the YOLO series models generally outperform two-stage models such as the EfficientDet and Faster R-CNN in terms of computational speed, highlighting the real-time advantage of YOLO models. Meanwhile, their parameter size and computational cost are similar to RetinaNet and EfficientDet, indicating that the YOLO series models maintain high computational efficiency while also achieving good model compactness.
[0046] To systematically evaluate and intuitively demonstrate the performance of different models in object detection tasks, such as Figure 19As shown, this paper qualitatively demonstrates the detection performance of each model in complex backgrounds, scenarios with interference, and diverse cracks, thereby comprehensively verifying the effectiveness and robustness of the improved model. By comparing the application of different models in various crack recognition scenarios, it can be found that the two-stage model is relatively superior in detection accuracy, but when dealing with complex backgrounds and multi-crack scenarios, the detected bounding boxes deviate significantly from the ground truth boxes, and the computational efficiency is relatively low; the single-stage model (YOLO series models) has a significant advantage in speed, but it is prone to false detections or missed detections under complex backgrounds or interference conditions, showing insufficient robustness; the improved model can maintain high detection accuracy and stability in complex backgrounds, scenarios with occlusion, or diverse cracks, not only significantly reducing false detections and missed detections, but also accurately distinguishing different crack types, showing stronger generalization ability and robustness.
[0047] The above description is merely a few embodiments of this application and is not intended to limit this application in any way. Although this application discloses preferred embodiments as described above, it is not intended to limit this application. Any changes or modifications made by those skilled in the art without departing from the scope of the technical solution of this application using the disclosed technical content are equivalent to equivalent implementation cases and fall within the scope of the technical solution.
Claims
1. A method for detecting concrete cracks based on image recognition, characterized in that, include: Acquire images of cracks to be detected in concrete structures; A YOLO-PDGS target detection model is constructed, and the crack image to be detected is input into the YOLO-PDGS target detection model to detect the number, size, location and category information of cracks; The YOLO-PDGS target detection model is based on the YOLOv11 model and includes an input layer, a backbone network, a feature fusion layer, and a detection head. The backbone network includes a C3K2_DFM module, whose input is connected to the input layer and whose output is connected to the feature fusion layer. The C3K2_DFM module is used to extract multi-scale features of crack images and suppress background redundancy information through parallel processing of multi-shape convolution kernels and dynamic gating mechanism. The feature fusion layer includes a P2SA-FPN module and a GALA module connected in sequence. The P2SA-FPN module is used to introduce the shallow feature map of the P2 layer of the YOLOv11 basic framework and supplement and fuse it with the deep feature maps of the P3-P5 layers output by the C3K2_DFM module. The GALA module is used to achieve the collaborative fusion of shallow and deep features and output multi-scale fused features that have both edge details and semantic information. The detection head is used to perform fine-grained perception, localization, and classification of the multi-scale fused features, and to reduce the number of model parameters through channel compression.
2. The concrete crack detection method based on image recognition according to claim 1, characterized in that, The C3K2_DFM module includes the MD-IncepConv submodule, the AMFA submodule, and the AMDM submodule; The MD-IncepConv submodule employs parallel square convolution kernels, horizontal stripe convolution kernels, and vertical stripe convolution kernels. It performs independent channel convolution processing on the input features through depth-separable convolution to simultaneously capture the planar texture features and multi-directional elongated features of the crack. The AMFA submodule divides the input features into two groups of sub-features along the channel dimension, and feeds them into the MD-IncepConv submodule with different receptive fields. The output features are concatenated by channels and then unified by 1×1 convolution to achieve the aggregation of multi-scale features. The AMDM submodule fuses the output features of the AMFA submodule with gated linear units through convolution operations, generates activation features and gated features through double convolution, and uses the Sigmoid gating mechanism to weight and modulate the feature stream, dynamically filtering effective crack features and suppressing background redundancy information.
3. The concrete crack detection method based on image recognition according to claim 1, characterized in that, The P2SA-FPN module includes a shallow feature introduction unit, a semantic enhancement module, and a RAU unit; The shallow feature introduction unit connects the shallow feature map of layer P2 and the deep feature maps of layers P3-P5 of the C3K2_DFM module; The RAU unit unifies the feature channel dimensions of P2 layer and P3-P5 layer through 1×1 convolution, and generates an attention weight map through the Sigmoid function. It then achieves dynamic weighted fusion of deep and shallow layer features through element-wise multiplication. The semantic enhancement module enhances the weighted and fused features through 3×3 convolution, outputting deep semantic features and spatial detail features.
4. The concrete crack detection method based on image recognition according to claim 1, characterized in that, The GALA module includes a feature compression unit, two pairs of local-global attention sub-modules, and a feature fusion unit. The feature compression unit unifies the deep semantic features of the deep feature map with the spatial detail features of the shallow feature map through 1×1 convolution, and adds the two features to generate a preliminary fusion feature. The local-global attention submodule is divided into two groups. One group uses 2×2 patch partitioning to extract local detail features of the crack, and the other group uses 4×4 patch partitioning to extract global context features. Each submodule completes feature modeling through expansion, averaging, FFN calculation, feature selection and reshaping. The feature fusion unit concatenates local detail features and global context features by channel, and then reconstructs features sequentially through reparameterized convolution and 1×1 convolution.
5. The concrete crack detection method based on image recognition according to claim 1, characterized in that, The detection head includes a channel compression module, a shared detail enhancement convolution module, a regression branch, and a classification branch; The channel compression module performs channel unification and normalization on the multi-scale features of layers P2-P5 through 1×1 convolution and group normalization, thereby reducing statistical bias and the number of model parameters. The shared detail enhancement convolutional module includes five directional convolutional branches: central difference convolution, angular difference convolution, horizontal difference convolution, vertical difference convolution, and ordinary convolution. Each branch uses a 3×3 convolutional kernel, and its weights are fused into a combined filter after training to capture multi-directional fine-grained features of cracks. The regression branch uses a discrete focus loss framework to accurately locate crack bounding boxes; the classification branch is used for the identification of four types of cracks. The regression branch and the classification branch share a channel compression module and a detail enhancement convolution module.
6. The concrete crack detection method based on image recognition according to claim 5, characterized in that, The detection head dynamically adjusts the feature contribution weights at each scale using a learnable scaling factor.
7. The concrete crack detection method based on image recognition according to claim 1, characterized in that, The detection method also includes performing lightweight optimization on the pre-trained YOLO-PDGS target detection model using a lightweight optimization unit to obtain the final lightweight crack detection model; The lightweight optimization includes: the lightweight optimization unit is equipped with a DepGraph pruning subunit and a BCKD knowledge distillation subunit. The DepGraph pruning subunit analyzes the inter-layer and intra-layer parameter dependencies of the P2SA-FPN module, C3K2_DFM module, GALA module and detection head in the model, generates a network dependency graph, and performs channel-level batch pruning along the dependency path. Then, the BCKD knowledge distillation subunit uses the unpruned YOLO-PDGS model as the teacher model and the pruned lightweight model as the student model. Through joint training with binary classification distillation loss and unstructured intersection-union distillation loss, the knowledge of the teacher model is transferred to the student model to recover the accuracy loss caused by pruning and obtain the final lightweight crack detection model.
8. The concrete crack detection method based on image recognition according to claim 1, characterized in that, The DepGraph pruning subunit adopts a low-level pruning algorithm. It generates a network dependency graph by analyzing the inter-layer and intra-layer parameter dependencies of the P2SA-FPN module, C3K2_DFM module, GALA module and detection head in the model, and performs channel-level batch pruning along the dependency path. The BCKD knowledge distillation subunit adopts the logic distillation method. Through joint training with binary classification distillation loss and unstructured intersection-union ratio distillation loss, during the distillation process, the pruned lightweight model is set as the student model and the unpruned YOLO-PDGS model is set as the teacher model. The knowledge of the teacher model is transferred to the lightweight student model to recover the model accuracy loss caused by pruning.