A bilateral-pairing-gated crack enhancement method and system
Patent Information
- Application Number
- CN202611471070.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-21
- Publication Date
- 2026-10-27
AI Technical Summary
孤立纹理噪声可能产生与单侧裂缝边缘类似的高频响应,仅凭逐点判断无法将其与真正的裂缝边缘可靠区分
获取裂缝的中间特征图,通过二维离散哈尔小波变换分解得到LL子带、LH子带、HL子带及HH子带;根据LH子带、HL子带及HH子带得到高频子带特征,基于GELU激活函数对高频子带特征进行高频增强处理,得到高频增强特征;通过双边配对门控机制,对高频增强特征进行边缘配对检测得到最终配对得分,根据最终配对得分计算得到最终门控值;基于最终门控值,通过高频增强特征和高频子带特征的凸组合混合计算得到门控高频子带;将门控高频子带与LL子带通过IWT逆小波变换重构得到空间域特征图。
Smart Images

Figure CN122989467A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision and image feature enhancement technology, and particularly relates to a crack enhancement method and system based on bilateral pairing gating. Background Technology
[0002] In deep learning-based crack segmentation tasks, edge enhancement of the encoder's intermediate features (i.e., strengthening the response of crack edges and texture details while suppressing background noise) is a key technical aspect. Cracks appear as elongated linear structures in images, typically only a few pixels wide, with low contrast to the surrounding background, and background textures may produce visual patterns similar to cracks.
[0003] In existing crack segmentation methods, intermediate feature enhancement typically relies on hand-designed feature extraction operators. Hybrid architecture segmentation networks, such as the MixerCSeg scheme (Zhao Z, Ding Z, Niu P, et al. MixerCSeg: An Efficient MixerArchitecture for Crack Segmentation via Decoupled Mamba Attention. CVPR, 2026), employ an edge-gated convolutional module based on the Histogram of Oriented Gradients (HoG). However, the gradient orientation quantization strategy of this hand-designed operator has fixed parameter settings and lacks the ability to learn automatically from data.
[0004] In recent years, incorporating wavelet transform into deep learning feature processing has become an active research direction. The MFR-UNet scheme published in IET Systems Biology (Wang S, Shi G, Sun S, et al. MFR-UNet: A Medical Image Segmentation Network With Fused Multi-Scale Feature Refinement. IET Systems Biology, 2025, 20(1): e70049) proposes a wavelet transform convolution module, WtConv. After DWT decomposition, depthwise separable convolutions are applied independently to each sub-band, followed by IWT reconstruction. However, WtConv uses independent convolution parameters for each sub-band and lacks a gating mechanism. All components in high-frequency sub-bands are processed equally, lacking selectivity for different spatial locations and feature channels.
[0005] The WIAF scheme published in Brain Sciences (Zhong Y, Wang S, Miao Y, et al. Lightweight Brain Tumor Segmentation Through Wavelet-Guided Iterative AxialFactorization Attention. Brain Sciences, 2025, 15(6): 613) proposes an adaptive wavelet domain feature decoupling module AWD-FD, which applies learnable gating weights to the eight wavelet subbands generated by 3D DWT decomposition. However, the gating weights of AWD-FD are generated by first performing global average pooling on the subband features and then passing them through a multilayer perceptron. The spatial dimension has been flattened by pooling, and all spatial locations within the same channel of the same subband share the same gating value. Therefore, it lacks spatial granularity and cannot apply different enhancement strategies between the crack edge location and the background location. Furthermore, AWD-FD uses the ReLU activation function, which hard-truncates all negative values to zero, causing the edge information encoded by negative coefficients in the high-frequency subbands to be completely discarded.
[0006] The FD2-YOLO (C3K2-LWN) scheme published in Sensors (Zhu J, Sheng J, Cai Q. FD2-YOLO: A Frequency-Domain Dual-Stream Network Based on YOLO for CrackDetection. Sensors, 2025, 25(11): 3427) proposes a learnable wavelet node for cement crack detection. It uniformly feeds all sub-bands after DWT decomposition into 1×1 convolutions and 7×7 depth-separable convolutions for enhancement, using GELU activation. However, C3K2-LWN performs uniform enhancement on all sub-bands and all spatial locations without differentiation. Its modulation is applied to the channel dimension for cross-domain fusion, and it does not provide selective gating for spatial locations within sub-bands. Therefore, it cannot apply different enhancement strategies to crack edge locations and background locations within the same sub-band. More importantly, C3K2-LWN and all the aforementioned existing technologies adopt a point-by-point feature processing approach, that is, each spatial location is judged independently, without utilizing the spatial geometric features of the crack as a paired structure of two sides. Isolated texture noise may produce a high-frequency response similar to the edge of a one-sided crack, and it is impossible to reliably distinguish it from a real crack edge by point-by-point judgment alone.
[0007] In summary, the existing technologies have the following shortcomings: First, some existing technologies use ReLU activation, which leads to the loss of edge polarity information in the encoding of negative wavelet coefficients in high-frequency subbands; Second, the gating granularity of existing gating methods is too coarse or lacks gating; Third, existing methods all adopt a point-by-point independent judgment strategy and do not utilize the spatial pairing geometric constraints of the crack's two-sided edges to distinguish between cracks and texture noise. Summary of the Invention
[0008] To address the aforementioned technical problems, this invention provides a crack enhancement method and system based on bilateral pairing gating.
[0009] The technical solution adopted in this invention is:
[0010] Firstly, a crack enhancement method based on bilateral pairing gating is provided, including: S1, obtain the intermediate feature map of the crack, and obtain the LL subband, LH subband, HL subband and HH subband by two-dimensional discrete Haar wavelet transform decomposition; S2, high-frequency subband features are obtained based on LH subband, HL subband and HH subband, and high-frequency enhancement processing is performed on the high-frequency subband features based on GELU activation function to obtain high-frequency enhanced features; S3, through a bilateral pairing gating mechanism, performs edge pairing detection on high-frequency enhanced features to obtain the final pairing score, and calculates the final gating value based on the final pairing score, including: S3.1 For each candidate location in the LH, HL, and HH sub-bands, determine the search direction for that candidate location; wherein, the search direction for the LH sub-band is the vertical direction, the search direction for the HL sub-band is the horizontal direction, and the search direction for the HH sub-band includes both the vertical and horizontal directions; the search direction is uniquely determined by the mathematical definition of the sub-band type, without the need to pre-detect the crack location; S3.2, traverse multiple intervals within the preset search interval range along the search direction, and calculate the pairing response score for each candidate position at each interval; the pairing response score is obtained by multiplying the pairing sign term, the response intensity term, and the interval weight function. The pairing sign term takes a positive value when the eigenvalue at the candidate position has the opposite sign to the eigenvalue at the pairing position, and a negative value when the signs are the same. The response intensity term is the product of the eigenvalue amplitude at the candidate position and the eigenvalue amplitude at the pairing position. The interval weight function decreases monotonically as the interval deviates from the typical crack width. S3.3, take the maximum value of the pairing response score for each candidate position at each interval to obtain the final pairing score of the candidate position, and input the final pairing score into the preset transformation formula to obtain the final gating value of the candidate position; S4, based on the final gating value, the gated high-frequency subband is obtained by convex combination hybrid calculation of high-frequency enhancement features and high-frequency subband features; S5 reconstructs the spatial domain feature map by using the gated high-frequency subband and LL subband through IWT inverse wavelet transform.
[0011] Further, S1, the intermediate feature map of the crack is obtained, and the low-frequency approximate LL subband, the horizontal high-frequency LH subband, the vertical high-frequency HL subband, and the diagonal high-frequency HH subband are obtained through two-dimensional discrete Haar wavelet transform decomposition, including: Obtain the intermediate feature map of the crack; The intermediate feature map is segmented into non-overlapping 2×2 local blocks; By linearly combining the 2×2 local block with the transformation matrix of the two-dimensional discrete Haar wavelet transform, we obtain the LL subband, LH subband, HL subband and HH subband.
[0012] Furthermore, in S2, high-frequency subband features are obtained based on the LH, HL, and HH subbands. These features are then subjected to high-frequency enhancement processing using the GELU activation function to obtain high-frequency enhanced features, including: The LH subband, HL subband, and HH subband are spliced together to obtain the high-frequency subband characteristics. ; High-frequency subband features Substituting into the high-frequency enhancement formula based on the GELU activation function, we obtain the high-frequency enhanced features; the expression for the high-frequency enhancement formula based on the GELU activation function is: ; in, Indicates high-frequency enhancement features, express Depthwise convolution of convolution kernels, This indicates group normalization.
[0013] Further, in S3.2, multiple intervals are searched forward along the search direction corresponding to the candidate position, and the paired response score for each candidate position at each interval is calculated, including: Along candidate locations Corresponding search direction Search forward for multiple spacings , , and This indicates the preset minimum search interval and the preset maximum search interval; Each candidate position is calculated using the paired response calculation formula. At each spacing The paired response score The formula for calculating paired response is: ; in, Indicates high-frequency enhanced features at candidate positions The value at; Indicating high-frequency enhancement features in The value at; For paired symbol items, when and When the sign is opposite, the value is +1. and When the signs are the same, the value is -1; For the response intensity term; This is a preset spacing weight function.
[0014] Furthermore, a preset spacing weight function is used. For a Gaussian window, the expression is: ; in, and These are pre-set or learnable parameters; Alternatively, a preset spacing weight function can be used. Using the Cauchy / Lorentzian distribution, the expression is: ; in, For pre-set or learnable position parameters, For pre-defined or learnable scale parameters.
[0015] Furthermore, the expression for the preset transformation formula is: ; in, Indicates the final gate value, For scaling parameters, For bias parameters, scaling parameters and bias parameters For pre-set or learnable parameters, This represents the Sigmoid activation function; or, ; in, Indicates the final gate value, and For scaling parameters, scaling parameters and For pre-set or learnable parameters, For the final pairing score The output of a 1×1 convolution with dense gating.
[0016] Furthermore, S4, based on the final gating value, obtains the gated high-frequency subband through a convex combination of high-frequency enhancement features and high-frequency subband features, including: Final gate value High-frequency enhancement features and high-frequency subband characteristics Input the convex combination hybrid calculation formula to calculate the gated high-frequency subband. ; The expression for the formula of convex combination hybrid calculation is: .
[0017] Furthermore, the learnable parameters in the bilateral pairing gating mechanism, the learnable parameters in the high-frequency enhancement processing, and the learnable parameters in the fusion processing after convex combination mixing are initialized with the first initialization standard deviation, the second initialization standard deviation, and the third initialization standard deviation, respectively. The first initialization standard deviation is greater than the second initialization standard deviation and the third initialization standard deviation. During training, a base learning rate scaling factor higher than that of other learnable parameters is applied to the learnable parameters in the bilateral pairing gating mechanism.
[0018] Furthermore, for candidate positions located at the edge of the high-frequency sub-band and searched along the search direction beyond the sub-band boundary, a reflection filling strategy is adopted to reflect the pixel values outside the sub-band boundary with the boundary as a mirror image. For the HH sub-band, pairing detection is performed simultaneously in both the vertical and horizontal search directions, and the average pairing score of the two search directions is taken as the pairing response score of the candidate position. When the search interval is a non-integer pixel interval, bilinear interpolation is used to obtain the feature value at the pairing position.
[0019] Secondly, a crack enhancement system based on bilateral pairing gating is provided, comprising: The Haar wavelet transform module is used to obtain the intermediate feature map of the crack. It decomposes the crack into LL subband, LH subband, HL subband and HH subband through two-dimensional discrete Haar wavelet transform. The high-frequency enhancement processing module is used to obtain high-frequency subband features based on LH subband, HL subband and HH subband, and perform high-frequency enhancement processing on the high-frequency subband features based on the GELU activation function to obtain high-frequency enhanced features; The bilateral pairing gating module is used to determine the search direction for each candidate position in the LH, HL, and HH subbands. The search direction for the LH subband is vertical, for the HL subband it is horizontal, and for the HH subband it includes both vertical and horizontal directions. The search direction is uniquely determined by the mathematical definition of the subband type, eliminating the need for pre-detection of crack positions. Multiple intervals are traversed along the search direction within a preset search interval range, and the pairing response score for each candidate position at each interval is calculated. The pairing response score is obtained by multiplying the pairing sign term, the response intensity term, and the interval weight function. The pairing sign term is positive when the eigenvalue at the candidate position has the opposite sign to the eigenvalue at the pairing position, and negative when they have the same sign. The response intensity term is the product of the eigenvalue amplitude at the candidate position and the eigenvalue amplitude at the pairing position. The interval weight function monotonically decreases as the interval deviates from the typical crack width. The maximum pairing response score for each candidate position at each interval is taken to obtain the final pairing score for that candidate position. This final pairing score is then input into a preset transformation formula to obtain the final gating value for that candidate position. The convex combination hybrid calculation module is used to obtain the gated high-frequency subband based on the final gate value through convex combination hybrid calculation of high-frequency enhancement features and high-frequency subband features; The IWT inverse wavelet transform reconstruction module is used to reconstruct the spatial domain feature map by using the IWT inverse wavelet transform to reconstruct the gated high-frequency subband and LL subband.
[0020] The beneficial effects achieved by this invention are as follows: The intermediate feature map of the crack is obtained, and the LL subband, LH subband, HL subband, and HH subband are obtained by two-dimensional discrete Haar wavelet transform decomposition. High-frequency subband features are obtained from the LH subband, HL subband, and HH subband. High-frequency enhancement processing is performed on the high-frequency subband features based on the GELU activation function to obtain high-frequency enhanced features. Edge pairing detection is performed on the high-frequency enhanced features through a bilateral pairing gating mechanism to obtain the final pairing score. The final gating value is calculated based on the final pairing score. Based on the final gating value, the gated high-frequency subband is obtained by convex combination and hybrid calculation of the high-frequency enhanced features and high-frequency subband features. The gated high-frequency subband and the LL subband are reconstructed by IWT inverse wavelet transform to obtain the spatial domain feature map.
[0021] The GELU activation function is selected based on the physical meaning of wavelet coefficients. In the high-frequency subband, the positive and negative coefficients encode the edge transitions in opposite directions, preserving the edge polarity information encoded in the negative wavelet coefficients. For the double-sided edge structure of the crack, the adaptive non-zero response of the negative value range of GELU ensures the complete availability of the edges on both sides of the crack, providing a prerequisite for subsequent bilateral pairing detection. Compared to the existing technology that adopts a point-by-point independent judgment strategy, this technology introduces a bilateral pairing gating mechanism, which searches for paired responses with opposite signs and reasonable spacing along the high-frequency subband gradient direction. Only when the pairing conditions of both sides are met simultaneously is it determined to be a crack, which improves the accuracy and reliability of crack judgment. The dense adaptive gating is adopted on a channel-by-channel and spatial location-by-spatial-location basis. The switching value of the dense gating has the same spatial size and channel dimension as the high-frequency enhancement feature. This fine granularity allows for the application of distinct enhancement strategies at the crack edge location and the background location within the same sub-band, achieving selective enhancement of the crack and effective suppression of background noise. Attached Figure Description
[0022] Figure 1 This is a flowchart of the crack enhancement method based on bilateral pairing gating of the present invention; Figure 2 This is a schematic diagram of the bilateral pairing gating mechanism of the present invention; Figure 3 This is a structural diagram of the crack enhancement system based on bilateral pairing gating of the present invention. Detailed Implementation
[0023] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.
[0024] like Figure 1 As shown, this embodiment of the invention provides a crack enhancement method based on bilateral pairing gating, comprising: S1, obtain the intermediate feature map of the crack, and obtain the LL subband, LH subband, HL subband and HH subband by two-dimensional discrete Haar wavelet transform decomposition; In this embodiment, the intermediate feature map of the crack is obtained. ; Indicates the batch size (BatchSize). The number of feature map channels. The height of the feature map, Width; intermediate feature map Divide into non-overlapping 2×2 local blocks; The transformation matrix of the 2×2 local block and the two-dimensional discrete Haar wavelet transform (Haar DWT) Linear combination yields LL, LH, HL, and HH subbands. The low-frequency approximation (Low-Low, LL) subband primarily captures global structural information, the horizontal high-frequency (Low-High, LH) subband primarily captures horizontal edges, the vertical high-frequency (High-Low, HL) subband primarily captures vertical edges, and the diagonal high-frequency (High-High, HH) subband primarily captures diagonal textures.
[0025] The standard orthogonal transformation matrix of the Haar wavelet Defined as: ; The expressions for LL subband, LH subband, HL subband, and HH subband are: , , , .
[0026] , , and These are the four pixel values of a 2×2 local block.
[0027] For crack segmentation, the two edges of a crack are represented by a pair of coefficients with opposite signs in the wavelet domain: taking a horizontally oriented crack as an example, its upper edge (bright to dark) produces a negative coefficient in the LH subband, and its lower edge (dark to bright) produces a positive coefficient in the LH subband; similarly, the left and right edges of a vertically oriented crack produce a pair of coefficients with opposite signs in the HL subband, and the two edges of a diagonally oriented crack produce coefficients in the HH subband. It should be noted that the high-frequency enhancement and bilateral pairing gating of this invention are uniformly applied to the three high-frequency subbands of LH, HL, and HH. The above three orientations are simply the corresponding forms of the same pairing structure in different subbands (in... Figure 2 (a) and Figure 2 (b) uses the LH subband as an example. The spacing of the coefficient pairs corresponds to the crack width. In the subband gradient direction, the distance between the two edges of the crack is usually within a few pixels; while isolated texture noise, even if it produces a single strong response, cannot find a paired response with opposite signs in adjacent positions. This geometric constraint is the physical basis for the subsequent bilateral pairing gating to uniformly apply pairing detection to the three high-frequency subbands of LH, HL, and HH.
[0028] S2, high-frequency subband features are obtained based on LH subband, HL subband and HH subband, and high-frequency enhancement processing is performed on the high-frequency subband features based on GELU activation function to obtain high-frequency enhanced features; In this embodiment, the high-frequency correlated LH subband, HL subband, and HH subband are spliced together to obtain the high-frequency subband characteristics. ; High-frequency subband features Substituting into the high-frequency enhancement formula based on the GELU activation function, we obtain the high-frequency enhanced features; the expression for the high-frequency enhancement formula based on the GELU activation function is: ; in, Indicates high-frequency enhancement features, express Depthwise convolution of convolution kernels, This indicates group normalization.
[0029] This embodiment chooses GELU instead of ReLU as the activation function because: ReLU hard-truncates all negative values to zero. For crack segmentation tasks, the negative coefficients generated at the upper edge of the crack become zero after ReLU, and the information of one side edge is completely discarded. GELU exhibits an input-dependent adaptive non-zero response in the negative range. Moderately strong negative signals (e.g., normalized coefficients around -1.0) retain approximately 16% of their amplitude, while extremely weak negative signals (around -3.0) retain amplitudes close to zero. This characteristic effectively achieves a "soft thresholding" of the high-frequency response, preserving meaningful negative signals (moderate intensity) at crack edges and naturally suppressing weak negative noise from the background texture. Unlike LeakyReLU's fixed-slope linear scaling, GELU's non-linear Φ function allows the retention ratio to smoothly change with the input intensity, achieving intensity-adaptive information preservation. The low-frequency LL subband is not enhanced and is directly passed to the reconstruction stage in subsequent step S5, retaining its original values.
[0030] S3 uses a bilateral pairing gating mechanism to perform edge pairing detection on high-frequency enhanced features to obtain the final pairing score, and calculates the final gating value based on the final pairing score; In this embodiment, a bilateral pairing detection mechanism is introduced into the gating stage. This is a core innovation that distinguishes it from all existing technologies. Existing gating methods, whether point-by-point dense gating or sub-band scalar gating, all employ a point-by-point independent judgment strategy: determining whether a location is enhanced solely based on the high-frequency response intensity of a single spatial position. However, the essential characteristic that distinguishes cracks from texture noise lies not in the response intensity of a single point, but in the existence of a pair of cooperative responses with opposite signs and reasonable spacing along the crack search direction. Isolated texture noise may produce a high-frequency response similar in intensity to a single edge of a crack, but it cannot find its paired edge in adjacent locations.
[0031] The principle of the bilateral pairing gating mechanism is as follows: S3.1, Based on the bilateral pairing gating mechanism, determine the search direction for each candidate position in the LH subband, HL subband and HH subband; For each candidate position in the high-frequency LH subband, HL subband, and HH subband First, determine the candidate position. The search direction is uniquely determined by the mathematical definition of the sub-band type and does not need to be estimated from the crack detection results.
[0032] For example, the mathematical definition of an LH subband is to calculate the difference between the upper and lower rows of pixels within a 2×2 local block, naturally detecting brightness changes in the vertical direction. Therefore, the search direction of the LH subband is fixed to the vertical direction. The HL subband calculates the difference between the left and right columns of pixels, detects horizontal brightness changes, and the search direction is fixed to the horizontal direction. The HH subband searches simultaneously in both vertical and horizontal directions.
[0033] S3.2, Search forward along the search direction corresponding to the candidate position for multiple intervals, and calculate the pairing response score for each candidate position at each interval; The search direction of each sub-band is an inherent property defined by its mathematics. The search process itself is the crack identification process, and there is no need to know the crack location before determining the direction.
[0034] Along candidate locations Corresponding search direction Search forward for multiple spacings , , and This indicates the preset minimum search interval and the preset maximum search interval; Covering the possible range of crack widths, for example, Pixel to Pixels. It should be noted that in this invention, the search spacing and the parameters in the spacing weight function are defined in the wavelet sub-band coordinate system. The sub-band coordinate is equal to the original image pixel coordinate divided by 2. That is, the upper limit of the search spacing of 20 sub-band pixels is equivalent to 40 pixels in the original image.
[0035] Each candidate position is calculated using the paired response calculation formula. At each spacing The paired response score The formula for calculating paired response is: ; in, Indicates high-frequency enhanced features at candidate positions The value at; Indicating high-frequency enhancement features in The value at; For paired symbol items, when and When the signs are opposite, the value is +1, indicating that it may be a pair of crack edges; when... and When the signs are the same, the value is -1, indicating that it is a response of the same polarity, which does not conform to the antisymmetric characteristics of the two sides of the crack edge; For the response strength item, a high score is given when both sides of the response are strong, and a low score is given when either side is weak. Preset spacing weight function For a Gaussian window, the expression is: ; in, and Pre-set or learnable parameters (or empirically set to a typical crack width range); cause the spacing to be too close ( (Possibly noise) or too far away ( The paired response (far exceeding the possible width of the crack) is attenuated; The parameters in the spacing weighting function can be determined by statistically analyzing the crack widths of the crack dataset: the crack annotation mask is skeletonized, and the distance from each skeleton point to the crack boundary is calculated using a distance transform. Twice this distance is taken as the crack width at that point, thus obtaining the crack width distribution for the entire dataset. This distribution exhibits a significant right-skewed heavy-tail characteristic: the crack width spans two orders of magnitude, the mean is significantly greater than the median, indicating a rightward tail, the presence of a non-negligible long tail of wide cracks, and the absence of a single typical width scale. For this type of distribution, the exponential decay of the Gaussian window causes the pairing weights at larger spacings to rapidly approach zero, resulting in excessive penalty for edge pairings of wide cracks, essentially excluding their pairing responses. In contrast, the power-law decay of the Cauchy / Lorentzian distribution maintains usable pairing weights even in wide spacing intervals, avoiding excessive penalty for wide crack pairing responses, and is therefore more suitable as a robust form for wide spacing intervals.
[0036] Therefore, a preset spacing weight function is used. Alternatively, the Cauchy / Lorentzian distribution can be used, with the following expression: ; in, Pre-defined or learnable location parameters (corresponding to typical crack widths). For pre-defined or learnable scaling parameters (controlling the full width at half maximum of the distribution). Unlike the exponential decay of the Gaussian window, the power-law decay of the Cauchy window makes the spacing... For every doubling, the weight only decreases by about four times (compared to the decrease of approximately [missing information] for the Gaussian window). (times), thus in the wide crack range ( (Pixels) still maintain reasonable pairing weights. and Preset values based on crack dataset width statistics can be used (e.g., preset values can be used in the original image pixel coordinate system). and The values are chosen to match the median crack width and the full width at half maximum (and converted to sub-band values by dividing the original image pixel coordinates by 2). They can also be used as learnable parameters in end-to-end training, allowing the model to automatically adjust the weight function based on the statistical characteristics of crack width in different datasets.
[0037] S3.3, take the maximum value of the paired response score to obtain the final paired score of each candidate position, and input the final paired score into the preset transformation formula to obtain the final gating value of each candidate position.
[0038] The final pairing score for each candidate position is obtained by maximizing the paired response scores. ; Final pairing score Input the preset transformation formula to obtain the final gating value for each candidate position.
[0039] The expression for the preset transformation formula is: ; in, Indicates the final gate value, For scaling parameters, The scaling parameter and the bias parameter are preset or learnable parameters. This represents the Sigmoid activation function; Similarly, a conservative initialization strategy is adopted (initial value set to...). ), ensuring that the gating value is close to the threshold value in the early stages of training. It is close to an identity mapping.
[0040] The preset transformation formula can also fuse bilateral pairing scores with pointwise dense gating. Specifically, based on the basic 1×1 convolutional dense gating, it integrates bilateral pairing scores... Introducing a 1×1 convolutional layer into the gated network as an additional input channel allows the network to simultaneously consider pointwise response strength and spatial pairing relationships. Alternatively, the pairing score can be added as an additional weighted bias term to the output of the pointwise gated network. ; in, Indicates the final gate value, and The scaling parameter is a preset or learnable parameter. For the final pairing score The output is obtained after dense gating the input with a 1×1 convolution. This hierarchical gating structure combines the advantages of both "dense gating providing basic discrimination" and "pairing scores providing noise immunity enhancement." In a further alternative implementation, the Haar DWT can be replaced with the dual-tree complex wavelet transform DT-CWT, which utilizes the fine directional selectivity of its six directional subbands to more accurately estimate the subband gradient direction, thereby improving the performance of pairing detection on diagonal cracks (with non-horizontal / non-vertical orientation).
[0041] For boundary handling, for candidate positions located at the edge of the high-frequency sub-band and searched along the search direction beyond the sub-band boundary, a reflection padding strategy is adopted, reflecting the pixel values outside the sub-band boundary as a mirror image of the boundary. Reflection padding maintains the local continuity of the crack edge (the crack does not abruptly terminate at the image boundary), which is better than zero padding (which sets the response outside the boundary to zero, artificially weakening the pairing score near the boundary). For the HH sub-band, pairing detection is performed simultaneously in both the vertical and horizontal search directions, and the average pairing score of the two is taken as the comprehensive score. For discrete sampling along the search direction, when When the pixel spacing is non-integer (e.g., searching horizontally in an HL subband where the subband gradient direction may have a non-zero angle with the horizontal axis), bilinear interpolation is used to obtain the result. The eigenvalues at the given location ensure the continuity and differentiability of the pairing scores.
[0042] The bilateral pairing gating mechanism has the following three technical advantages: First, it is resistant to texture noise; isolated strong responses are suppressed due to the lack of paired responses with opposite signs. Second, adaptive crack width and spacing weight function. The Gaussian window automatically selects the optimal pairing spacing for different crack widths; Third, there is physical consistency; a crack is only identified when the antisymmetric conditions at both edges are simultaneously met. This is inherently consistent with the antisymmetric displacement field of Mode I cracks in fracture mechanics. According to the analytical solution of the displacement field at the tip of a Mode I crack given by Westergaard (1939), for a length of... A central penetrating crack, with uniform tensile stress at a distance. Under the action, the normal displacement component on the crack surface Satisfying the antisymmetric condition: ; in, For elastic modulus, Poisson's ratio, Coordinates along the crack surface ( The sign opposite of the displacement components on both sides of the crack is a first-order mechanical principle of Mode I cracks, not a mere visual coincidence, but an inevitable conclusion of boundary value problems in elasticity. In a two-dimensional image, the brightness transition direction of the crack surface depends on the displacement direction. The side (crack surface shifts upwards) corresponds to a transition from bright to dark (negative wavelet coefficient). One side (the crack surface shifts downwards) corresponds to a dark-to-bright transition (positive wavelet coefficients). Therefore, Mode I cracks will inevitably produce coefficient pairs with opposite signs in the high-frequency subband of the wavelet, and this physical inevitability is the mechanical theoretical basis for bilateral pairing gating.
[0043] S4, based on the final gating value, the gated high-frequency subband is obtained by convex combination hybrid calculation of high-frequency enhancement features and high-frequency subband features; In this embodiment, the final gate value High-frequency enhancement features and high-frequency subband characteristics Input the convex combination hybrid calculation formula to calculate the gated high-frequency subband. ; The expression for the formula of convex combination hybrid calculation is: .
[0044] S5 reconstructs the spatial domain feature map by using the gated high-frequency subband and LL subband through IWT inverse wavelet transform.
[0045] In this embodiment, the gated high-frequency subband and LL subband are reconstructed using IWT inverse wavelet transform to obtain the spatial domain feature map. Due to the orthogonality of the Haar matrix, IWT can accurately and losslessly reconstruct the feature map when none of the four subbands have been modified. The reconstructed features are output through residual connection and fusion modules, and the final output has the same shape as the input, ensuring plug-and-play versatility.
[0046] It should be noted that a three-level progressive initialization and training method is used for the three sets of learnable parameters: gating, enhancement, and fusion. The learnable parameters in the bilateral pairing gating mechanism are initialized with a first initialization standard deviation, the learnable parameters in the high-frequency enhancement processing are initialized with a second initialization standard deviation, and the learnable parameters of the fusion module after convex combination mixing are initialized with a third initialization standard deviation. The first initialization standard deviation is greater than the second and third initialization standard deviations, thus forming a coarse-to-fine learning sequence of control → content → post-processing. During training, a base learning rate scaling factor higher than that of other learnable parameters is applied to the learnable parameters in the bilateral pairing gating mechanism, and the difference in gating mean between the crack region and the background region is monitored as a training health indicator. Additional parameters of the bilateral pairing gating (search direction, search spacing range, and parameters of the spacing weight function) can be set empirically or used as learnable parameters in end-to-end training.
[0047] The beneficial effects achieved by the embodiments of the present invention are as follows: First, the GELU activation function is selected based on the physical meaning of the wavelet coefficients. In the high-frequency subband, the positive and negative coefficients encode the edge transitions in opposite directions, preserving the edge polarity information encoded in the negative wavelet coefficients. For the double-sided edge structure of the crack, the adaptive non-zero response of the negative value range of GELU ensures the complete availability of the edges on both sides of the crack, providing a prerequisite for subsequent bilateral pairing detection.
[0048] Second, compared with the existing technology that adopts a point-by-point independent judgment strategy, a bilateral pairing gating mechanism is introduced to search for paired responses with opposite signs and reasonable spacing along the high-frequency sub-band gradient direction. Only when the pairing conditions of both sides are met at the same time is it judged as a crack, which improves the accuracy and reliability of crack judgment. The bilateral pairing gating of this invention can intercept four common texture interference patterns. The first type is isolated strong responses: texture noise (such as cement particle boundaries) may generate strong high-frequency responses at a single spatial location, but is blocked by the "intensity asymmetry" condition due to the lack of paired responses with opposite signs. The second type is repetitive textures with the same sign: regular surface textures may generate multiple adjacent strong responses, but are rejected by the "sign not reversed" condition because they have the same sign (pairing sign term = -1). The third type is ultra-wide profiles: the width of construction joints or structural joints far exceeds the typical width of cracks; although it may satisfy the sign reversal condition, it is significantly reduced in weight by the Gaussian attenuation term of the spacing weighting function. hour The fourth type is random noise point pairs, where two independent random noises happen to have opposite signs and are adjacent, but the distance between them is too small ( The attenuation is truncated by the half-width at half-maximum (WHM) of the Gaussian window. These four types of interception mechanisms work together to ensure the high specificity of bilateral pairing gating. The above-mentioned interception effect is directly determined by the structure of the pairing criterion itself: the pairing sign term requires that the eigenvalues of the candidate position and the pairing position have opposite signs. No matter how strong the isolated texture response is, it cannot simultaneously satisfy both the conditions of "opposite signs" and "reasonable spacing"; while the true crack edges on both sides must present coefficient pairs with opposite signs and spacing corresponding to the crack width in the wavelet domain (see the principle of pairing response). Figure 2 (a) and Figure 2 (b) Figure 2 (a) is a crack profile, showing a pair of responses with opposite signs and a spacing within a reasonable range on both sides of the crack edge in the wavelet domain. The pairing is valid, and the spacing of the pair of responses is the crack width at that point. The LH coefficient in the figure indicates that a horizontal scan is performed. Figure 2 (b) shows the texture profile, indicating that isolated strong responses remain closed because no matching responses with reasonable spacing, opposite signs, and comparable strengths can be found. Therefore, bilateral pairing gating suppresses texture erroneous enhancement without weakening the enhancement effect at crack edges, achieving selective enhancement of cracks.
[0049] Third, a dense adaptive gating method is adopted, which operates on a channel-by-channel and spatial-location-by-spatial-location basis. The switching values of the dense gating method have the exact same spatial size and channel dimension as the high-frequency enhancement features. For a 256×256×16 high-frequency sub-image, it contains more than 1 million independent switching values. In contrast, existing sub-band gating methods generated by global average pooling only have the product of the number of sub-bands and channels, and the spatial dimension has been flattened by pooling. All spatial locations within the same channel of the same sub-band can only share the same switching value, thus lacking spatial granularity. This fine granularity allows for the application of drastically different enhancement strategies at crack edge locations and background locations within the same sub-band, achieving selective enhancement of cracks and effective suppression of background noise.
[0050] Fourth, regarding the three-level progressive initialization, the three sets of learnable parameters (gating, enhancement, and fusion) are initialized with different scales of standard deviation (0.01, 0.0001, and 0.0001), forming a 100:1:1 coarse-to-fine learning sequence of control → content → post-processing. The gating bias uses conservative initialization, ensuring that the gating value is close to closed in the early training phase, and the bilateral pairing gating mechanism approximates an identity mapping. This avoids the random response of the gating in the early training phase perturbing the feature distribution extracted by the encoder. As training progresses, the high pairing scores at the crack edge gradually open the gating through backpropagation, while the background region, lacking effective pairings, has pairing scores always close to zero, keeping the gating closed. This evolution from conservative to adaptive allows the gating network to complete learning without destroying the encoder's backbone features. The accompanying hierarchical learning rate strategy ensures that the learnable parameters of the bilateral pairing gating mechanism converge before the other parameters. During training, the difference in the gating mean between the crack region and the background region is monitored as a training indicator of whether the bilateral pairing gating mechanism has learned effective pairings.
[0051] Fifth, high-frequency enhancement processing does not change the spatial size and number of channels of the feature map and can be embedded within each basic processing block of any encoder architecture (CNN, Transformer, Mamba, or hybrid forms).
[0052] Sixth, by statistically analyzing the crack width of the crack dataset (skeletalizing the labeled mask and calculating the crack width using distance transformation), a heavy-tailed distribution feature with crack widths spanning two orders of magnitude and exhibiting long tails in wide cracks can be obtained. Accordingly, the spacing weight function can adopt a Cauchy / Lorentzian heavy-tailed form in addition to the Gaussian form. Compared to the exponential decay of the Gaussian window, the power-law decay of the Cauchy window maintains usable paired detection weights in the wide crack range, avoiding excessive penalty for wide crack paired responses by the Gaussian window. In one implementation, the spacing weight function adopts the Gaussian form, and in another, the Cauchy form. The position and scale parameters can be pre-set based on crack width statistics from different datasets, or automatically adjusted as learnable parameters through end-to-end training, enabling bilateral paired gating to adapt to the crack morphology characteristics of different datasets. This design method, which mathematically encodes the crack width prior as spacing weights, has good engineering adaptability.
[0053] Based on the crack enhancement method based on bilateral pairing gating described in the above embodiments, the crack enhancement system based on bilateral pairing gating will be described below through embodiments.
[0054] like Figure 3 As shown, this embodiment of the invention provides a crack enhancement system based on bilateral pairing gating, comprising: The Haar wavelet transform module 301 is used to obtain the intermediate feature map of the crack and obtain the LL subband, LH subband, HL subband and HH subband through two-dimensional discrete Haar wavelet transform decomposition. The high-frequency enhancement processing module 302 is used to obtain high-frequency subband features based on LH subband, HL subband and HH subband, and perform high-frequency enhancement processing on the high-frequency subband features based on the GELU activation function to obtain high-frequency enhanced features; The bilateral pairing gating module 303 is used to determine the search direction for each candidate position in the LH, HL, and HH subbands. The search direction for the LH subband is vertical, for the HL subband it is horizontal, and for the HH subband it includes both vertical and horizontal directions. The search direction is uniquely determined by the mathematical definition of the subband type, eliminating the need for pre-detection of crack positions. Multiple intervals are traversed along the search direction within a preset search interval range, and the pairing response score for each candidate position at each interval is calculated. The pairing response score is obtained by multiplying the pairing sign term, the response intensity term, and the interval weight function. The pairing sign term is positive when the eigenvalue at the candidate position has the opposite sign to the eigenvalue at the pairing position, and negative when they have the same sign. The response intensity term is the product of the eigenvalue amplitude at the candidate position and the eigenvalue amplitude at the pairing position. The interval weight function monotonically decreases as the interval deviates from the typical crack width. The maximum value of the pairing response score for each candidate position at each interval is taken to obtain the final pairing score for that candidate position. The final pairing score is then input into a preset transformation formula to obtain the final gating value for that candidate position. The convex combination hybrid calculation module 304 is used to obtain the gated high-frequency subband based on the final gate value through convex combination hybrid calculation of high-frequency enhancement features and high-frequency subband features; The IWT inverse wavelet transform reconstruction module 305 is used to reconstruct the spatial domain feature map by using the IWT inverse wavelet transform to reconstruct the gated high-frequency subband and LL subband.
[0055] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0056] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0057] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0058] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0059] The above are merely embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of the claims of the present invention pending approval.
Claims
1. A crack enhancement method based on bilateral pairing gating, characterized in that, include: S1, obtain the intermediate feature map of the crack, and obtain the low-frequency approximate LL subband, the horizontal high-frequency LH subband, the vertical high-frequency HL subband and the diagonal high-frequency HH subband by two-dimensional discrete Haar wavelet transform decomposition. S2, high-frequency subband features are obtained based on LH subband, HL subband and HH subband, and high-frequency enhancement processing is performed on the high-frequency subband features based on GELU activation function to obtain high-frequency enhanced features; S3, through a bilateral pairing gating mechanism, performs edge pairing detection on high-frequency enhanced features to obtain the final pairing score, and calculates the final gating value based on the final pairing score, including: S3.1 For each candidate location in the LH, HL, and HH sub-bands, determine the search direction for that candidate location; wherein, the search direction for the LH sub-band is the vertical direction, the search direction for the HL sub-band is the horizontal direction, and the search direction for the HH sub-band includes both the vertical and horizontal directions; the search direction is uniquely determined by the mathematical definition of the sub-band type, without the need to pre-detect the crack location; S3.2, traverse multiple intervals within the preset search interval range along the search direction, and calculate the pairing response score for each candidate position at each interval; the pairing response score is obtained by multiplying the pairing sign term, the response intensity term, and the interval weight function. The pairing sign term takes a positive value when the eigenvalue at the candidate position has the opposite sign to the eigenvalue at the pairing position, and a negative value when the signs are the same. The response intensity term is the product of the eigenvalue amplitude at the candidate position and the eigenvalue amplitude at the pairing position. The interval weight function decreases monotonically as the interval deviates from the typical crack width. S3.3, take the maximum value of the pairing response score for each candidate position at each interval to obtain the final pairing score of the candidate position, and input the final pairing score into the preset transformation formula to obtain the final gating value of the candidate position; S4, based on the final gating value, the gated high-frequency subband is obtained by convex combination hybrid calculation of high-frequency enhancement features and high-frequency subband features; S5 reconstructs the spatial domain feature map by using the gated high-frequency subband and LL subband through IWT inverse wavelet transform.
2. The crack enhancement method based on bilateral pairing gating according to claim 1, characterized in that, S1, obtain the intermediate feature map of the crack, and decompose it through two-dimensional discrete Haar wavelet transform to obtain the low-frequency approximate LL subband, the horizontal high-frequency LH subband, the vertical high-frequency HL subband, and the diagonal high-frequency HH subband, including: Obtain the intermediate feature map of the crack; The intermediate feature map is segmented into non-overlapping 2×2 local blocks; By linearly combining the 2×2 local block with the transformation matrix of the two-dimensional discrete Haar wavelet transform, we obtain the LL subband, LH subband, HL subband and HH subband.
3. The crack enhancement method based on bilateral pairing gating according to claim 1, characterized in that, S2, based on the LH, HL, and HH subbands, high-frequency subband features are obtained. These features are then enhanced using the GELU activation function to obtain high-frequency enhanced features, including: The LH subband, HL subband, and HH subband are spliced together to obtain the high-frequency subband characteristics. ; High-frequency subband features Substituting into the high-frequency enhancement formula based on the GELU activation function, we obtain the high-frequency enhanced features; the expression for the high-frequency enhancement formula based on the GELU activation function is: ; in, Indicates high-frequency enhancement features, express Depthwise convolution with convolution kernels, This indicates group normalization.
4. The crack enhancement method based on bilateral pairing gating according to claim 1, characterized in that, S3.2, Search forward along the search direction corresponding to the candidate position for multiple intervals, and calculate the paired response score for each candidate position at each interval, including: Along candidate locations Corresponding search direction Forward search of multiple spacings , , and This indicates the preset minimum search interval and the preset maximum search interval; Each candidate position is calculated using the paired response calculation formula. At each spacing The paired response score The formula for calculating paired response is: ; in, Indicates high-frequency enhanced features at candidate positions The value at; Indicating high-frequency enhancement features in The value at; For paired symbol items, when and When the sign is opposite, the value is +1. and When the signs are the same, the value is -1; For the response intensity term; This is a preset spacing weight function.
5. The crack enhancement method based on bilateral pairing gating according to claim 4, characterized in that, Preset Spacing Weight Function For a Gaussian window, the expression is: ; in, and These are pre-set or learnable parameters; Alternatively, a preset spacing weight function can be used. Using the Cauchy / Lorentzian distribution, the expression is: ; in, For pre-set or learnable position parameters, For pre-defined or learnable scale parameters.
6. The crack enhancement method based on bilateral pairing gating according to claim 1, characterized in that, The expression for the preset transformation formula is: ; in, Indicates the final gate value, For scaling parameters, For bias parameters, scaling parameters and bias parameters For pre-set or learnable parameters, This represents the Sigmoid activation function; or, ; in, Indicates the final gate value, and For scaling parameters, scaling parameters and For pre-set or learnable parameters, For the final pairing score The output of a 1×1 convolution with dense gating.
7. The crack enhancement method based on bilateral pairing gating according to claim 1, characterized in that, S4, based on the final gating value, obtains the gated high-frequency sub-band through a convex combination of high-frequency enhancement features and high-frequency sub-band features, including: Final gate value High-frequency enhancement features and high-frequency subband characteristics Input the convex combination hybrid calculation formula to calculate the gated high-frequency subband. ; The expression for the formula of convex combination hybrid calculation is: 。 8. The crack enhancement method based on bilateral pairing gating according to claim 1, characterized in that, The learnable parameters in the bilateral pairing gating mechanism, the learnable parameters in the high-frequency enhancement processing, and the learnable parameters in the fusion processing after convex combination mixing are initialized with the first initialization standard deviation, the second initialization standard deviation, and the third initialization standard deviation, respectively. The first initialization standard deviation is greater than the second initialization standard deviation and the third initialization standard deviation. During training, a base learning rate scaling factor higher than that of other learnable parameters is applied to the learnable parameters in the bilateral pairing gating mechanism.
9. The crack enhancement method based on bilateral pairing gating according to claim 1, characterized in that, For candidate positions located at the edge of the high-frequency sub-band and searched along the search direction beyond the sub-band boundary, a reflection filling strategy is adopted to reflect the pixel values outside the sub-band boundary with the boundary as a mirror image. For the HH sub-band, pairing detection is performed simultaneously in both the vertical and horizontal search directions, and the average pairing score of the two search directions is taken as the pairing response score of the candidate position. When the search interval is a non-integer pixel interval, bilinear interpolation is used to obtain the feature value at the pairing position.
10. A crack enhancement system based on bilateral pairing gating, characterized in that, include: The Haar wavelet transform module is used to obtain the intermediate feature map of the crack. It decomposes the crack into a low-frequency approximate LL subband, a horizontal high-frequency LH subband, a vertical high-frequency HL subband, and a diagonal high-frequency HH subband through two-dimensional discrete Haar wavelet transform. The high-frequency enhancement processing module is used to obtain high-frequency subband features based on LH subband, HL subband and HH subband, and perform high-frequency enhancement processing on the high-frequency subband features based on the GELU activation function to obtain high-frequency enhanced features; The bilateral pairing gating module is used to determine the search direction for each candidate position in the LH, HL, and HH subbands. The search direction for the LH subband is vertical, for the HL subband it is horizontal, and for the HH subband it includes both vertical and horizontal directions. The search direction is uniquely determined by the mathematical definition of the subband type, eliminating the need for pre-detection of crack positions. Multiple intervals are traversed along the search direction within a preset search interval range, and the pairing response score for each candidate position at each interval is calculated. The pairing response score is obtained by multiplying the pairing sign term, the response intensity term, and the interval weight function. The pairing sign term is positive when the eigenvalue at the candidate position has the opposite sign to the eigenvalue at the pairing position, and negative when they have the same sign. The response intensity term is the product of the eigenvalue amplitude at the candidate position and the eigenvalue amplitude at the pairing position. The interval weight function monotonically decreases as the interval deviates from the typical crack width. The maximum pairing response score for each candidate position at each interval is taken to obtain the final pairing score for that candidate position. This final pairing score is then input into a preset transformation formula to obtain the final gating value for that candidate position. The convex combination hybrid calculation module is used to obtain the gated high-frequency subband based on the final gate value through convex combination hybrid calculation of high-frequency enhancement features and high-frequency subband features; The IWT inverse wavelet transform reconstruction module is used to reconstruct the spatial domain feature map by using the IWT inverse wavelet transform to reconstruct the gated high-frequency subband and LL subband.