A prefabricated part surface defect lightweight detection method and system based on a structure guided network
By adopting a lightweight detection method based on structure-guided networks, the problem of insufficient detection accuracy of surface defects in precast components under complex backgrounds is solved, and efficient and accurate crack identification is achieved, which is suitable for UAV mobile platforms with limited computing resources.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUNAN UNIV OF SCI & TECH
- Filing Date
- 2026-02-13
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies lack the accuracy for detecting surface defects in precast components under complex backgrounds, especially for detecting minute cracks, which is difficult to identify with high precision on UAV mobile platforms with limited computing resources.
A lightweight detection method based on structure-guided networks is adopted, which generates high-precision crack segmentation results through dynamic nonlinear activation units, directional feature extraction, feature reconstruction and upsampling, and sparse fusion detection head.
It significantly improves the accuracy of surface defect detection in precast components, reduces computational complexity, and enables efficient and accurate crack identification in environments with limited computing resources.
Smart Images

Figure CN121746384B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of visual nondestructive testing, and more specifically, to a method and system for lightweight detection of surface defects in prefabricated components based on a structure-guided network. Background Technology
[0002] In the prefabricated building industry, the quality of precast components is fundamental to ensuring the safety and durability of the overall structure. Surface cracks, as the most common form of defect, accelerate steel corrosion and concrete carbonation, severely affecting the service performance of the components.
[0003] Traditional concrete crack detection relies heavily on human experience and conventional image processing methods. Common methods include algorithms based on grayscale thresholding, edge detection, morphological operations, and texture analysis. These methods are simple to implement and lightweight enough, but they are extremely sensitive to ambient lighting, noise interference, and surface contamination, and have poor robustness in complex scenarios. Convolutional neural networks can learn multi-level feature representations from data, and semantic segmentation networks, in particular, can achieve pixel-level recognition, significantly improving detection accuracy and generalization ability. However, their tens of millions of parameters and huge computational overhead make them difficult to run on UAV mobile platforms with limited computing resources. Summary of the Invention
[0004] This invention provides a lightweight detection method and system for surface defects in prefabricated components based on a structure-guided network, which at least solves the problem of insufficient detection accuracy in related technologies.
[0005] According to an embodiment of the present invention, a lightweight detection method for surface defects in prefabricated components based on a structure-guided network is provided, comprising:
[0006] Obtain surface images of the precast components to be inspected;
[0007] Layered feature extraction is performed on the surface image to generate a set of first feature maps, wherein the first feature maps contain crack structure directionality information;
[0008] The first feature map is reconstructed and upsampled to generate a second feature map, wherein the second feature map contains edge details;
[0009] The second feature map is input into the hierarchical sparse fusion detection head to perform pixel-level classification processing on the second feature map to obtain a segmentation result map characterizing the location of surface defects of the prefabricated component.
[0010] Furthermore, the layered feature extraction of the surface image includes:
[0011] The input features are adjusted without statistical parameters by using a dynamic nonlinear activation unit.
[0012] The adjusted features are input into the horizontal feature extraction branch and the vertical feature extraction branch, respectively. The two branches use a set of one-dimensional convolution kernels to extract features along different spatial dimensions to obtain directional feature sequences.
[0013] An adaptive fusion weight is generated based on the directional feature sequence, and the features output by the two branches are weighted and fused to obtain directional enhancement features.
[0014] A channel attention operation is performed on the directional enhancement features to recalibrate different feature channels, thereby outputting the first feature map.
[0015] Furthermore, the feature reconstruction and upsampling of the first feature map includes:
[0016] The first feature map is processed by a coordinate attention mechanism to inject prior spatial location information;
[0017] The first feature map is decomposed into high-frequency feature components and low-frequency feature components;
[0018] The low-frequency feature component is modulated based on the high-frequency feature component;
[0019] Upsampling is performed on the gated fused features by pixel rearrangement to restore the spatial resolution of the feature map and generate the second feature map.
[0020] Furthermore, the pixel-level classification processing of the second feature map includes:
[0021] Perform channel shuffling on the input second feature map to facilitate information exchange across channel groups;
[0022] The features after channel shuffling are input into the sparse bottleneck mapping layer. The sparse bottleneck mapping layer compresses the feature dimension to a preset sparse dimension through a first linear layer and restores the feature dimension to the target output dimension through a second linear layer, so as to extract key discriminative features while compressing redundant information.
[0023] Furthermore, the dynamic nonlinear activation unit employs a dynamic modulation function based on the hyperbolic tangent function, the form of which is: ,in For input features, For output features, and These are channel-level learnable scalar parameters.
[0024] Furthermore, the modulation of the low-frequency feature component based on the high-frequency feature component includes:
[0025]
[0026] in, The characteristics after fusion The low-frequency feature component, For the high-frequency feature components, It is the Sigmoid activation function. This is an element-wise multiplication operation.
[0027] According to another embodiment of the present invention, a lightweight detection system for surface defects in prefabricated components based on a structure-guided network is provided, comprising:
[0028] The image acquisition module is used to acquire surface images of the prefabricated components to be inspected.
[0029] A dynamic encoding module, connected to the image acquisition module, is used to perform layered feature extraction on the surface image to generate a set of first feature maps, wherein the first feature maps contain crack structure directionality information;
[0030] A spatial-frequency co-decoding module, connected to the dynamic coding module, is used to perform feature reconstruction and upsampling on the first feature map to generate a second feature map, wherein the second feature map contains edge details;
[0031] A layered sparse fusion detection head, connected to the spatial-frequency collaborative decoding module, is used to perform pixel-level classification processing on the second feature map to generate a segmentation result map characterizing the location of surface defects of the prefabricated component.
[0032] Furthermore, the dynamic encoding module includes:
[0033] Dynamic nonlinear activation units are used to adjust the amplitude of input features without statistical parameters.
[0034] The horizontal and vertical feature extraction branches are used to receive the features after amplitude adjustment and extract directional feature sequences along different spatial dimensions using a set of one-dimensional convolutional kernels, respectively.
[0035] A directional gating fusion mechanism is used to generate adaptive fusion weights based on the directional feature sequence and to perform weighted fusion of the features output from the two branches to obtain directional enhancement features;
[0036] A channel attention mechanism is used to perform channel attention operations on the directional enhancement features to recalibrate different feature channels, thereby outputting the first feature map.
[0037] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0038] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0039] This invention, by constructing multiple processing components, not only enhances the distinction between cracks and complex backgrounds and reduces interference from shadows, textures, and crack-like objects, but also significantly reduces the number of parameters and computational complexity, and improves detection accuracy. It solves the problem of insufficient detection accuracy of fine cracks in complex backgrounds in the prior art, and realizes lightweight and high-precision detection of surface defects of precast components. Attached Figure Description
[0040] Figure 1 This is a structural block diagram of a lightweight detection system for surface defects in prefabricated components based on a structural guidance network, according to an embodiment of the present invention.
[0041] Figure 2 This is a network architecture diagram according to a specific embodiment of the present invention;
[0042] Figure 3 This is a schematic diagram of a dynamic coding network structure according to a specific embodiment of the present invention;
[0043] Figure 4 This is a schematic diagram of the LMES module structure according to a specific embodiment of the present invention;
[0044] Figure 5 This is a schematic diagram of the CEJ unit structure according to a specific embodiment of the present invention;
[0045] Figure 6 This is a schematic diagram of the FCE unit structure according to a specific embodiment of the present invention;
[0046] Figure 7 This is a schematic diagram of the detection head structure according to a specific embodiment of the present invention;
[0047] Figure 8 This is a model loss variation curve according to a specific embodiment of the present invention;
[0048] Figure 9 This is the second model loss variation curve according to a specific embodiment of the present invention;
[0049] Figure 10 These are comparison diagrams of actual effects according to specific embodiments of the present invention. Detailed Implementation
[0050] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0051] In the following description, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0052] Furthermore, in this application, directional terms such as "upper," "lower," "left," and "right" may be defined relative to the orientation of the components shown in the accompanying drawings. It should be understood that these directional terms can be relative concepts, used for relative description and clarification, and may change accordingly depending on the orientation of the components in the accompanying drawings.
[0053] In this application, unless otherwise expressly specified and limited, the term "connection" should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral part; it can be a direct connection or an indirect connection through an intermediate medium. Furthermore, the term "coupled" can refer to an electrical connection that enables signal transmission.
[0054] As used herein, “about,” “approximately,” or “approximately” includes the stated value and the average value within an acceptable range of deviation from the given value, wherein the acceptable range of deviation is determined by a person skilled in the art taking into account the measurement under discussion and the error associated with the measurement of the given quantity (i.e., the limitations of the measurement system).
[0055] Example 1
[0056] This embodiment provides a physical implementation architecture for a lightweight detection system for surface defects in precast components based on a structure-guided network. This system can run in an industrial edge computing environment and achieves high-precision real-time segmentation of microcracks on the surface of concrete components through tight coupling of specific hardware interfaces and software modules.
[0057] Reference Figure 1The system is equipped with an image acquisition module, specifically a vision acquisition subsystem coupled to an industrial fieldbus. This subsystem includes a CMOS imaging sensor suitable for high-frequency triggering (e.g., Basler a2A1920-160ucPRO) and a matching FPGA preprocessing unit. The imaging sensor is configured to capture the surface photometric data stream of the prefabricated component to be inspected in response to a trigger signal from an external PLC controller, and transmit the raw image frames to the system memory buffer via a GigE Vision or USB 3.0 interface. The image acquisition module can also be configured with illumination compensation logic to drive an external shadowless light source or a multi-angle LED array to provide a uniform illumination field at the moment of image acquisition, thereby minimizing shadow noise caused by the unevenness of the component surface.
[0058] The system also includes a dynamic encoding module, which is specifically a set of convolutional neural network encoding layers running on a computing unit (such as an NVIDIA Jetson AGX Xavier or an embedded GPU). This encoding module performs hierarchical feature extraction logic and integrates multiple Dynamic Anisotropic Aware Units (IATs). Each IAT unit is configured with orthogonally arranged and parallel one-dimensional convolutional kernels, suitable for independently performing convolution operations on the input tensor in the horizontal and vertical dimensions to generate a first set of feature maps that are directionally sensitive to the elongated crack structure. In addition, the encoding module is configured with dynamic nonlinear activation logic, which is suitable for dynamically adjusting the activation threshold based on the local amplitude of the input features, thereby adapting to inputs with different illumination intensities without batch statistical dependence.
[0059] The spatial-frequency co-decoding module is logically connected to the data output of the encoding module. This module performs feature reconstruction and upsampling operations to map low-resolution abstract features back to the spatial resolution of the original image. Embedded within this module are coordinate attention logic and frequency domain gating logic. The coordinate attention logic aggregates features along both the height and width directions to generate spatial location codes. The frequency domain gating logic separates the low-frequency components of the features using a low-pass filter and modulates the low-frequency components using high-frequency edge components as a gating signal. Thus, this module can generate a second feature map containing high-fidelity edge details and location information.
[0060] The system's output stage is a hierarchical sparse fusion detection head, which is connected to the decoding module. This detection head is configured as a lightweight classification network, containing a channel shuffling unit and a sparse bottleneck mapping unit. The channel shuffling unit is used to group and rearrange the channel dimensions of the input tensor to achieve cross-channel information flow interaction. The sparse bottleneck mapping unit is used to compress the features into a sparse space through a dimension reduction projection matrix, filter out redundant background information, and then map it back to the classification probability space, finally outputting a binary segmentation mask representing the defect location.
[0061] Example 2
[0062] This embodiment provides a lightweight detection method for surface defects in prefabricated components based on a structure-guided network, executed by the aforementioned system. This method is encapsulated as a series of sequentially executed instructions, scheduled and executed by the processor's arithmetic logic unit (ALU) or tensor processing core. Specifically, it includes the following steps:
[0063] S100: Acquire a surface image of the prefabricated component to be inspected.
[0064] In response to an interrupt signal triggered by a photoelectric sensor on the production line, the image acquisition card locks the data address of the current frame buffer and reads the data at a resolution of [resolution value missing]. The 24-bit RGB raw image stream of the pixels is then transferred to the preprocessing unit via a direct memory access (DMA) channel; the preprocessing unit performs a bilinear interpolation algorithm to resample the image matrix to... The fixed input dimension of the pixels. Then, normalization logic performs a linear mapping on the resampled pixel matrix and uses the following formula to convert the integer pixel values... Convert to floating-point tensor :
[0065]
[0066] The resulting normalized tensor is loaded into GPU memory as the input payload for subsequent deep neural networks. This represents the original pixel value of the input (range 0-255), and 127.5 is the normalization constant. This is the standardized floating-point value for the output.
[0067] For example, for an RGB value The pixels are normalized using normalization logic to convert them into approximately A floating-point vector.
[0068] S200: The surface image is subjected to hierarchical feature extraction through a dynamic anisotropic coding network to generate a set of first feature maps containing crack structure directionality information at different scales.
[0069] This step initiates the encoding path of the deep neural network, which consists of four cascaded downsampling stages. In each stage, the input tensor undergoes a convolution operation to increase channel depth and reduce spatial dimensionality. Specifically, it includes the following sub-step logic:
[0070] S210: The amplitude of the input features is adjusted without statistical parameters through a dynamic nonlinear activation unit.
[0071] Input feature tensor The signal is fed into a Dynamic Nonlinear Activation Unit (DyT), which is configured with a set of learnable channel-level parameter vectors. and And perform modulation operations based on hyperbolic tangent:
[0072]
[0073] in, For input features, For the output features, tanh is the hyperbolic tangent function; α and β are channel-level learnable scalar parameters, where α controls the slope (scaling) of the activation function and β controls the intercept (offset). It should be noted that, unlike batch normalization which relies on the batch mean, this logic performs nonlinear compression and offset only based on the feature magnitude of the current sample.
[0074] For example, if the input feature value of a certain channel is And the parameters obtained through training Then the core output value This allows the network to adaptively amplify the response gain for high-frequency signals in the crack region while suppressing low-frequency noise in the background region. It should be noted that the parameter α mentioned above... c and β c These are not preset fixed constants. During the model initialization phase, α is typically initialized to 1 and β to 0. In the subsequent S600 model training phase, these two parameters serve as learnable parameters in the network and participate in the backpropagation process. At this time, the optimizer calculates the gradients of α and β based on the loss function and iteratively updates the values of these two parameters until the model converges and obtains the optimal parameter values (such as 1.5 and -0.1) for a specific channel, thereby achieving adaptive dynamic adjustment of the feature magnitude. This will not be elaborated further here.
[0075] S220: The amplitude-adjusted features are input into the horizontal feature extraction branch and the vertical feature extraction branch respectively. The two branches use a set of one-dimensional convolution kernels to extract directional feature sequences along different spatial dimensions.
[0076] The activated tensor is copied and split into two parallel convolution engines, where the horizontal branches have a set of one-dimensional convolution kernels (e.g., ...). It is constrained to slide only in the width dimension, thereby extracting the horizontal structural feature sequence. Vertical branches have orthogonal one-dimensional convolution kernels (such as...) It is constrained to slide only in the height dimension, thereby extracting the vertical structural feature sequence. .
[0077] For example, for Feature map, in horizontal branches The convolution kernel performs a row-by-row one-dimensional convolution operation, outputting a feature response map that represents the horizontal continuity of the texture, and so on.
[0078] S230: Through a directional gating fusion mechanism, adaptive fusion weights are generated based on the directional feature sequence, and the features output from the two branches are weighted and fused to obtain directional enhancement features.
[0079] Global average pooling logic respectively for and Aggregate along spatial dimensions to generate direction descriptor vectors. and These two vectors are concatenated and input into a fully connected layer, where they are mapped to normalized weight scalars via the Softmax function. and (satisfy The weighted fusion logic then performs the operation. .
[0080] For example, if the Softmax input is The calculation unit outputs weights. This leads to the characteristics after fusion. It is mainly dominated by the characteristics of horizontal branches, thus explicitly enhancing the ability to characterize horizontally oriented cracks.
[0081] S240: Perform channel attention operation on the orientation enhancement features to recalibrate different feature channels, thereby outputting the first feature map.
[0082] Fusion features The channel descriptors are compressed through parallel average pooling and max pooling layers, and then channel weight vectors are generated using a multilayer perceptron (MLP) and a sigmoid activation function. The multiplier array performs a channel-by-channel weighted operation. It outputs the first feature map after recalibration, completing the processing of the current encoding stage.
[0083] S300: Input the first feature map into the spatial-frequency co-decoding module to perform feature reconstruction and upsampling on the first feature map, thereby generating a second feature map containing high-fidelity edge details.
[0084] This step performs upsampling logic to restore spatial resolution, addressing the issue of existing technologies easily losing fine crack textures during upsampling; such as Figures 4-6As shown, the Spatial-Frequency Co-decoding Module (LMES) integrates a Joint Context Enhancement Unit (CEJ) and a Frequency Context Enhancement Unit (FCE). These two units work together to recover the spatial resolution and details of the features. Specifically, they process the feature tensors from skip connections and the output of the previous decoding stage through the following logic. :
[0085] S310: The first feature map is processed through a coordinate attention mechanism to inject prior information about spatial location, thereby enhancing the ability to model the geometry of the crack.
[0086] like Figures 4-5 As shown, the coordinate attention logic first performs one-dimensional global pooling (AvgPool h and AvgPool w) along the height and width directions respectively to generate feature aggregation vectors. Next, these two aggregation vectors are concatenated spatially, and the concatenated result is fed into a shared 1×1 convolutional layer for transformation, compressing the number of channels to 1 / r (where r is the reduction rate), followed by processing with a non-linear activation function. Subsequently, the features are re-segmented along the spatial dimension into two independent tensors, and each is passed through two 1×1 convolutional layers to restore the number of channels to match the input features. Finally, a spatial attention mask is generated using the Sigmoid function. and Simultaneously, to enhance the response to cracks at different scales, a context extraction connectivity module (CEJ) is introduced. This module processes the input features in parallel using multiple convolutional kernels of different sizes (e.g., K=3, 5, 7) and averages their outputs to capture multi-scale contextual information. The multiplication logic broadcasts the aforementioned two masks and uses them together with the scale attention weights output by the CEJ module as input features. This allows the absolute location coordinates of the cracks to be explicitly encoded in the feature map.
[0087] Among them, such as Figure 5 As shown, the CEJ unit is configured as a parallel processing architecture, with input feature tensors (size: ...) The stream is split into three parallel branches, each configured with a kernel size for a different receptive field. Specifically, it includes:
[0088] Small-scale branches Used to capture local texture details of fine cracks;
[0089] Mesoscale branch Used to capture the extension trend and neighborhood information of cracks;
[0090] Large-scale branching Used to capture global contextual semantics and long-distance dependencies.
[0091] The output features of the three branches maintain spatial consistency and are aggregated using element-wise summation to gather multi-scale information. The aggregated features are then compressed into channel descriptors using global average pooling (Avg) and mapped to normalized channel weight vectors via a sigmoid activation function. This vector is the channel weight vector. Figure 5 The rightmost output result is then used to perform channel-by-channel multiplication on the weight vector with the original input features to recalibrate the features, thereby enhancing the model's adaptability to cracks of different scales.
[0092] S320: Decompose the first feature map after coordinate attention processing into high-frequency feature components and low-frequency feature components.
[0093] This process is performed in the Frequency-Channel Enhancement Unit (FCE), as shown in the attached document. Figure 4 and Figure 6 As shown, the low-pass filter logic (e.g., configured as) The average pooling kernel acts on the feature map. Extracting low-frequency components that characterize the main structure The subtractor logic then calculates... High-frequency components containing edge and texture details are separated. .
[0094] The FCE unit feeds the input features into a low-pass filter, which is also an average pooling layer. It then outputs smooth, low-frequency feature components representing the concrete surface background. Simultaneously, by subtracting these low-frequency feature components from the original input features, high-frequency feature components representing crack edges and texture details are extracted. Figure 6 EdgeExtraction in [the context of the text].
[0095] S330: Through a gated fusion unit, high-frequency feature components are used as gate signals to modulate low-frequency feature components, thereby enhancing the feature response of the crack edge region and suppressing background noise texture.
[0096] like Figure 6 As shown, the high-frequency feature components extracted by the gated fusion unit in the enhancement module FCE are fed into the Sigmoid activation function to generate a value range of... An edge attention map is generated between the high-frequency and low-frequency feature components; subsequently, this edge attention map is multiplied element-wise with the low-frequency feature components to utilize high-frequency edge information as a gating signal, selectively enhancing crack-related regions in the low-frequency background. Figure 6 "in The enhanced features are then element-wise added to the original low-frequency features or the input features (i.e., ...). Figure 6 "in The algorithm outputs an enhanced feature that integrates high-fidelity edge details and background semantics; this enhanced feature is... Figure 6 The rightmost output.
[0097] Therefore, the formula for the gated logic to perform nonlinear modulation operations is:
[0098]
[0099] in The Sigmoid function maps high-frequency components to... The gating factor for the interval; this logic ensures that only the interval is used for gating. Strongly responsive edge regions, low-frequency characteristics The signal-to-noise ratio is significantly enhanced in the background region, while the characteristic response is suppressed in the flat background region, thereby improving the signal-to-noise ratio and ensuring that the crack boundary is sharpened to the maximum extent while suppressing background noise.
[0100] For example, at the edge of the crack, Gating coefficient This results in a 95% gain being added to the eigenvalues at that location; while in the background, Gating coefficient The gain is weak.
[0101] S340: Upsample the gated fused features by performing a pixel rearrangement operation to restore the spatial resolution of the feature map and generate a second feature map.
[0102] The convolutional layer first expands the number of feature channels to times (of which) For the upsampling factor, e.g., 2); subsequently, the pixel rearrangement logic performs periodic memory address remapping, transferring the data blocks along the channel dimension. Reorganized into spatial dimension data blocks It achieves improved spatial resolution in a parameter-free manner, avoiding the checkerboard artifacts introduced by transposed convolution; specifically, such as... Figure 4 As shown, the features processed by the FCE unit are further refined by the Channel Attention module and finally fed into the PixelShuffle module. This module improves the spatial resolution of the feature map to the target size through periodic channel-spatial rearrangement operations, generating a second feature map.
[0103] S400: Input the second feature map into the hierarchical sparse fusion detection head to perform pixel-level classification processing on the second feature map, and finally generate a segmentation result map that characterizes the location of surface defects of the precast component.
[0104] S410: Perform channel shuffling on the input second feature map to facilitate information exchange across channel groups.
[0105] The memory controller performs group-based transpose and reshaping operations on the input feature map; it divides the channels into... Group, reshaped into transpose Then flatten it; this operation forces the feature channels of different groups to be interleaved in memory, breaking the information isolation brought about by grouped convolution.
[0106] S420: The features after channel shuffling are input into the sparse bottleneck mapping layer. The sparse bottleneck mapping layer compresses the feature dimension to a preset sparse dimension through the first linear layer and restores the feature dimension to the target output dimension through the second linear layer, so as to extract key discriminative features while compressing redundant information.
[0107] The feature tensor is fed into the sparse bottleneck layer, where the first linear projection matrix ( Convolution) reduces the channel dimension Compressed to sparse dimensions (For example This forces the network to retain only the discriminative features with the highest entropy; after GELU activation, the second linear projection matrix restores the dimension to 2 (classification Logits of cracks / background); finally, Argmax logic compares the values of the two channels to generate a binarized defect segmentation map.
[0108] For example, if the Logits output of a certain pixel is Argmax logic determines that the point is a "crack" and sets it in the result mask, and so on.
[0109] Example 3
[0110] This embodiment provides an engineering process for constructing and optimizing the above detection model, specifically including the following steps:
[0111] S500: Building High-Fidelity Datasets and Enhancement Pipelines
[0112] The data acquisition interface gathers images of the precast component surface from multiple sources (production line scan camera, handheld SLR camera, and drone payload). Each image is annotated with a corresponding pixel-level binary mask using a professional annotation tool. To improve the model's generalization boundary, the training pipeline integrates an online data augmentation module. Furthermore, this module randomly injects geometric and photometric perturbations into the batches of images read during each training iteration.
[0113] Geometric perturbation: Rotational logic in Affine transformation is performed on the image and mask by randomly sampling angles within the range; the flip logic performs horizontal or vertical mirroring with a probability of 0.5.
[0114] Luminosity perturbation: Color jitter logic in Brightness and contrast are randomly adjusted within a factor range, and Gaussian noise with a mean of 0 and a variance of 0.05 is superimposed to simulate sensor thermal noise.
[0115] S600: The parameter optimization training process guided by the composite loss function is driven by the composite loss function. The driver, this function is the cross-entropy loss ( ) and Dice loss ( The weighted sum of )
[0116]
[0117] in:
[0118] Logic: Calculate for each pixel This forces the model to optimize its pixel-by-pixel classification accuracy.
[0119] Logic: Calculation This forces the model to optimize the overall overlap between the predicted region and the real region, effectively combating class imbalance.
[0120] The optimizer logic uses the AdamW algorithm, with an initial learning rate of [missing information]. The weight decay factor is 0.05. The learning rate scheduler is configured with a cosine annealing strategy, smoothly decaying the learning rate to 0.05 over 100 epochs. The backpropagation engine updates the weight matrices of all convolutional kernels and fully connected layers in the network based on the calculated gradients.
[0121] S700: Model Quantization and Inference Engine Deployment
[0122] After training convergence, the model is first exported as an ONNX intermediate representation format; then, a deployment toolchain (such as TensorRT) is used to perform layer fusion and accuracy calibration on the model graph; the quantization logic maps the weights and activation values of FP32 accuracy to INT8 integer format based on the dynamic range statistics of the calibration dataset.
[0123] Mapping formula:
[0124]
[0125] in, Scaling factor The zero offset is F, the floating-point input value is F, round indicates rounding to the nearest integer, and Q is the quantized integer value.
[0126] The quantized model is loaded into the inference engine of an edge computing device (such as NVIDIA Jetson). At runtime, the inference engine directly calls the hardware's INT8 tensor cores to perform convolution operations, thereby reducing inference latency to the millisecond level while keeping the mIoU metric decrease by less than 1%, meeting the timing requirements of real-time detection on the production line.
[0127] Example 4
[0128] This embodiment provides the calculation logic for quantitative evaluation indicators used to verify the effectiveness of the model. The evaluation script is based on confusion matrix logic and performs statistical analysis on the prediction results on the test set, specifically including the following steps:
[0129] S800: Segmentation accuracy index calculation
[0130] For binary classification segmentation tasks, the evaluation logic first counts the number of true positive (TP), false positive (FP), and false negative (FN) pixels.
[0131] mIoU calculation logic: Calculate the intersection-union ratio (IU) separately for the "crack" and "background" categories:
[0132]
[0133] The arithmetic mean is then calculated, which quantifies the geometric overlap between the predicted and actual regions.
[0134] Recall calculation logic: Perform division operation This metric quantifies the model's ability to detect all real crack pixels, which is crucial for preventing missed detections.
[0135] F1 score calculation logic: Perform harmonic average operation This metric comprehensively balances precision and recall.
[0136] For example, if TP=5000, FP=800, FN=1200, then Recall F1 .
[0137] S900: Calculation of Lightweight and Complexity Metrics
[0138] Parameter count: Traverse all convolutional and linear layers in the network and sum the total number of elements in their weight tensors; the calculation formula is as follows. The total number of parameters in the ILS-Net model of this system is constrained to approximately 2.97M.
[0139] Computational complexity statistics: based on input resolution ( The computational complexity is approximately 10^6 floating-point operations required for forward inference. For convolutional layers, the computational complexity is approximately 10^6 floating-point operations. .
[0140] The total computational complexity of this system was optimized to approximately 2.16 GFLOPs, validating its efficient operation on edge devices.
[0141] The following examples illustrate this point.
[0142] I. Network Architecture
[0143] Concrete cracks are characterized by their small size, sparseness, and strong directionality, posing unique challenges to the feature representation and upsampling capabilities of networks. To achieve lightweight, efficient, and high-precision semantic segmentation of cracks, we designed a lightweight hierarchical segmentation network, ILS-Net, aiming to achieve high-precision crack recognition across scales and complex backgrounds with lower computational cost. The four-level encoding layers are responsible for capturing local texture, region structure, crack extension, and global semantics, respectively. Through hierarchical encoding and structure-aware enhancement, starting from the structural features of crack images, and combining the advantages of lightweight Transformer and convolution, efficient and accurate crack segmentation is achieved.
[0144] In order to model with lower complexity, such as Figure 2 As shown, the long-range direction-dependent encoder introduces IAD in each feature extraction unit. Through dynamic normalization and bidirectional multi-scale strip attention, each coding layer can not only maintain the perception of fine cracks at the local texture level, but also accurately model the extension direction of cracks at the global structure level. Addressing the decoding challenge of preserving crack details and location information during multi-scale fusion, the LMES design enhances spatial coordinate perception and employs a frequency domain channel enhancement strategy for upsampling. This effectively restores the continuous morphology of cracks and suppresses noise interference in complex backgrounds. The final stage SSF detection head aims for efficient fusion, breaking down feature isolation between scales through channel shuffling and sparse fusion layers. This extracts the most discriminative crack response features, significantly reducing the number of parameters and computational cost, and improving overall segmentation accuracy while preserving edge details.
[0145] Specifically, it includes:
[0146] 1.1 Dynamic Encoding Network (IAD)
[0147] Surface cracks in prefabricated components exhibit significant anisotropy and weak characteristics, but standard Transformer modules often fail to capture these orientation-sensitive features with limited computational resources. To simultaneously reduce normalization computation costs and enhance orientation-aware feature modeling, a lightweight dynamic coding backbone IAD can be designed. This IAD perceives multi-scale dependencies of structural features from both horizontal and vertical directions, and achieves global-local joint enhancement through cross-directional adaptive gating and channel recalibration. The IAD consists of IAT, DtT, FFN layers, and residual connections.
[0148] To maintain the network's sensitivity to low-contrast cracks, a dynamic, non-linear activation function, DyT, is applied. This function adaptively controls the feature distribution range, eliminating the need for mean and variance statistics, significantly reducing computational cost while preserving the original dynamic range of the features. It automatically adjusts feature amplitudes under different background conditions, amplifying high-frequency crack regions and suppressing low-frequency background. Here, IAT abandons the 2D square kernel and instead uses two independent multi-scale dilated 1D convolutional branches to process the height and width directions respectively, obtaining directional responses. This design closely matches the "strip-like" geometric characteristics of cracks. Furthermore, it utilizes a directional mixing mechanism to achieve "cross-directional gating," allowing the model to adaptively learn whether the cracks in the current region are more horizontal or vertical, capturing directional dependencies in a low-complexity manner. Figure 3 As shown, the proposed anisotropic sensing module IAT first extracts structural sequence representations along both the height and width directions. Then, it fuses the information from the two directions through a cross-directional adaptive weight allocation model and further introduces a channel recalibration mechanism. Finally, it integrates the directional enhancement features with the original features in a residual manner.
[0149] Specifically, DyT achieves nonlinear self-calibration without statistics through a dynamic modulation function:
[0150]
[0151] in γ is a learnable scalar parameter, and β are channel-level learnable weights. Unlike standard normalization, DyT does not rely on batch statistical features, but instead dynamically suppresses and amplifies the input amplitude through adaptive tanh activation. This makes the encoded features more discriminative, thereby guiding the subsequent attention stage to more accurately model key information.
[0152] Furthermore, the features processed by DyT are recombined along the height and width directions and then input into the multi-scale strip convolution branches respectively:
[0153]
[0154] Where ƒ H , ƒW This is a multi-scale, depth-separable convolutional group that captures the extension features of cracks in two orthogonal directions; F is the input feature, f H and f W W represents the convolution operations in the height and width directions, respectively. H and W W These represent the feature maps extracted in the corresponding directions.
[0155] To achieve adaptive weighting of features in different directions, we define a set of cross-vector mixing weights:
[0156]
[0157] Where, δ H δ W W is a global description of the directional features in the height and width directions after global aggregation. m For linear mapping matrices (or fully connected layer weights), [ ] represents the concatenation operation, Softmax is the normalized exponential function, and λ H and λ W These are the adaptive fusion weights for the generated vertical and horizontal directions, respectively, so that the network can automatically adjust the attention distribution according to the main direction of the crack.
[0158] Channel attention (CA) aggregates global spatial information through average pooling and max pooling, generates channel weights through a shared MLP, and applies them to the input features for recalibrating the channel features.
[0159]
[0160] Where F represents the input feature, AvgPool and MaxPool represent average pooling and max pooling operations respectively, MLP represents a multilayer perceptron (a fully connected layer containing shared weights), σ is the sigmoid activation function, and A ca Here are the generated channel attention weights; α and β are learnable scaling coefficients used to adjust the fusion strength of different branch features. The input features are directly retained as the basis, and the learning scaling coefficients are used to control the fusion strength of different attention branches.
[0161]
[0162] Where F represents the original input features and Y represents the final output features; F W and F H These are the feature maps output by the horizontal and vertical branches, respectively; λ H F H +λ W FW A represents the direction enhancement term. ca This represents the channel attention term.
[0163] Finally, the captured information from each layer is obtained through the DyT nonlinear function and the FFN residual. The crack signal is efficiently aggregated through the nonnormalization of DyT and the anisotropic strip attention design of IAT. This collaborative design enables the backbone network to model the directionality and long-distance dependence of cracks with extremely low complexity in the encoding stage, while preserving subtle grayscale information.
[0164] 1.2 Feature Attention Upsampling LMES Module
[0165] The key to the decoding stage lies in how to effectively reconstruct fine-grained spatial boundary information. For "high-frequency" signals such as complex background cracks that are rich in fine edges and sparse textures, upsampling inevitably leads to edge blurring and detail loss. To address this, this paper introduces LMES as a feature reconstruction pipeline with "space-frequency" dual optimization for the decoder.
[0166] like Figures 4-6 As shown, the LMES module first performs spatial domain prior injection, that is, it uses a lightweight coordinate attention mechanism to model the directionality and positional information of features. It further adopts a zero-parameter multi-scale pooling strategy to aggregate contextual information in different receptive fields in a non-convolutional manner to adapt to crack scale changes, thereby enhancing the ability to model the geometric structure of cracks and express their positional saliency.
[0167] Subsequently, high-fidelity reconstruction in the frequency domain is performed. This involves fusing edge texture information extracted from the high-frequency branch and main contour information preserved by the low-frequency branch through a nonlinear gating mechanism. Combined with channel recalibration, spatial features are selectively amplified in the frequency domain, ensuring the continuity and clarity of the crack edges during the reconstruction process.
[0168] Finally, pixel rearrangement and upsampling are used for high-fidelity cross-scale feature restoration. The former generates directional and positional signals in the spatial domain, while the latter compensates for the loss of detail in the former in the frequency domain. The synergistic effect of the two demonstrates stronger robustness in reconstructing the spatial information of fine crack boundaries. This can be expressed mathematically as follows:
[0169]
[0170] First, the input single-scale feature F is processed by orientation-aware coordinate pooling to obtain a global description of the horizontal and vertical directions. Then, orientation fusion is performed through grouped 1×1 convolutions to generate bidirectional attention weights.
[0171]
[0172] Where σ is the Sigmoid function and G represents the group convolution mapping; the orientation weights adaptively adjust the feature strength in the height and width dimensions to achieve structural alignment.
[0173] To further improve scale robustness, we introduce multi-scale average pooling instead of convolution operations, and enhance the response to cracks of different widths through multi-scale feature aggregation:
[0174]
[0175] Where X1 is the input feature, K is the number of scales (3 here), {3,5,7} represents the pooling kernel size of different sizes, and AvgPool k This represents an average pooling operation with a kernel size of k, where β is the generated multi-scale weight.
[0176] The original features, location-enhanced features, and multi-scale weights are multiplied and then residuals are fused.
[0177]
[0178] in This design achieves multi-directional and multi-scale significant enhancement of the crack region without introducing additional convolution parameters.
[0179] The features are then decomposed into high-frequency components H. f With low-frequency component L f And reconstruct the details through gating fusion:
[0180]
[0181] Wherein, σ(H f The high-frequency response is used as a gating signal to guide the network to enhance the feature response in the crack edge region, thereby effectively distinguishing the real crack edge from surface noise texture. Based on this, channel attention further recalibrates the global semantic features:
[0182]
[0183] Finally, artifact-free and efficient upsampling is achieved through PixelShuffle:
[0184]
[0185] Where r is the upsampling factor, F a For the input features, Conv1D represents a one-dimensional convolution operation (used here for channel expansion), PS rU(F) represents a pixel rearrangement operation with an upsampling factor of r, and U(F) is the output feature after upsampling. All operations in this structure are based on lightweight operators, which can recover high-frequency crack boundary details while significantly reducing the amount of computation. Virtual pixels in the channel dimension are rearranged to the spatial dimension to achieve efficient upsampling and avoid the checkerboard effect of deconvolution.
[0186] 1.3 Detection Head
[0187] Redundant model architectures are prone to learning incorrect associations, causing these features to be incorporated into deep semantics and ultimately affecting accuracy. For crack segmentation, an overly bloated header design lacks in-depth extraction of fused features. To address these issues, this paper designs a Random Sparse Fusion Segmentation Head (SSF) as the segmentation head in the decoder architecture.
[0188] like Figure 7 As shown, by using a channel shuffling strategy, the mixing of features at different scales is enhanced to improve information interaction capabilities and break the isolation of channel grouping. Subsequently, feature recalibration is performed to adaptively reweight channel responses. Finally, low-redundancy cross-scale fusion is achieved through sparse multilayer perceptual feature screening. This enables a lightweight design that promotes deep interaction of cross-scale features in complex contexts, suppresses invalid channel responses, and preserves fine crack boundaries.
[0189] Specifically: To break the local correlation between features at different scales, we first adopt a structured channel shuffling function:
[0190]
[0191] Where F is the input feature, B is the batch size, C is the total number of channels, and H and W are the feature map height and width. Here are the shuffled features; G is the number of channel groups, and π represents the channel dimension permutation operation; even after shuffling, the features inevitably contain a lot of noise, so these shuffled channels must be screened; the channel importance of the shuffled features is then recalibrated:
[0192]
[0193] To further compress features and enhance discriminative power, we flatten the features and input them into a sparse bottleneck mapping layer:
[0194]
[0195] Where W is a linear mapping W1∈R C×sC W2∈R sC×CoutW1 is the weight matrix of the first linear layer (compressing features to a sparse dimension), W2 is the weight matrix of the second linear layer (restoring to the target dimension), GELU is the Gaussian error linear unit activation function, and s is the sparsity rate; the model must learn to extract the most discriminative crack signals and actively discard redundant and confusing background noise features.
[0196] This random sparse fusion strategy can effectively fuse local edge information with global semantic context, achieving multi-scale feature fusion and pixel-level classification mapping of the final crack region with very low parameters and computational cost.
[0197] II. Experimental Results and Analysis
[0198] 2.1 Experimental Setup
[0199] The proposed method is deployed on a Windows 10 system using the PyTorch framework and trained on a single GPU (NVIDIA RTX4070) and in a Python 3.8 environment. During model training, we employ the Adaptive Moment Estimation (AdamW) optimizer to update the network weights and use the cross-entropy loss function as the training objective. The key hyperparameter of the optimizer is set to an initial learning rate of 8 × 10⁻⁶. -4 The weight decay coefficient is set to 0.05.
[0200] To further improve convergence speed and enhance training stability, we implemented a cosine annealing learning rate scheduling strategy, which uses a 1×10⁻⁶ learning rate. -6 The minimum learning rate is used to ensure stable convergence of the model.
[0201] To increase dataset diversity and enhance network generalization ability, online data augmentation was implemented, such as horizontal and vertical flipping, random 90° rotation, and shift-scale-rotation transformations. These rotational transformations altered the spatial properties of the images while preserving their structural integrity. Each model was trained for 100 epochs with a batch size of 2 and an input resolution of 512×512 to simulate real-world crack segmentation scenarios. The complete training configuration is summarized in Table 1.
[0202] Table 1
[0203]
[0204] 2.2 Evaluation Indicators
[0205] To comprehensively evaluate the performance of the proposed lightweight and efficient segmentation method ILS-Net on concrete crack segmentation, the most commonly used evaluation metrics for semantic segmentation are adopted here, namely mean intersection, precision, recall, F1 score, number of parameters, and computational cost.
[0206] mIoU is another commonly used evaluation metric in semantic segmentation, used to measure the ratio of the intersection to the union of the predicted result and the actual label for each class. See the formula for the detailed calculation process:
[0207]
[0208] The overall performance of the model is evaluated using the mAP metric. The specific formula for calculating mAP is as follows:
[0209]
[0210] Recall rate represents the ratio of correctly predicted crack pixels to actual crack pixels, and its calculation formula is:
[0211]
[0212] The F1 score is a combination of precision and recall, and is a comprehensive evaluation metric indicating the overall performance of a network.
[0213]
[0214] Among the evaluation metrics used, true positives (TP) represent the number of pixels correctly identified as cracks by the model; false positives (FP) refer to pixels that actually belong to the background but are incorrectly predicted as cracks; true negatives (TN) represent pixels correctly identified as backgrounds; and false negatives (FN) represent pixels that actually belong to cracks but are incorrectly classified as backgrounds. In crack segmentation tasks, the F1 score and mIoU are key metrics for comprehensively evaluating the segmentation accuracy and stability of the model.
[0215] GFLOPs measure the computational complexity of a model and represent the number of floating-point operations required during model execution. See the formula for details of the calculation process:
[0216]
[0217] The parameter represents the total number of trainable parameters in the model, calculated by summing the parameters of each layer; for convolutional layers, the parameter count is calculated as follows:
[0218]
[0219] Among them, K h and K w These represent the height and width of the convolution kernel, C. in The input channel number is 1, where 1 represents the bias term, and C is the input channel number. out For the number of output channels, F represents the total number of floating-point operations (FLOPs) performed by the model, used to measure the computational cost required by the model in one forward propagation; O represents the number of computational operations; 10 9K is a standard conversion factor used to convert computational load into a unit of measurement at the level of billions of operations per second (GFLOPs). h and K w C represents the height and width of the convolution kernel, respectively. in and C out These represent the number of input and output channels, respectively, with "+1" indicating the contribution of the bias term in the calculation.
[0220] Generally speaking, a lower GFLOPs value indicates a more lightweight model structure, with a corresponding reduction in the number of parameters and computational complexity. This not only means higher running efficiency and lower memory usage, but also facilitates the efficient deployment of the model on edge devices or in real-time scenarios.
[0221] III. Comparison of LMES with other upsampling modules
[0222] To further demonstrate the high cross-scale feature recovery capability of the proposed LMES module under lightweight conditions, three typical and widely used upsampling modules were used to replace it for a more intuitive understanding of the effect. Ablation experiments were conducted against lightweight content-aware upsampling, lightweight dynamic upsampling, and efficient channel rearrangement upsampling. Their common goal is to improve upsampling quality and structural reconstruction capability while reducing computational cost, and they are all suitable for semantic segmentation.
[0223] Specifically, CARAFE predicts the kernel weights for each pixel location using lightweight convolutions, and then uses these weights to reweight neighboring features, achieving content-aware upsampling. DySample uses lightweight attention to predict sampling offsets and weights, allowing each output location to adaptively sample input features based on the content. EUCB combines depthwise separable convolutions with channel rearrangement to achieve efficient spatial feature reconstruction and lightweight feature fusion. All replacement attentions are integrated into the same baseline architecture for training to ensure fair comparison.
[0224] As shown in Table 2, LMES achieved the highest mIoU and accuracy, at 86.68% and 91.22% respectively, exceeding the other three modules by more than 0.5% and 1% respectively. It also surpassed the three alternatives in F1 score, reaching a maximum of 92.42%. This demonstrates LMES's extreme sensitivity to the quality of fine boundaries in crack segmentation, enabling high-resolution detail restoration and precise boundary refinement. Furthermore, with only 29,700 parameters, its computational load is reduced by more than 45% compared to the other three modules, amounting to only 2.16 GFLOPs, significantly reducing computational complexity and resulting in a highly lightweight structure.
[0225] Table 2
[0226]
[0227] like Figure 10 As shown, three representative scenes are selected here for visualization and comparison of the regions the model focuses on after upsampling. CARAFE upsampling completely ignores the crack texture during the upsampling process, being influenced by the background. DySample upsampling and EUCB upsampling still allow the model to focus on the crack region after upsampling, showing good performance, but unfortunately, the region of focus deviates from the actual crack location. In contrast, LMES upsampling enables high-fidelity feature reconstruction, accurately noting the crack contour information. During the reconstruction process, it restores the continuity and clarity of the crack edges, making the model more robust in spatial information.
[0228] IV. Comparison of IAT with other attention modules
[0229] To further evaluate the ability of the IAT attention module to extract anisotropic weak features, an ablation comparison was conducted by replacing it with three commonly used attention mechanisms on the same baseline: LSK dynamically adjusts the receptive field size to adaptively select context ranges at different scales; MLLA combines the Mamba model with complex linear global dependency modeling; and LSConv combines large kernel perception and small kernel aggregation convolutional operations to model both wide-area context and local details. These modules are widely used in semantic segmentation and object detection tasks, aiming to balance local feature modeling and global dependency learning with low computational cost. Therefore, they provide a strong benchmark for evaluating the feature representation capabilities of IAT modules in complex contexts.
[0230] The comparison results are shown in Table 3. Using IAT attention achieved the highest mIoU of 86.68% and accuracy of 91.22%, representing a 1.69% improvement in crack prediction compared to the lowest LSK attention, significantly enhancing accuracy. The number of parameters decreased by up to 25%, and GFLOPs decreased by up to 27%, demonstrating strong inference speed and maintaining a good balance between accuracy and efficiency, achieving a lightweight design.
[0231] Table 3
[0232]
[0233] V. Comparison with other methods
[0234] To evaluate the performance of the proposed model, several state-of-the-art (SOTA) semantic segmentation models were selected for comparison, including PSPNet, DeepLabv3+, GCNet, DecsNet, OCRNet, SegFormer, LRFormer, SCTNet, UCAN, and EfficientViM. All models were trained and evaluated on the CrackBD dataset under the same experimental conditions to ensure fairness. Experiments were also conducted using the DeepCrack dataset, a publicly available benchmark dataset specifically designed for structural surface crack detection. All images were pixel-level annotated by professional annotators to generate corresponding segmentation masks. Comparisons were also made with some SOTA semantic segmentation models, maintaining consistency in the training environment to ensure fairness. The results are shown in Table 4.
[0235] Table 4
[0236]
[0237] Table 4 shows the mIoU, average accuracy, F1 score, number of parameters, and computational complexity of each model over 100 epochs on the crackdeep dataset. Ocrnet stands out among the comparisons with the highest average segmentation accuracy of 94.83%, but this also brings significant computational complexity, requiring 46.07 GFLPs. GCNet has the smallest model with only 2.91 million parameters, but its segmentation accuracy is limited, with an mIoU of only 86.67%. The latest segmentation model this year, EfficientViM, performs very well with a computational complexity of only 2.38 GFLPs, but its segmentation accuracy is lower than DeepLabv3+ and PSPNet, and even lower than ILS-Net. Its average accuracy is also 3.84% lower than ILS-Net, and its model size is relatively large, requiring 9.65 million parameters.
[0238] Based on the results trained on publicly available datasets, ILS-Net achieves a good balance between segmentation performance and model efficiency, with an mIoU of 87.83 and an F1 score of 93.14. Simultaneously, it maintains a real-time processing capability of 2.16 GFLOPs, requires only 9.99% of the parameters of SCTNet, and has a computational complexity of only 1.9% of PSPNet. This further demonstrates that the proposed model possesses excellent segmentation performance and real-time processing capabilities.
[0239] Figure 8-9The graphs show the changes in the validation set F1 score and training set loss for all models over 100 training epochs. The F1 scores of all networks fluctuated significantly in the early stages, gradually stabilizing after 60 epochs. Compared to other models, the ILS-Net model achieved a larger area throughout training, indicating its ability to perform crack detection with high quality throughout the training phase. Its F1 score started high at approximately 0.84, steadily improving and eventually converging to approximately 93.14%, demonstrating excellent convergence stability and generalization ability, especially in the later stages. Other models lagged slightly behind the ILS-Net model for most of the training phase. Although DeepLabV3+ achieved a good F1 score, its training loss remained the highest among all models. Meanwhile, ILS-Net also showed a significant advantage in training loss. Throughout the training epochs, its loss curve remained at the bottom of all curves for the vast majority of the time, eventually converging to the minimum point. This indicates that the proposed model can more effectively fit the training data and capture the detailed features of cracks.
[0240] like Figure 10 As shown, the visualization results further validate the advantages of the proposed method.
[0241] While most baseline models can identify major crack regions, their predictions often suffer from issues such as minor crack breaks, missing low-contrast areas, or blurred boundaries, making it difficult to accurately depict the continuous morphology of cracks. In contrast, ILS-Net maintains clear and coherent crack structure segmentation even in complex backgrounds, effectively suppressing spurious responses caused by concrete textures and shadows, and presenting a more refined and complete crack profile. These results clearly demonstrate that the proposed network exhibits stronger robustness and structural preservation capabilities when dealing with challenges such as diverse crack morphologies, uneven contrast, and noise interference in real-world scenarios.
[0242] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0243] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0244] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0245] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0246] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0247] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0248] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0249] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0250] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0251] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0252] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0253] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A lightweight detection method for surface defects in precast components based on a structurally guided network, characterized in that, include: Obtain surface images of the precast components to be inspected; Layered feature extraction is performed on the surface image to generate a set of first feature maps, wherein the first feature maps contain crack structure directionality information; The first feature map is reconstructed and upsampled to generate a second feature map, wherein the second feature map contains edge details; The second feature map is input into the hierarchical sparse fusion detection head to perform pixel-level classification processing on the second feature map to obtain a segmentation result map characterizing the location of surface defects of the prefabricated component; The step of extracting layered features from the surface image includes: The input features are subjected to statistically insignificant amplitude adjustment via a dynamic nonlinear activation unit; wherein, the dynamic nonlinear activation unit employs a dynamic modulation function based on the hyperbolic tangent function, and the form of the dynamic modulation function is as follows: ,in For input features, For output features, and These are channel-level learnable scalar parameters; The adjusted features are input into the horizontal feature extraction branch and the vertical feature extraction branch, respectively. The two branches use a set of one-dimensional convolution kernels to extract features along different spatial dimensions to obtain directional feature sequences. An adaptive fusion weight is generated based on the directional feature sequence, and the features output by the two branches are weighted and fused to obtain directional enhancement features. A channel attention operation is performed on the directional enhancement features to recalibrate different feature channels, thereby outputting the first feature map; The step of performing feature reconstruction and upsampling on the first feature map includes: The first feature map is processed by a coordinate attention mechanism to inject prior spatial location information; The first feature map is decomposed into high-frequency feature components and low-frequency feature components; The low-frequency feature component is modulated based on the high-frequency feature component; Upsampling is performed on the gated fused features by pixel rearrangement to restore the spatial resolution of the feature map and generate the second feature map; The modulation of the low-frequency feature component based on the high-frequency feature component includes: in, The characteristics after fusion The low-frequency feature component, For the high-frequency feature components, It is the Sigmoid activation function. This is an element-wise multiplication operation.
2. The method according to claim 1, characterized in that, The pixel-level classification processing of the second feature map includes: Perform channel shuffling on the input second feature map to facilitate information exchange across channel groups; The features after channel shuffling are input into the sparse bottleneck mapping layer. The sparse bottleneck mapping layer compresses the feature dimension to a preset sparse dimension through a first linear layer and restores the feature dimension to the target output dimension through a second linear layer, so as to extract key discriminative features while compressing redundant information.
3. A lightweight detection system for surface defects in precast components based on a structurally guided network, characterized in that, include: The image acquisition module is used to acquire surface images of the prefabricated components to be inspected. A dynamic encoding module, connected to the image acquisition module, is used to perform layered feature extraction on the surface image to generate a set of first feature maps, wherein the first feature maps contain crack structure directionality information; A spatial-frequency co-decoding module, connected to the dynamic coding module, is used to perform feature reconstruction and upsampling on the first feature map to generate a second feature map, wherein the second feature map contains edge details; A layered sparse fusion detection head, connected to the spatial-frequency collaborative decoding module, is used to perform pixel-level classification processing on the second feature map to generate a segmentation result map characterizing the location of surface defects of the prefabricated component; The dynamic encoding module includes: A dynamic nonlinear activation unit is used to perform statistically inverse amplitude adjustment on the input features; wherein, the dynamic nonlinear activation unit employs a dynamic modulation function based on the hyperbolic tangent function, and the form of the dynamic modulation function is as follows: ,in For input features, For output features, and These are channel-level learnable scalar parameters; The horizontal and vertical feature extraction branches are used to receive the features after amplitude adjustment and extract directional feature sequences along different spatial dimensions using a set of one-dimensional convolutional kernels, respectively. A directional gating fusion mechanism is used to generate adaptive fusion weights based on the directional feature sequence and to perform weighted fusion of the features output from the two branches to obtain directional enhancement features; A channel attention mechanism is used to perform channel attention operations on the directional enhancement features to recalibrate different feature channels, thereby outputting the first feature map; The step of performing feature reconstruction and upsampling on the first feature map includes: The first feature map is processed by a coordinate attention mechanism to inject prior spatial location information; The first feature map is decomposed into high-frequency feature components and low-frequency feature components; The low-frequency feature component is modulated based on the high-frequency feature component; Upsampling is performed on the gated fused features by pixel rearrangement to restore the spatial resolution of the feature map and generate the second feature map; The modulation of the low-frequency feature component based on the high-frequency feature component includes: in, The characteristics after fusion The low-frequency feature component, For the high-frequency feature components, It is the Sigmoid activation function. This is an element-wise multiplication operation.
4. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to perform the method described in any one of claims 1 to 2 when executed.
5. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 2.
Citation Information
Patent Citations
Cloth flaw detection method and system based on MAC-YOLO
CN120976097A
Adaptive sensing-based lightweight monitoring method for fine crack in complex background region
WO2025161130A1
Cited By
A prefabricated component surface defect detection method based on machine vision
CN122368056A