Image Processing-Based Method and System for Detecting Weld Defects in Anti-collision Beams

By employing adaptive local equalization and frequency domain texture smoothing, the problem of poor denoising in weld seam images was solved, improving the accuracy and efficiency of weld seam defect detection in anti-collision beams and ensuring the effective recognition by deep learning models.

CN120598960BActive Publication Date: 2025-10-31WUJIANG CITY XINSHEN ALUMINUM TECH DEV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511106523.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-10-31
Estimated Expiration
2045-08-08

AI Technical Summary

Technical Problem

Existing technologies are prone to under-processing and over-processing when denoising images of anti-collision beam welds, which increases image complexity and affects the accuracy and efficiency of deep learning models in identifying defects.

Method used

An adaptive local equalization and frequency domain texture smoothing method is adopted. By combining adaptive block division and edge detection with frequency domain filtering, periodic texture features in weld seam images are suppressed, defect areas are preserved, and image quality is improved.

Benefits of technology

It achieves the best denoising effect on weld seam images, enhances the efficiency and accuracy of neural network in identifying defects, effectively suppresses noise interference, and preserves key defect features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120598960B_ABST
    Figure CN120598960B_ABST
Patent Text Reader

Abstract

This invention relates to the field of image processing technology, and more particularly to a method and system for detecting weld defects in crash beams based on image processing. The method involves acquiring images of the weld area of ​​a manufactured crash beam to obtain a grayscale image; initially dividing the grayscale image into blocks and obtaining the local complexity index of each initial sub-block; obtaining at least two adaptive sub-blocks based on the local complexity index of each initial sub-block; performing adaptive local histogram equalization on each adaptive sub-block to obtain a target grayscale image; performing edge detection on the target grayscale image to obtain at least two edge pixels; performing frequency domain transformation on the target grayscale image according to the gradient direction of each edge pixel to obtain a frequency domain image; filtering and time domain transformation on the frequency domain image to obtain a denoised image; and using a neural network to identify defects in the denoised image. By suppressing periodic textures in the weld image, the defect detection efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method and system for detecting weld defects in anti-collision beams based on image processing. Background Technology

[0002] The crash beam is a crucial component of an automotive safety system, playing a key role in absorbing and dispersing impact energy during a collision. Defects in the crash beam's welds can significantly reduce its strength and toughness, rendering it ineffective during a collision and endangering the lives of vehicle occupants. Therefore, defect detection of the crash beam's welds is of paramount importance.

[0003] Existing technologies typically utilize image processing, deep learning, and other related techniques to detect defects in critical areas such as welds during the production and processing of crash beams. This involves training a deep learning model to automatically learn feature representations of weld defects from a large amount of weld image data, enabling rapid and accurate assessment of weld quality. Prior to this, preprocessing of the weld images, such as denoising and enhancement, is crucial, as it directly impacts the accuracy and efficiency of the CNN convolutional neural network in defect recognition.

[0004] Traditional methods typically employ histogram equalization to enhance the contrast of weld seam images and various filters to denoise them, thereby ensuring image quality and facilitating accurate and efficient defect identification and detection. However, these traditional methods are mostly holistic processing methods, and image enhancement of the weld seam area using these methods is prone to under-processing and over-processing. For example, the shape, temperature gradient, and flow state of the molten pool constantly change during welding, leading to uneven material crystallization in the weld seam area, which increases the complexity of the image's grayscale. If traditional methods are used for image denoising, the denoising effect is poor, and a large amount of interference will still exist in the image. At the same time, weld seams generally employ multi-layer, multi-pass welding, spiral welding, and other processes, which can lead to periodic patterns or wavy textures in the weld seam area, further exacerbating the image complexity. If traditional methods are used for image denoising, important defect features may be lost.

[0005] Therefore, improving the denoising effect of weld seam images before using deep learning models to identify defects in the weld seam images of crash barriers has become an urgent problem to be solved. Summary of the Invention

[0006] In view of this, embodiments of the present invention provide a method and system for detecting weld defects in crash beams based on image processing, in order to solve the problem of how to improve the denoising effect of weld images before using deep learning models to identify defects in weld images of crash beams.

[0007] In a first aspect, embodiments of the present invention provide a method for detecting weld defects in anti-collision beams based on image processing, the method comprising the following steps:

[0008] During the production and processing of the crash beam, images of the weld area of ​​the produced crash beam are acquired to obtain weld images. The weld images are then preprocessed to obtain grayscale images.

[0009] The grayscale image is initially divided into blocks to obtain at least two initial sub-blocks. Based on the gradient features and grayscale values ​​of each pixel in each initial sub-block, the local complexity index of each initial sub-block is obtained. Based on the local complexity index of each initial sub-block, the grayscale image is adaptively divided into blocks to obtain at least two adaptive sub-blocks. Adaptive local histogram equalization is performed on each adaptive sub-block to obtain the target grayscale image.

[0010] Edge detection is performed on the target grayscale image to obtain at least two edge pixels. A gradient direction histogram is constructed based on the gradient direction of each edge pixel. The horizontal axis of the gradient direction histogram is the angle range of the gradient direction, and the vertical axis is the frequency of the gradient direction. The target grayscale image is masked based on the gradient direction with the highest frequency in the gradient direction histogram to obtain the image to be converted to the frequency domain.

[0011] The image to be frequency domain converted is converted to a frequency domain image. The frequency domain image is then filtered and converted to a time domain image to obtain a denoised image. A neural network is then used to identify defects in the denoised image.

[0012] In a second aspect, embodiments of the present invention provide an image processing-based system for detecting weld defects in anti-collision beams, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements an image processing-based method for detecting weld defects in anti-collision beams as described in the first aspect.

[0013] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:

[0014] In this invention, when performing adaptive local equalization on weld seam images, the initial sub-blocks are split and merged according to the local complexity of each initial sub-block, enabling the weld seam image to achieve adaptive block division. Based on the adaptive block division result, adaptive local equalization is completed to obtain the target grayscale image. Then, combined with a frequency domain spatial transformation algorithm, the internal welding texture in the target grayscale image is analyzed to obtain a denoised image after effectively suppressing and smoothing its welding texture features using an effective filter. This is the weld seam image with the best denoising effect. By suppressing the periodic texture (including the background) in the weld seam image, the crack defect area is preserved and enhanced, thereby improving the efficiency of defect identification using neural networks on denoised images. Attached Figure Description

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

[0016] Figure 1 This is a flowchart of a method for detecting weld defects in anti-collision beams based on image processing, provided in Embodiment 1 of the present invention. Detailed Implementation

[0017] Embodiments of this disclosure are described in detail below, with examples of these embodiments illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting it.

[0018] It should be noted that the terms "first," "second," etc., used in this disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure.

[0019] To illustrate the technical solution of the present invention, specific embodiments are described below.

[0020] See Figure 1 This is a flowchart of a method for detecting weld defects in anti-collision beams based on image processing, as provided in Embodiment 1 of the present invention. Figure 1 As shown, the method may include:

[0021] Step S101: During the production and processing of the anti-collision beam, images of the weld area of ​​the produced anti-collision beam are acquired to obtain weld images. The weld images are then preprocessed to obtain grayscale images.

[0022] After the crash beams are manufactured, it is necessary to inspect the welds for defects to prevent quality problems. Therefore, for the manufactured crash beams, inspection equipment is set up to acquire images of the welds, and then image analysis is performed to identify weld defects in the crash beams.

[0023] The specific setup of the testing equipment is as follows:

[0024] a. Light source system: Use ring LED light source (wavelength 450-650nm, power 10-30W) or coaxial light source to avoid overexposed areas caused by reflection on the weld surface.

[0025] Case study: For aluminum alloy anti-collision beams (reflectivity > 80%), polarizers need to be installed to filter out specular reflections, thereby improving the grayscale contrast between the weld and the base material by 20%-30%.

[0026] b. Industrial camera: Parameter requirements: resolution ≥ 5MP (pixel size < 3.45μm), frame rate ≥ 30fps, support for global shutter to eliminate motion blur.

[0027] c. Lens Configuration: When the height difference of the welded joint is approximately ±2mm, a lens with an aperture of F8-F16 should be selected to achieve depth-of-field coverage in conjunction with the focusing mechanism. Use a telecentric lens (distortion <0.1%) or post-processing algorithms to eliminate perspective distortion.

[0028] d. Environmental Control: Data is collected in a darkroom environment with an ambient light intensity ≤10 lux to avoid interference from natural light; the equipment is installed in a sealed enclosure with a vibration amplitude <0.05mm to prevent image blurring. The camera's operating temperature is controlled at 20±5℃ to reduce thermal noise.

[0029] To ensure the accuracy and efficiency of neural networks in identifying defects in weld images, traditional methods typically employ histogram equalization to enhance the contrast of the weld image and various filters to denoise it, thereby guaranteeing the image quality. However, considering that traditional methods are mostly holistic processing and that image enhancement of the weld region using traditional methods is prone to under-processing and over-processing, this invention provides an "adaptive local equalization + frequency domain texture smoothing" processing method to obtain weld images with optimal denoising effects, as detailed below.

[0030] After obtaining the weld seam image, preprocessing is performed to initially ensure the quality of the weld seam image and lay the foundation for subsequent image enhancement. The preprocessing methods include: grayscale conversion, where the acquired color image is converted to grayscale and histogram normalization is performed to linearly map the grayscale values ​​to the range [0, 255], enhancing contrast; geometric correction, where distortion coefficients are obtained using a calibration board (10mm checkerboard spacing) and corrected using OpenCV's undistort function; and perspective transformation, where the ROI region is corrected to a normal viewing angle using a 4-point matching algorithm for images taken at an angle.

[0031] At this point, we obtain the preprocessed weld image, which is a grayscale image.

[0032] Step S102: Perform initial segmentation on the grayscale image to obtain at least two initial sub-blocks. Based on the gradient features and grayscale values ​​of each pixel in each initial sub-block, obtain the local complexity index of each initial sub-block. Based on the local complexity index of each initial sub-block, perform adaptive segmentation on the grayscale image to obtain at least two adaptive sub-blocks. Perform adaptive local histogram equalization on each adaptive sub-block to obtain the target grayscale image.

[0033] Weld images typically contain complex textures and details, with significant contrast differences in local areas. Adaptive Local Histogram Equalization (ALHE) is an improvement on traditional histogram equalization. Its core idea is to divide the image into multiple sub-blocks and perform histogram equalization independently on each sub-block. In this way, ALHE can better preserve local details in the weld area while avoiding noise amplification and detail loss problems caused by global equalization. This effectively enhances local contrast, making weld defects (such as cracks and porosity) more prominent.

[0034] Considering that the core of adaptive local equalization for grayscale images lies in dynamically adjusting the block size based on local image characteristics, the goal of existing block segmentation is to use small blocks to preserve details in complex regions (such as edges and textures) and large blocks to avoid artifacts in uniform regions. This is generally based on calculating local complexity (gradient magnitude and local grayscale variance) and then splitting or merging adjacent sub-blocks according to the analysis results to achieve image sub-block division. Since noise points and real edges may have similar gradient magnitudes, but the gradient direction of noise is random, while the gradient direction of edges is continuous. Furthermore, due to common defects such as slag inclusions, porosity, and bubbles in weld seams, the internal pixel distribution is more compact and continuous. The features of these regions are significantly different from the non-compact, non-uniform, and random features of noise. Therefore, evaluating local complexity solely by calculating gradient magnitude has strong limitations. This invention combines gradient direction to jointly quantify local features, thereby achieving adaptive block segmentation in weld seam feature scenarios to improve the enhancement effect of adaptive local histogram equalization.

[0035] Specifically, the grayscale image is first divided into multiple 64×64 initial sub-blocks. Then, based on the gradient features and grayscale values ​​of each pixel in each initial sub-block, the local complexity index of each initial sub-block is obtained. The specific process is as follows:

[0036] (1) For any initial sub-block, use the Sobel operator to obtain the gradient value and gradient direction of each pixel in the initial sub-block, and obtain the gradient distribution disorder index of the initial sub-block based on the distribution characteristics of the gradient value and gradient direction of each pixel in the initial sub-block.

[0037] Specifically, the mean gradient value of all pixels in any initial sub-block is calculated, and the difference between the constant 1 and the mean gradient value is normalized to obtain a first normalized difference. The standard deviation of the gradient direction of all pixels in any initial sub-block is calculated, and the difference between the constant 1 and the standard deviation is normalized to obtain a second normalized difference. The first normalized difference and the second normalized difference are weighted and summed to obtain the gradient distribution disorder index of any initial sub-block.

[0038] In one implementation, the formula for calculating the gradient distribution disorder index of any initial sub-block is:

[0039]

[0040] in, This indicates the disordered gradient distribution of any initial sub-block. Indicates the first weight. Let represent the normalization function, and n represent the number of pixels in any initial sub-block. This represents the gradient value of the i-th pixel in any initial sub-block. Indicates the second weight. It represents the standard deviation of the gradient direction of all pixels in any initial sub-block.

[0041] Since the gradient distribution disorder index for any initial sub-block is obtained from both gradient value and gradient direction, and their effects are the same, therefore, setting... .

[0042] It should be noted that a larger mean gradient value indicates richer details and higher clarity in any initial sub-block, making it less likely to belong to a defect area, and correspondingly, a smaller gradient distribution disorder index for that initial sub-block; since the gradient direction of pixels in defect areas is more consistent, therefore... The smaller the value, the more consistent the gradient direction in any initial sub-block, the more likely any initial sub-block belongs to a defect region, and the greater the disorder index of gradient distribution in any initial sub-block.

[0043] (2) Obtain the gray value of each pixel in any initial sub-block, obtain the maximum gray value and the minimum gray value, and obtain the gray distribution disorder index of any initial sub-block based on the maximum gray value, the minimum gray value and the difference in gray values ​​of all pixels.

[0044] Specifically, the grayscale difference between the maximum and minimum grayscale values ​​is calculated to obtain the grayscale ratio between the grayscale difference and the maximum value in the grayscale range; the grayscale variance of all pixels in any initial sub-block is obtained, the difference between the constant 1 and the grayscale ratio is calculated, the product of the difference and the grayscale variance is obtained, and the product is normalized to obtain the grayscale distribution disorder index of any initial sub-block.

[0045] In one embodiment, the formula for calculating the grayscale distribution disorder index of any initial sub-block is:

[0046]

[0047] in, This indicates a disordered grayscale distribution index for any initial sub-block. This represents the normalization function, and 1 represents a constant. This represents the maximum grayscale value in any initial sub-block. This represents the minimum grayscale value in any initial sub-block, and 255 represents the maximum grayscale value in the range [0, 255]. This represents the variance of grayscale values ​​of all pixels in any initial sub-block.

[0048] It should be noted that since the grayscale value of the noise region is relatively higher than that of the defect region, the smaller the difference between the maximum and minimum grayscale values ​​in any initial sub-block, the greater the probability that any initial sub-block belongs to a defect region, and the more complex its local grayscale distribution, the greater the grayscale distribution disorder index of any initial sub-block; furthermore, this is combined with the grayscale value variance within any initial sub-block. , The larger the value, the more unstable the gray value distribution in any initial sub-block, the more chaotic the gray value distribution in any initial sub-block, and the more likely any initial sub-block is to belong to a defect area, corresponding to a larger gray value distribution disorder index.

[0049] (3) Based on the mean between the gradient distribution disorder index and the gray-scale distribution disorder index of any initial sub-block, the local complexity index of any initial sub-block is obtained.

[0050] In one implementation, the formula for calculating the local complexity index of any initial sub-block is:

[0051]

[0052] in, The local complexity index representing any initial sub-block. This indicates the disordered gradient distribution of any initial sub-block. This indicates the disordered grayscale distribution of any initial sub-block.

[0053] It should be noted that, because the gradient directions of pixels in the defect area are highly consistent, and the corresponding grayscale value changes are closely continuous along a certain direction, therefore, The larger the value, the greater the probability that any initial sub-block belongs to a noisy region, and the greater its local complexity index.

[0054] Similarly, the local complexity index of each initial sub-block is obtained, and then the grayscale image is adaptively divided into blocks based on the local complexity index of each initial sub-block to obtain at least two adaptive sub-blocks. The adaptive block division method is as follows:

[0055] Obtain the preset first local complexity threshold Second local complexity threshold And the first local complexity threshold is less than the second local complexity threshold. Preferably, the following settings are made: This is to ensure extreme characteristic cases (greater than) or less The value ranges of the sub-blocks under [ ) are similar, and they are not extreme features (belonging to [ ) , The value range of sub-blocks within the specified range is relatively larger to ensure that the number of sub-blocks adjusted is relatively less than the number of sub-blocks not adjusted. There is no limit here, and it can be set according to the implementation scenario.

[0056] If the local complexity index of any initial sub-block is greater than the second local complexity threshold, then the initial sub-block is divided into a preset number of target sub-blocks on average. For example, if the initial sub-block is 64×64, then the initial sub-block is divided into four 32×32 target sub-blocks. If the local complexity index of any initial sub-block is less than the first local complexity threshold, then the initial sub-block is merged with the initial sub-blocks within its four neighboring regions into one target sub-block. For example, a 64×64 initial sub-block is merged with its adjacent initial sub-blocks into a 128×128 target sub-block. If the local complexity index of any initial sub-block is greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold, then the initial sub-block is used as a target sub-block.

[0057] Traverse all initial sub-blocks to obtain at least two target sub-blocks, obtain the local complexity index of each target sub-block, and if the local complexity index of all target sub-blocks is greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold, then all target sub-blocks are used as adaptive sub-blocks of the grayscale image.

[0058] If the local complexity index of any target sub-block is greater than the second local complexity threshold or less than the first local complexity threshold, then that target sub-block is taken as the initial sub-block, and the method of obtaining target sub-blocks is repeated until the local complexity index of all target sub-blocks is greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold. Then all target sub-blocks are taken as adaptive sub-blocks of the grayscale image.

[0059] Since the purpose of ALHE is to smooth and suppress noise interference while preserving regions with a higher probability of defects, after obtaining multiple adaptive sub-blocks of the grayscale image, adaptive local histogram equalization is performed on each adaptive sub-block to obtain the target grayscale image. Adaptive local histogram equalization is an existing technology and will not be elaborated here.

[0060] Step S103: Perform edge detection on the target grayscale image to obtain at least two edge pixels. Construct a gradient direction histogram based on the gradient direction of each edge pixel. The horizontal axis of the gradient direction histogram represents the angle range of the gradient direction, and the vertical axis represents the frequency of the gradient direction. Perform masking on the target grayscale image based on the gradient direction with the highest frequency in the gradient direction histogram to obtain the image to be converted to the frequency domain.

[0061] By applying Adaptive Local Equalization (ALHE) to the grayscale image in step S102, effective noise reduction and detail preservation are achieved. However, analysis reveals that processes such as multi-layer, multi-pass welding and spiral welding result in periodic patterns or wavy textures in the weld image. These textures also exhibit strong edge characteristics in the grayscale image. Consequently, these textures are identified as abnormal defects and preserved during the ALHE process, severely interfering with the identification of common weld defects such as cracks.

[0062] Considering that the frequency and number of periodic textures in weld images are much greater than those of ductile defects such as cracks, and that the distribution pattern of periodic textures is very strong, with the extension direction consistent but different from that of cracks (periodic textures generally extend vertically, while cracks typically extend horizontally), this embodiment of the invention performs edge detection on the target grayscale image. Based on the detected edge pixels, a masking technique is used to process the target grayscale image to obtain the image to be converted to the frequency domain.

[0063] Specifically, edge lines in the target grayscale image are extracted using Canny, Sobel, or Prewitt edge detection algorithms, thus obtaining edge pixels in the target grayscale image. The grayscale values ​​of edge pixels in the target grayscale image are set to 1, and the grayscale values ​​of non-edge pixels are set to 0, resulting in a binary grayscale image. The Sobel operator is used to calculate the gradient direction of each edge pixel in the binary grayscale image, and then the gradient direction of each edge pixel is quantized to a discrete angle interval. In this embodiment of the invention, an angle interval is set every 10 degrees, i.e., angle interval [0 degrees, 10 degrees], angle interval [11 degrees, 20 degrees], ..., and so on, resulting in multiple angle intervals.

[0064] Next, a gradient direction histogram is constructed based on the gradient direction of each edge pixel. The horizontal axis of the gradient direction histogram represents the angular range of the gradient direction, and the vertical axis represents the frequency of the gradient direction. The dominant direction is then identified within the gradient direction histogram, specifically the angular range of the gradient direction with the highest frequency. Edge pixels within ±10° of the dominant direction are designated as periodic texture pixels, where ±10° represents the allowable angular error range and is not restricted here. After determining the periodic texture pixels, in the target grayscale image, the grayscale values ​​of the periodic texture pixels are marked as 1, and the grayscale values ​​of the non-periodic texture pixels are marked as 0, resulting in a binary mask image. This binary mask image is multiplied by the target grayscale image to obtain the image to be converted to the frequency domain, which contains only the periodic texture portion.

[0065] Step S104: Perform frequency domain transformation on the image to be transformed to obtain a frequency domain image. Perform filtering and time domain transformation on the frequency domain image to obtain a denoised image. Use a neural network to identify defects in the denoised image.

[0066] To achieve smooth texture in the frequency domain, firstly, a Fast Fourier Transform (FFT) is used to transform the image to be transformed into a frequency domain image. The frequency domain image is then centered (low-frequency components are moved to the center, and high-frequency components are moved to the periphery). Bright spots (frequency peaks) in the frequency domain image are observed. These bright spots correspond to the frequency components of the periodic texture, and the frequency range of the periodic texture (such as the dominant frequency and secondary frequency) is recorded. Then, based on the frequency analysis results above, the center frequency, bandwidth, and transition band of the band-stop filter are determined (e.g., the center frequency is the dominant frequency of the periodic texture, and the bandwidth covers all periodic frequency components). A mask for the band-stop filter is generated in the frequency domain, with the periodic frequency component region in the filter mask set to 0 (filtered) and other regions set to 1 (preserved). Finally, the band-stop filter mask is multiplied by the frequency domain image to filter out the periodic frequency components. An Inverse Fast Fourier Transform (IFFT) is then performed on the filtered frequency domain image to obtain a time domain image. At this point, the periodic texture in the time domain image is suppressed, while the crack and defect regions are preserved and enhanced. The time domain image is then used as the denoised image.

[0067] It should be noted that the frequency domain conversion and band-stop filter filtering mentioned above are existing technologies and will not be elaborated on here.

[0068] Since the denoised image is the optimal denoised and enhanced image, a deep learning model can be used to detect defects in the denoised image. Specifically: acquire multiple frames of weld seam images with defect type labels, use the multiple frames of weld seam images as input to the neural network, train the neural network according to the label of each frame of weld seam image to obtain a trained neural network for defect recognition; input the denoised image into the trained neural network, and output the corresponding defect recognition result.

[0069] The general operation of using a trained neural network to identify defects in denoised images is as follows:

[0070] (1) Data acquisition: Identify the types of weld defects (such as cracks, porosity, slag inclusions, lack of fusion, etc.) and acquire weld images for each type of defect. Obtain image data through industrial cameras, X-ray inspection equipment, or historical weld inspection reports. (2) Data annotation: Use tools such as LabelImg and CVAT to annotate the weld defect areas and generate bounding boxes or pixel-level segmentation labels. (3) Data partitioning: Training set / validation set / test set: Divide the dataset in a ratio of 7:1:2 or 8:1:1 to ensure that the test set is independent of the training set. (4) CNN model design: Use classic architectures or custom architectures. Classic architectures include Faster R-CNN, YOLO, SSD, etc., to directly locate the defect location. Custom architectures are designed based on defect features to create lightweight CNNs (such as reducing the number of convolutional layers and using depthwise separable convolutions), which are suitable for resource-constrained scenarios. (5) Model training and evaluation optimization: This step includes loss function selection, optimizer and learning rate strategy setting, classification index optimization, and hyperparameter tuning. This is an existing technology and will not be elaborated further. (6) Model deployment: including model export (format conversion and quantization compression) and deployment environment (edge ​​device and cloud deployment). (7) Real-time detection process: denoised image acquisition, inputting the denoised image into the model, and outputting classification results such as defect category and location.

[0071] It is worth noting that using deep learning models to detect defects in denoised images is an existing technology, and will not be elaborated on here.

[0072] Based on the same inventive concept as the above method, this embodiment of the invention also provides an image processing-based anti-collision beam weld defect detection system, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of any one of the above-described image processing-based anti-collision beam weld defect detection methods.

[0073] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A method for detecting weld defects in anti-collision beams based on image processing, characterized in that, The method includes: During the production and processing of the crash beam, images of the weld area of ​​the produced crash beam are acquired to obtain weld images. The weld images are then preprocessed to obtain grayscale images. The grayscale image is initially divided into blocks to obtain at least two initial sub-blocks. Based on the gradient features and grayscale values ​​of each pixel in each initial sub-block, the local complexity index of each initial sub-block is obtained. Based on the local complexity index of each initial sub-block, the grayscale image is adaptively divided into blocks to obtain at least two adaptive sub-blocks. Adaptive local histogram equalization is performed on each adaptive sub-block to obtain the target grayscale image. Edge detection is performed on the target grayscale image to obtain at least two edge pixels. A gradient direction histogram is constructed based on the gradient direction of each edge pixel. The horizontal axis of the gradient direction histogram is the angle range of the gradient direction, and the vertical axis is the frequency of the gradient direction. The target grayscale image is masked based on the gradient direction with the highest frequency in the gradient direction histogram to obtain the image to be converted to the frequency domain. The image to be frequency domain converted is converted to a frequency domain image. The frequency domain image is then filtered and converted to a time domain to obtain a denoised image. A neural network is then used to identify defects in the denoised image. The grayscale image is adaptively divided into blocks based on the local complexity index of each initial sub-block, resulting in at least two adaptive sub-blocks, including: A preset first local complexity threshold and a preset second local complexity threshold are obtained, and the first local complexity threshold is less than the second local complexity threshold. If the local complexity index of any initial sub-block is greater than the second local complexity threshold, then the initial sub-block is divided into a preset number of target sub-blocks on an average basis. If the local complexity index of any initial sub-block is less than the first local complexity threshold, then the initial sub-block and its four neighboring initial sub-blocks are merged into one target sub-block. If the local complexity index of any initial sub-block is greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold, then the initial sub-block is taken as a target sub-block. Traverse all initial sub-blocks to obtain at least two target sub-blocks, obtain the local complexity index of each target sub-block, and if the local complexity index of all target sub-blocks is greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold, then all target sub-blocks are used as adaptive sub-blocks of the grayscale image. If the local complexity index of any target sub-block is greater than the second local complexity threshold or less than the first local complexity threshold, then that target sub-block is taken as the initial sub-block, and the method of obtaining target sub-blocks is repeated until the local complexity index of all target sub-blocks is greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold. Then all target sub-blocks are taken as adaptive sub-blocks of the grayscale image.

2. The method for detecting weld defects in anti-collision beams based on image processing according to claim 1, characterized in that, The step of obtaining the local complexity index of each initial sub-block based on the gradient features and grayscale values ​​of each pixel in each initial sub-block includes: For any initial sub-block, obtain the gradient value and gradient direction of each pixel in the initial sub-block, and obtain the gradient distribution disorder index of the initial sub-block based on the distribution characteristics of the gradient value and gradient direction of each pixel in the initial sub-block. Obtain the grayscale value of each pixel in any initial sub-block to get the maximum grayscale value and the minimum grayscale value. Based on the maximum grayscale value, the minimum grayscale value, and the difference in grayscale values ​​of all pixels, obtain the grayscale distribution disorder index of any initial sub-block. The local complexity index of any initial sub-block is obtained by averaging the gradient distribution disorder index and the grayscale distribution disorder index of any initial sub-block.

3. The method for detecting weld defects in anti-collision beams based on image processing according to claim 2, characterized in that, The step of obtaining a gradient distribution disorder index for any initial sub-block based on the distribution characteristics of the gradient value and gradient direction of each pixel in any initial sub-block includes: Calculate the mean gradient value of all pixels in any initial sub-block, normalize the difference between the constant 1 and the mean gradient value to obtain a first normalized difference, calculate the standard deviation of the gradient direction of all pixels in any initial sub-block, normalize the difference between the constant 1 and the standard deviation to obtain a second normalized difference, and perform a weighted sum of the first normalized difference and the second normalized difference to obtain a gradient distribution disorder index of any initial sub-block.

4. The method for detecting weld defects in anti-collision beams based on image processing according to claim 2, characterized in that, The step of obtaining a grayscale distribution disorder index for any initial sub-block based on the maximum grayscale value, the minimum grayscale value, and the grayscale value differences of all pixels includes: Calculate the grayscale difference between the maximum and minimum grayscale values ​​to obtain the grayscale ratio between the grayscale difference and the maximum value in the grayscale range; obtain the grayscale variance of all pixels in any initial sub-block; calculate the subtraction between the constant 1 and the grayscale ratio to obtain the product of the subtraction and the grayscale variance; normalize the product to obtain the grayscale distribution disorder index of any initial sub-block.

5. The method for detecting weld defects in anti-collision beams based on image processing according to claim 1, characterized in that, The step of performing masking processing on the target grayscale image based on the gradient direction with the highest frequency in the gradient direction histogram to obtain the image to be converted in the frequency domain includes: The angle interval of the gradient direction with the highest frequency is obtained from the gradient direction histogram. Combining the angle interval and the angle error range, periodic texture pixels are obtained from all edge pixels. In the target grayscale image, the grayscale value of the periodic texture pixels is marked as 1, and the grayscale value of the non-periodic texture pixels is marked as 0, to obtain a binary mask image. The binary mask image is multiplied with the target grayscale image to obtain the image to be converted in the frequency domain.

6. The method for detecting weld defects in anti-collision beams based on image processing according to claim 1, characterized in that, The method of using a neural network to identify defects in the denoised image includes: Acquire multiple frames of weld seam images labeled with defect types, use these multiple frames as input to a neural network, train the neural network based on the label of each weld seam image, and obtain a trained neural network for defect identification. The denoised image is input into the trained neural network, which outputs the corresponding defect recognition result.

7. A collision avoidance beam weld defect detection system based on image processing, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the image processing-based method for detecting weld defects in anti-collision beams as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Intelligent defect detection method for aero-engine parts based on machine vision

    CN117522870A

  • Pipeline wall defect detection method and system based on image recognition

    CN120374625A