Intelligent identification and distribution visualization method and system for weld defects
By using image acquisition and denoising, multi-scale feature extraction, and convolutional neural network classification, combined with pixel labeling and grid partitioning, a heat map of weld defect distribution is generated, which solves the problem of low accuracy in weld defect detection in complex scenarios and achieves high-precision defect recognition and visualization.
Patent Information
- Application Number
- CN202511446698.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-11
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-10-11
AI Technical Summary
Existing weld defect detection technologies suffer from low recognition accuracy in complex scenarios, failing to meet the demands of high-precision industrial inspection.
By employing techniques such as image acquisition and denoising, multi-scale feature extraction, convolutional neural network classification, pixel labeling, and grid division, a heat map of defect distribution is generated, enabling accurate identification and visualization of weld defects.
It improves the accuracy and visualization of weld defect detection, clearly showing the distribution pattern of defects in different directions of the weld, and providing a reliable basis for weld quality assessment and repair.
Smart Images

Figure CN120912617B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of defect detection technology, and in particular to an intelligent identification and distribution visualization method and system for weld defects. Background Technology
[0002] Weld quality inspection is a core aspect of ensuring product structural integrity and operational safety in the manufacturing industry. Especially in fields with stringent structural strength requirements, such as boiler manufacturing, pressure vessel manufacturing, and pipeline engineering, weld defects exceeding standards, such as cracks, lack of fusion, incomplete penetration, strip-shaped defects, and circular defects, can lead to component failure or even major safety accidents. Therefore, developing high-precision weld defect detection technology is not only a basis for judging weld quality but also a key means of assessing structural safety and diagnosing welding processes.
[0003] Radiographic inspection is one of the main methods for detecting internal defects in welds. Radiographic evaluation methods are mainly divided into two categories. One is manual evaluation based on radiographic films, where inspectors visually examine the films and use tools such as magnifying glasses to identify obvious defects. This method relies on personal experience, is prone to missing minor cracks, and is highly subjective and inefficient. The other category is automated inspection based on simple image processing. It extracts defect features using basic algorithms such as threshold segmentation and edge detection, and uses a fixed grayscale threshold to separate defects from the background area. However, this type of method struggles to handle complex scenarios. When there are metal obstructions or interference, the fixed threshold may misclassify non-defect areas as defects. For defects with significant morphological differences, a single feature extraction algorithm cannot achieve accurate classification.
[0004] In summary, existing technologies suffer from low defect identification accuracy in complex weld seam scenarios, failing to meet the demands of high-precision industrial inspection. Summary of the Invention
[0005] This invention provides a method and system for intelligent identification and distribution visualization of weld defects, so as to achieve accurate region segmentation in complex weld images and improve the accuracy of internal defect detection in welds.
[0006] In a first aspect, to address the aforementioned technical problems, the present invention provides an intelligent identification and distribution visualization method for weld defects, comprising:
[0007] Acquire radiographic images of weld seams, and perform noise reduction processing on the radiographic images of weld seams to obtain smooth images;
[0008] Multi-scale feature extraction is performed on the smoothed image to obtain a feature set, and the feature set is segmented to obtain a weld seam segmentation image;
[0009] For the weld seam segmentation image, a convolutional neural network is used to classify different defect types to obtain a defect classification image. The defect classification image is then pixel-annotated to determine the defect annotation image.
[0010] Pixels of each defect type are extracted from the defect annotation image to generate a defect pixel distribution map. The weld segmentation image is divided into uniform grids. An initial set of sub-regions is generated by combining the defect pixel distribution map. Pixels at the boundaries of the sub-regions are filtered to obtain an optimized set of sub-regions.
[0011] Based on the optimized sub-region set, calculate the ratio of the number of defective pixels to the total number of pixels in each sub-region, determine the relationship between the ratio and a preset ratio threshold, obtain the classification sub-region set, and map the distribution of the classification sub-region set to a two-dimensional matrix to obtain the density distribution matrix.
[0012] Based on the density distribution matrix, the proportional values are aggregated along the weld length and width directions respectively, and missing data points are filled by interpolation to obtain a continuous proportional value sequence.
[0013] Based on the continuous proportional value sequence, a corresponding color gradient is assigned to the proportional value, and a defect distribution heatmap is obtained after image rendering.
[0014] Preferably, the step of performing multi-scale feature extraction on the smoothed image to obtain a feature set, and segmenting the feature set to obtain a weld seam segmentation image, includes:
[0015] Multi-scale feature extraction is performed on the smoothed image to obtain the texture features and edge features of the weld, which constitute the feature set.
[0016] The feature set is segmented to divide the weld area and the background area, and the boundary position is determined to obtain an initial segmentation image;
[0017] The ray field conditions for image acquisition are obtained, and the gray values of the initial segmented image are extracted. When the gray values exceed the preset gray value fluctuation range, the division of the weld area is adjusted in combination with the ray field conditions to obtain the weld segmentation image.
[0018] Preferably, the step of using a convolutional neural network to classify different defect types for the weld seam segmentation image to obtain a defect classification image, and then performing pixel annotation on the defect classification image to determine the defect annotation image, includes:
[0019] Pixel smoothness features are extracted from the weld seam segmentation image, and a convolutional neural network is used to determine the defect regions of the weld seam segmentation image. The type of each defect region is output, and the defect regions are labeled accordingly to obtain the defect classification image.
[0020] A pixel-level annotation method is used to annotate the regions of the corresponding defect type in the defect classification image. The annotation boundaries are then refined by combining the pixel smoothness feature to obtain the defect annotation image.
[0021] Preferably, the step of extracting pixels of each defect type from the defect-annotated image to generate a defect pixel distribution map, uniformly dividing the weld segmentation image into a grid, generating an initial sub-region set based on the defect pixel distribution map, and filtering the boundary pixels of the sub-regions to obtain an optimized sub-region set includes:
[0022] Based on the defect-annotated image, obtain the corresponding pixels for different defect types and generate the defect pixel distribution map;
[0023] By calculating the width and height of the weld seam segmentation image, grid lines are evenly distributed to form a set of sub-blocks;
[0024] The defective pixels in the defective pixel distribution map are traversed and assigned to each sub-block to form the initial sub-region set containing defective pixel information;
[0025] For the initial sub-region set, the median filtering method is used to smooth the boundary pixels, and the boundary pixels whose defect pixel count ratio in the 8-neighborhood is lower than the preset density threshold are removed to obtain the optimized sub-region set.
[0026] Preferably, the step of determining the relationship between the ratio value and a preset ratio threshold to obtain a set of classification sub-regions, and mapping the distribution of the set of classification sub-regions to a two-dimensional matrix to obtain a density distribution matrix, includes:
[0027] Determine whether the ratio value exceeds a preset ratio threshold. If yes, mark the corresponding sub-region as a high defect density sub-region; otherwise, mark the corresponding sub-region as a low defect density sub-region.
[0028] The location information of the high defect density sub-region and the low defect density sub-region is projected into a two-dimensional matrix, and the high defect density sub-region is assigned a value of 1 and the low defect density sub-region is assigned a value of 0 to obtain the density distribution matrix.
[0029] Preferably, the step of aggregating the proportional values along the weld length and width directions according to the density distribution matrix, and interpolating and filling missing data points to obtain a continuous proportional value sequence includes:
[0030] For the density distribution matrix, the proportional values are aggregated along the weld length direction using linear interpolation, and the missing data points are filled with the average value of adjacent points to obtain continuous density distribution data;
[0031] Based on the continuous density distribution data, a set of proportional values along the weld width direction is obtained and divided into width segments. The average value of the set of proportional values in each width segment is calculated to obtain a sequence of proportional values in the width direction.
[0032] For the width-direction ratio value sequence, cubic spline interpolation is performed on the missing data points to generate a continuous width-direction ratio value distribution, thus obtaining a continuous ratio value sequence.
[0033] Preferably, the step of assigning a corresponding color gradient to the proportional value based on the continuous proportional value sequence, and obtaining a defect distribution heatmap after image rendering, includes:
[0034] According to the continuous ratio value sequence, if the ratio value is lower than the preset low density threshold, a blue mapping is assigned to the corresponding defect location; if the ratio value is higher than the preset high density threshold, a red mapping is assigned to the corresponding defect location, thus obtaining a color mapping sequence.
[0035] Based on the color mapping sequence, the continuous ratio value sequence is converted into pixel colors and mapped onto a two-dimensional image grid to generate a defect distribution heatmap.
[0036] Secondly, the present invention provides an intelligent identification and distribution visualization system for weld defects, comprising:
[0037] The image acquisition and processing module is used to acquire weld radiographic inspection images and perform noise reduction processing on the weld radiographic inspection images to obtain smooth images.
[0038] The weld seam segmentation module is used to extract multi-scale features from the smooth image to obtain a feature set, and then segment the feature set to obtain a weld seam segmentation image.
[0039] The defect classification module is used to classify different defect types using a convolutional neural network for the weld seam segmentation image to obtain a defect classification image, and to perform pixel annotation on the defect classification image to determine the defect annotation image.
[0040] The sub-region division module is used to extract pixels of each defect type from the defect annotation image, generate a defect pixel distribution map, perform uniform grid division on the weld segmentation image, generate an initial sub-region set by combining the defect pixel distribution map, filter the sub-region boundary pixels, and obtain an optimized sub-region set.
[0041] The density matrix construction module is used to calculate the ratio of the number of defective pixels to the total number of pixels in each sub-region based on the optimized sub-region set, determine the relationship between the ratio and a preset ratio threshold, obtain a classification sub-region set, and map the distribution of the classification sub-region set to a two-dimensional matrix to obtain a density distribution matrix.
[0042] The proportional sequence generation module is used to aggregate the proportional values along the weld length and width directions respectively according to the density distribution matrix, and to interpolate and fill missing data points to obtain a continuous proportional value sequence.
[0043] The heatmap generation module is used to assign a corresponding color gradient to the continuous proportional value sequence, and then perform image rendering to obtain a defect distribution heatmap.
[0044] Compared with the prior art, the present invention has the following beneficial effects:
[0045] (1) This invention acquires weld radiographic inspection images and performs denoising processing to obtain smooth images. Then, it performs multi-scale feature extraction and semantic segmentation on the smooth images to obtain weld segmentation images. This process can reduce image noise interference through denoising processing, capture the subtle texture and edge features of the weld through multi-scale feature extraction, and accurately separate the weld area from the background through semantic segmentation, thereby improving the accuracy of weld area localization and providing a high-quality regional basis for subsequent defect detection.
[0046] (2) This invention uses a convolutional neural network to classify different defect types in weld seam segmentation images, obtains defect classification images, and performs pixel annotation to determine defect annotation images. During classification, the deep learning capability of the convolutional neural network can be used to accurately distinguish different defect types, and pixel-level annotation can be combined to refine the defect boundaries, thereby achieving accurate identification and location of defects and improving the accuracy of defect identification.
[0047] (3) This invention generates a defect pixel distribution map by extracting defect pixels from the defect annotation image, uniformly dividing the weld segmentation image into a grid and combining it with the defect pixel distribution map to generate an initial set of sub-regions, and then filtering the boundary pixels of the sub-regions to obtain an optimized set of sub-regions. This process standardizes the weld region through grid division, achieves accurate correspondence between sub-regions and defects by combining the defect pixel distribution, and further eliminates noise interference by boundary filtering, so that the sub-regions can accurately reflect the spatial distribution of defects.
[0048] (4) This invention calculates the proportion values based on the optimized sub-region set to obtain a density distribution matrix, aggregates the proportion values along the weld length and width directions and interpolates to obtain a continuous proportion value sequence, and then generates a defect distribution heatmap based on a color mapping algorithm. This visualization operation quantifies the defect distribution through density calculation, ensures data continuity through interpolation, and transforms abstract data into an intuitive heatmap through color mapping, which can clearly show the distribution pattern of defects in different directions of the weld, providing an intuitive and reliable basis for weld quality assessment and repair. Attached Figure Description
[0049] Figure 1This is a flowchart illustrating an embodiment of the intelligent identification and distribution visualization method for weld defects provided by the present invention.
[0050] Figure 2 This is a schematic diagram of an embodiment of the intelligent identification and distribution visualization system for weld defects provided by the present invention. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] Reference Figure 1 The first embodiment of the present invention provides a method for intelligent identification and distribution visualization of weld defects, including steps S11 to S17, as follows:
[0053] S11, acquire a weld radiographic inspection image, and perform noise reduction processing on the weld radiographic inspection image to obtain a smooth image;
[0054] S12, perform multi-scale feature extraction on the smooth image to obtain a feature set, and segment the feature set to obtain a weld seam segmentation image;
[0055] S13, For the weld seam segmentation image, a convolutional neural network is used to classify different defect types to obtain a defect classification image. The defect classification image is then pixel-labeled to determine the defect labeling image.
[0056] S14, extract the pixels of each defect type from the defect annotation image to generate a defect pixel distribution map, divide the weld segmentation image into a uniform grid, combine the defect pixel distribution map to generate an initial sub-region set, filter the sub-region boundary pixels, and obtain an optimized sub-region set.
[0057] S15, based on the optimized sub-region set, calculate the ratio of the number of defective pixels to the total number of pixels in each sub-region, determine the relationship between the ratio and the preset ratio threshold, obtain the classification sub-region set, and map the distribution of the classification sub-region set to a two-dimensional matrix to obtain the density distribution matrix;
[0058] S16, According to the density distribution matrix, the proportional values are aggregated along the weld length and width directions respectively, and missing data points are filled by interpolation to obtain a continuous proportional value sequence;
[0059] S17. Based on the continuous proportional value sequence, assign a corresponding color gradient to the proportional value, and obtain a defect distribution heatmap after image rendering.
[0060] In step S11, a weld radiographic inspection image is acquired, and the weld radiographic inspection image is denoised to obtain a smooth image.
[0061] It should be noted that weld images can be acquired using radiographic inspection equipment (such as X-ray machines, gamma-ray sources, etc.). After the X-rays penetrate the weld, areas of different densities (such as defects and normal welds) have different absorption capacities for the X-rays. These differences are captured by the imaging components of the radiographic inspection system and converted into grayscale images. To ensure that the texture features of defects are accurately captured, the spatial resolution of the radiographic inspection needs to be controlled at the micrometer level. For example, when the acquisition resolution is 0.5 micrometers / pixel, for a weld with a length of 10 millimeters, a raw image with a width of 20,000 pixels can be generated, clearly showing the edge contours of the fine direction of the crack.
[0062] The purpose of denoising weld radiographic inspection images is to eliminate noise interference while preserving the edge and texture features of the weld and defects as much as possible. Before denoising, the type of noise needs to be determined by analyzing the grayscale changes in the image. Common noise types include high-frequency noise (such as random point-like interference in the image) and low-frequency noise (such as the overall high or low grayscale values in local areas of the image). For example, when determining the noise type based on the grayscale histogram, if the grayscale change frequency exceeds 50 times per pixel area, it can be identified as high-frequency noise; otherwise, it is identified as low-frequency noise.
[0063] In weld defect detection, high-frequency noise, due to its high spatial frequency and drastic variations, and the fact that minute defects in the weld (such as microcracks) also exhibit abrupt changes in local grayscale values, easily masks the edge features of microcracks, leading to missed or false detections. Therefore, it needs to be filtered out. In this embodiment, Gaussian filtering is used to process high-frequency noise, and a Gaussian-based convolution kernel is used to smooth the image. The convolution kernel is a two-dimensional matrix. To ensure that the center pixel of the image aligns with the center of the convolution kernel during filtering, the kernel size is set to an odd value (3×3, 5×5, 7×7, etc.), which can better preserve edge information while smoothing the image. The element with coordinates (x, y) in the matrix has a value where σ is the standard deviation, which determines the shape and width of the Gaussian function.
[0064] It's worth noting that the smaller the σ value, the larger the kernel center value, the faster the surrounding values decay, and the more concentrated the filtering effect is on the central pixel, resulting in better edge preservation. Conversely, the larger the σ value, the more evenly the kernel distribution, leading to a stronger smoothing effect, but also a greater likelihood of blurred edges. For high-frequency noise in weld images, in scenarios with less noise but requiring fine edge preservation (such as detecting microcracks), a 3×3 kernel with σ values of 0.8-1.0 can be used; in scenarios with denser noise (such as those with significant salt-and-pepper noise), a 5×5 kernel with σ values of 1.0-1.5 can be selected. The resulting smoothed image eliminates high-frequency noise interference while preserving the edge features of weld defects to the greatest extent possible.
[0065] In step S12, multi-scale feature extraction is performed on the smoothed image to obtain a feature set, and the feature set is segmented to obtain a weld seam segmentation image, including:
[0066] Multi-scale feature extraction is performed on the smoothed image to obtain the texture features and edge features of the weld, which constitute the feature set.
[0067] The feature set is segmented to divide the weld area and the background area, and the boundary position is determined to obtain an initial segmentation image;
[0068] The ray field conditions for image acquisition are obtained, and the gray values of the initial segmented image are extracted. When the gray values exceed the preset gray value fluctuation range, the division of the weld area is adjusted in combination with the ray field conditions to obtain the weld segmentation image.
[0069] It should be noted that multi-scale feature extraction aims to comprehensively capture the feature information of the weld at different spatial scales. Based on a smoothed image, multiple image levels of different sizes are generated through Gaussian pyramid downsampling. Each level corresponds to a different resolution, such as the original resolution, half resolution, and quarter resolution. Higher levels correspond to lower resolutions, focusing on the overall structure of the weld (such as weld orientation and overall width), while lower levels correspond to higher resolutions, focusing on local details (such as minute textures and edge inflection points). At each scale level, convolutional kernels of different sizes are used to extract features from the image. The higher the level, the larger the convolutional kernel. At the same time, features from different levels are fused through skip connections. For example, edge features at the 256×256 scale are concatenated with texture features at the 1024×1024 scale to form a feature set containing multi-scale information, ensuring that both global structural information and local details are preserved.
[0070] Furthermore, based on the feature set, each pixel in the image needs to be classified to determine whether it belongs to the weld area or the background area, thereby achieving the separation of the weld from the background. In this embodiment, the U-Net model is used for semantic segmentation. The U-Net model is an end-to-end pixel-level classification model, and its structure consists of three parts: First, the encoder, which consists of multiple convolutional blocks and downsampling layers. Each convolutional block contains two 3×3 convolutions and one ReLU activation. The downsampling layer uses 2×2 max pooling to extract high-level abstract features such as the overall outline of the weld by continuously reducing the feature map size. Second, the bottleneck layer further compresses the features through 1-2 convolutional blocks to focus on the most critical semantic information. Third, the decoder, which consists of multiple convolutional blocks and upsampling layers. The upsampling layer uses 2×2 transposed convolutions to gradually restore the feature map size. At the same time, it stitches the feature maps of the corresponding layers of the encoder through skip connections to supplement the edge texture and other details lost due to downsampling. Finally, the feature map is mapped to two channels through 1×1 convolution (the two channels represent the probability that the pixel belongs to the weld and the background, respectively). The classification probability of each pixel is obtained by activation by the softmax function.
[0071] When training the U-Net model, weld images of different materials (such as steel and aluminum alloys) and different welding processes (such as manual arc welding and TIG welding) are collected as training datasets. Pixel-level masks are generated through manual annotation, and data augmentation is used to expand the dataset to avoid model overfitting. The Adam optimizer is used for 50-100 epochs of training. The Intersection over Union (IoU) metric is monitored using a validation set. Training is stopped when the IoU does not improve for 5 consecutive epochs, and the optimal model is saved to obtain the grayscale segmentation threshold for distinguishing welds from the background. In the boundary region between the weld and the background, the pixel grayscale values exhibit continuous and significant gradient changes. The algorithm identifies the extreme points of this grayscale gradient, i.e., the positions with the fastest grayscale change rate, as the boundary between the weld and the background.
[0072] It is worth noting that when obtaining X-ray films through the imaging components of the X-ray inspection equipment, the intensity of the X-rays transmitted through the workpiece and the proportion of total X-ray intensity at the time of image acquisition are recorded simultaneously. The X-ray conditions at the time of obtaining the X-ray film directly affect the grayscale distribution of the weld image, thus interfering with the initial segmentation results. For example, when uneven X-ray intensity causes local areas of the weld to be too bright (high grayscale value) or too dark (low grayscale value), the initial segmentation image may show misclassification of the weld area and the background. A preset grayscale fluctuation range is used to determine whether this interference exists. By collecting standard weld images under different industrial scenarios with uniform X-ray fields, the grayscale distribution characteristics of the weld area are extracted, including the average grayscale, standard deviation, and grayscale range.
[0073] Furthermore, considering factors such as fluctuations in radiation intensity during actual production, radiation intensity can fluctuate by ±10%-15%, requiring an additional redundancy within the statistical range. For example, the average grayscale of the radiograph obtained from steel welds under a set standard radiation intensity is 150, with a standard deviation of 20, indicating that the grayscale values in the normal weld area are mainly concentrated within the range of 150±20. After introducing a 15% redundancy, the upper limit is adjusted to 170+(170-130)×15%≈176, and the lower limit is adjusted to 130-(170-130)×15%≈124, ultimately setting the preset fluctuation range to 124-176.
[0074] Furthermore, when the grayscale value of the weld area in the initial segmented image exceeds the preset grayscale fluctuation range, it indicates that the ray conditions have a significant impact on the segmentation results, and the segmentation parameters need to be adjusted. For excessively bright or dark areas, the grayscale segmentation threshold can be increased or decreased to avoid misclassifying high-grayscale backgrounds as welds and ensure that the weld area is accurately identified. Through this dynamic adjustment, the weld area is re-divided, ultimately resulting in a weld segmentation image with clear boundaries that is not affected by ray inhomogeneity. For example, if the ray intensity is too high, causing the average grayscale of the weld to rise to 180 and the average grayscale of the background to rise to 110, the original grayscale segmentation threshold will misclassify some of the background as welds. In this case, it is necessary to calculate the average of the two new grayscale values and adjust the grayscale segmentation threshold to 145 using the Otsu algorithm.
[0075] In step S13, for the weld seam segmentation image, a convolutional neural network is used to classify different defect types to obtain a defect classification image. The defect classification image is then pixel-annotated to determine the defect annotation image, including:
[0076] Pixel smoothness features are extracted from the weld seam segmentation image, and a convolutional neural network is used to determine the defect regions of the weld seam segmentation image. The type of each defect region is output, and the defect regions are labeled accordingly to obtain the defect classification image.
[0077] A pixel-level annotation method is used to annotate the regions of the corresponding defect type in the defect classification image. The annotation boundaries are then refined by combining the pixel smoothness feature to obtain the defect annotation image.
[0078] It should be noted that pixel smoothness features are a quantitative indicator describing the degree of drastic change in pixel grayscale values in a weld seam segmentation image. It is obtained by calculating the variance of grayscale values within a 3×3 pixel neighborhood. The smaller the variance, the smoother the transition between pixels, and the higher the smoothness. The weld seam segmentation image and the extracted pixel smoothness features are input into a convolutional neural network (CNN) to automatically identify and locate defect regions, while simultaneously outputting the confidence score of each region belonging to a specific defect type. A CNN is a deep structure containing multiple convolutional layers, pooling layers, and fully connected layers. Taking the ResNet model as an example, residual connections can solve the gradient vanishing problem in deep networks, effectively extracting deep features of defects, such as the linear direction of cracks, the grooves of undercut, and the irregular protrusions of weld beads. The training process of the neural network needs to be based on a labeled defect sample set, which contains a large number of image patches labeled as important weld seam defect types. Backpropagation is used to continuously optimize the network parameters, enabling the network to learn the typical features of important defect types.
[0079] It's worth noting that the purpose of pixel-level annotation is to pinpoint the defect region in the defect classification image to each pixel, clearly defining the boundary and extent of the defect. Refining the annotation boundaries is to eliminate potential boundary blurring or mislabeling during the classification process. Specifically, a preliminary pixel annotation mask is first generated based on the defect classification image, such as setting the crack region to 128 and the background to 0. Then, the pixel smoothness features of the mask boundary pixels are extracted. For crack boundaries, pixels with a grayscale variance higher than 50 are retained, and low-variance pixel segments (variance 30-50) are connected to make the crack boundary more continuous. Appropriate settings are also applied to other types of defects (such as incomplete fusion, incomplete penetration, etc.).
[0080] In this embodiment, the threshold settings of 20 and 50 are based on statistical analysis of a large number of standard weld defect samples. The typical abrupt change region variance of the crack edge is concentrated between 50 and 100, and pixels between 30 and 50 represent the smooth transition section of the crack branch. For example, in a certain segment of the initial crack boundary, there are three consecutive pixels with gray-level variances of 60, 40, and 65, where 40 falls within the 30-50 range. This pixel is retained to connect the high-variance pixels on both sides, forming a continuous crack edge. Similar statistical analysis is performed for other types of defects, making the threshold settings helpful for the contour extraction of the corresponding defect types. In this way, the final defect annotation image can not only accurately distinguish important types of defects but also precisely delineate the contours of the defects.
[0081] For example, in the inspection of weld seams in high-pressure pipelines, after the weld seam segmentation image is processed by a convolutional neural network, a circular region with a diameter of 3mm, whose internal pixel grayscale variance is 15, is marked as a pore; another linear region with a length of 5mm, whose edge pixel grayscale variance is 60, is marked as a crack. In the pixel-level annotation stage, the boundaries are refined by smoothness features, removing 3 high-variance pixels (variance of 55) at the edge of the pore and adding 2 low-variance pixels (variance of 40) at the crack fracture point. The final defect annotation image clearly shows the circular outline of the pore and the continuous direction of the crack.
[0082] In step S14, pixels of each defect type are extracted from the defect annotation image to generate a defect pixel distribution map. The weld segmentation image is then divided into a uniform grid. An initial set of sub-regions is generated by combining the defect pixel distribution map with the grid. Pixels at the boundaries of the sub-regions are filtered to obtain an optimized set of sub-regions, including:
[0083] Based on the defect-annotated image, obtain the corresponding pixels for different defect types and generate the defect pixel distribution map;
[0084] By calculating the width and height of the weld seam segmentation image, grid lines are evenly distributed to form a set of sub-blocks;
[0085] The defective pixels in the defective pixel distribution map are traversed and assigned to each sub-block to form the initial sub-region set containing defective pixel information;
[0086] For the initial sub-region set, the median filtering method is used to smooth the boundary pixels, and the boundary pixels whose defect pixel count ratio in the 8-neighborhood is lower than the preset density threshold are removed to obtain the optimized sub-region set.
[0087] It should be noted that by traversing each pixel in the defect-annotated image, recording the pixels corresponding to different defect types with different pixel coordinate values, and superimposing the pixels of different defect types onto the coordinate system of the weld segmentation image, a defect pixel distribution map is generated. The size and number of sub-blocks are determined based on the dimensions of the weld segmentation image, ensuring that each sub-block covers enough pixels to reflect local features without obscuring details due to excessive size. Secondly, the sub-block size needs to be adjusted in conjunction with the defect distribution density. Through analysis of historical inspection data, a ratio of 1:3 to 1:5 between the sub-block size and the average defect spacing accurately reflects local density differences while ensuring data stability. If the weld defects are densely distributed, such as 3-5 pores per square millimeter, the sub-blocks need to be appropriately reduced (e.g., 30×30 pixels) to distinguish the clustered areas of adjacent defects; if the defects are sparse, such as only 1-2 cracks per centimeter, the sub-blocks can be appropriately enlarged (e.g., 80×80 pixels) to avoid statistical errors caused by too few defect pixels within the sub-block.
[0088] Specifically, the width (W) and height (H) of the weld seam segmentation image are first calculated, both in pixels. Then, the sub-block size is set according to the accuracy requirements of defect analysis (e.g., 50×50 pixels). The image is divided into (W / 50)×(H / 50) sub-blocks by uniformly distributing grid lines. If the size is not divisible, the edge sub-blocks can be adjusted to 50±n pixels to ensure coverage of the entire weld seam area. This standardized division method ensures consistency and comparability in subsequent defect density calculations, avoiding analysis bias caused by inconsistent area sizes. Each pixel in the defect pixel distribution map is traversed, and its sub-block is determined based on its coordinates. The type of the pixel is recorded in the corresponding sub-block. Each sub-block thus becomes a sub-region containing defect pixel information, and all sub-regions together constitute the initial sub-region set.
[0089] In this embodiment, the purpose of median filtering is to eliminate boundary distortion caused by noise or edge effects in the initial sub-region set. The principle is to replace the median value of each pixel on the boundary with the median value of its 3×3 neighborhood pixels, thereby eliminating isolated noise points and making the boundary contour more regular. For example, if a sub-region has an isolated crack pixel on its boundary, and its surrounding 8 neighborhoods are all background pixels, after 3×3 median filtering, this pixel will be replaced by the background pixel values of its neighbors, thus smoothing the boundary. A preset density threshold is used to further filter boundary pixels. Through statistical analysis of a large number of standard samples, it is found that when defective pixels are normally distributed, the proportion of defective pixels in their 8 neighborhoods is not less than 10%. Therefore, the preset density threshold is set to 10%. Those skilled in the art will understand that this threshold can be adjusted within ±5% depending on the specific application scenario. For example, in high-precision weld inspection in the aerospace field, the accuracy of defect identification is extremely important. The threshold can be lowered to 5% to retain more boundary pixels that may be related to cracks. In contrast, in scenarios such as building steel structures where inspection efficiency is more critical, the threshold can be raised to 15% to avoid the judgment of defect distribution patterns being affected by too many redundant pixels.
[0090] For example, in the inspection of pressure vessel welds, the defect-annotated image contains multiple pores and a long crack. After extraction, 800 pore pixels and 500 crack pixels are obtained. The generated defect pixel distribution map shows that the pores are concentrated in the middle of the weld, and the crack extends along the edge of the weld. The 1000×200 pixel weld segmentation image is divided into 50×50 pixel grids, resulting in 80 sub-regions. In the initial set of sub-regions, the 10 central sub-regions contain a large number of pore pixels, and the 5 edge sub-regions contain crack pixels, but some sub-region boundaries have isolated pixels. After applying a 3×3 median filter, the jagged edges of the boundaries are improved. Applying a 10% density threshold filter removes 23 boundary points with no defect pixels in their 8-neighborhood. In the final optimized set of sub-regions, the boundaries of each sub-region are smooth and the defect pixel distribution is reasonable.
[0091] In step S15, based on the optimized sub-region set, the ratio of the number of defective pixels to the total number of pixels in each sub-region is calculated, and the relationship between the ratio and a preset ratio threshold is determined to obtain a classification sub-region set. The distribution of the classification sub-region set is mapped onto a two-dimensional matrix to obtain a density distribution matrix, including:
[0092] Determine whether the ratio value exceeds a preset ratio threshold. If yes, mark the corresponding sub-region as a high defect density sub-region; otherwise, mark the corresponding sub-region as a low defect density sub-region.
[0093] The location information of the high defect density sub-region and the low defect density sub-region is projected into a two-dimensional matrix, and the high defect density sub-region is assigned a value of 1 and the low defect density sub-region is assigned a value of 0 to obtain the density distribution matrix.
[0094] It should be noted that the number of defective pixels refers to the total number of pixels marked as porosity or cracks within a sub-region. The preset ratio threshold is set based on a comprehensive analysis of industry standards for weld quality and the severity of defects. Statistical analysis of a large number of qualified and unqualified weld samples revealed that sub-regions with a ratio exceeding 0.01 have a significantly increased risk of structural failure, and defects can interact with each other, accelerating structural damage. For example, in pressure vessel welds, the probability of leakage in sub-regions with a ratio exceeding 0.01 is more than five times that of sub-regions with a low ratio. Those skilled in the art will understand that this threshold can be adjusted within the range of 0.005-0.02 according to specific industry quality standards. In fields with extremely high weld quality requirements, the threshold can be lowered to 0.005 to strictly control defect density; while in the field of ordinary building steel structures, the threshold can be raised to 0.02 to improve detection efficiency while ensuring safety.
[0095] In this embodiment, all labeled sub-regions collectively constitute a classification sub-region set. This set not only contains the density category information of each sub-region but also retains the spatial positional relationship of each sub-region in the weld seam segmentation image, facilitating accurate reflection of the spatial distribution characteristics of defects in subsequent matrix mapping. The number of rows and columns of the two-dimensional matrix is consistent with the number of rows and columns of the classification sub-region set. Each element in the matrix corresponds to a sub-region; if the sub-region is a high-defect-density sub-region, the element is assigned a value of 1; if it is a low-defect-density sub-region, the element is assigned a value of 0. This mapping method achieves accurate conversion from spatial position to matrix coordinates by corresponding row and column indices to the position of the sub-region in the weld seam segmentation image. The resulting density distribution matrix integrates the scattered sub-region density information into a whole, intuitively displaying the distribution pattern of high-defect-density regions.
[0096] For example, in the inspection of weld seams in chemical pipelines, the optimized sub-region set contains 100 sub-regions of 50×50 pixels each. Calculations show that the defect pixel ratio of 15 sub-regions is between 0.012 and 0.03, and the ratio of 85 sub-regions is between 0 and 0.008. Using a preset ratio threshold of 0.01 for classification, the 15 sub-regions are marked as high-defect-density sub-regions, and the 85 sub-regions as low-defect-density sub-regions. The location information of these sub-regions is mapped to a 10×10 two-dimensional matrix (10 rows and 10 columns for the 100 sub-regions). Matrix elements corresponding to high-defect-density sub-regions are assigned a value of 1, and those corresponding to low-defect-density sub-regions are assigned a value of 0. In the resulting density distribution matrix, elements with a value of 1 are mainly concentrated in rows 3-5 and columns 6-8, clearly reflecting that defects in the pipeline weld are concentrated in the area slightly to the right of the center.
[0097] In step S16, based on the density distribution matrix, the proportional values are aggregated along the weld length and width directions respectively, and missing data points are interpolated to obtain a continuous proportional value sequence, including:
[0098] For the density distribution matrix, the proportional values are aggregated along the weld length direction using linear interpolation, and the missing data points are filled with the average value of adjacent points to obtain continuous density distribution data;
[0099] Based on the continuous density distribution data, a set of proportional values along the weld width direction is obtained and divided into width segments. The average value of the set of proportional values in each width segment is calculated to obtain a sequence of proportional values in the width direction.
[0100] For the width-direction ratio value sequence, cubic spline interpolation is performed on the missing data points to generate a continuous width-direction ratio value distribution, thus obtaining a continuous ratio value sequence.
[0101] It should be noted that each element in the density distribution matrix corresponds to a sub-region along the weld length. Due to the possibility of missing points caused by local defects or data acquisition errors during sub-region division, linear interpolation is required to fill these gaps. The ratio of the missing point can be calculated by summing the ratios of two adjacent known ratio points. If the interval between adjacent points is too large, exceeding 5 sub-regions, the average value of the adjacent points is used to fill the gaps. This avoids excessive interpolation error and transforms the discrete sub-region ratio values into continuous length-direction distribution data.
[0102] Furthermore, the sub-regions along the weld width are arranged in a matrix column. Each width segment contains multiple consecutive sub-regions in the same column. The specific number needs to be determined based on the actual width of the weld, the height of the sub-regions, and the distribution gradient of defects along the width direction. It can be set to 2-3 rows. If the weld width is small (e.g., less than 5mm, corresponding to 10-20 rows of pixels in the image) and the sub-region height is narrow (e.g., 5-10 pixels / sub-region), every 2 rows is a width segment to ensure that there are enough segments to reflect the detailed changes in the width direction. If the weld width is large (e.g., 10-20mm, corresponding to 40-80 rows of pixels) and the sub-region height is wide (e.g., 10-20 pixels / sub-region), then every 3 rows is a width segment to avoid data redundancy due to too many segments.
[0103] In this embodiment, the arithmetic mean of the sum of the proportion values of all sub-regions within each width segment, divided by the number of proportion values within that width segment, is used as the representative value for that width segment. This aggregation method smooths out local fluctuations in the width direction and highlights the overall distribution trend. By performing this operation on all width segments, the representative values of all width segments are arranged in order from one edge of the weld to the other, resulting in a sequence of proportion values in the width direction, which clearly shows the distribution differences of defects across the weld width. Cubic spline interpolation constructs piecewise cubic polynomial curves, ensuring that the curves between adjacent data points are not only continuous but also that the first and second derivatives are continuous, avoiding the broken-line jumps that linear interpolation might cause. For gaps in the sequence caused by missing data or aggregation errors, the algorithm fits a polynomial based on three known points before and after to estimate the value of the missing point.
[0104] It is worth noting that when performing cubic spline interpolation, the coordinates of the known data points are first determined. Let the known points in the width direction proportional value sequence be , where i is the width segment index, taking values of 0, 1, 2, ..., n, and representing the corresponding width segment value. If there are missing points in the sequence, with an index value of k, then three known points before and after the missing point (the y-values corresponding to i = k±1, k±2, k±3) are selected as the interpolation basis to ensure sufficient points to capture the data trend. Next, a cubic spline function is constructed. Let the curve between two adjacent known points be and , which can be represented as , where x is the width segment index variable. Based on the curve passing through the known points and , 2n equations can be formed; furthermore, based on the equality of the first derivative and the equality of the second derivative of adjacent intervals, n-1 equations are formed respectively; to ensure smoothness at both ends of the curve, natural boundary conditions are used for the points at both ends of the sequence, i.e., the second derivative is 0, forming 2 equations. Finally, a system of 4n equations is obtained, corresponding to 4n unknown coefficients. The coefficients , , and are solved using matrix inversion or iterative algorithms. Substituting the index k of the missing point into the corresponding cubic spline function, the proportion of the missing point is calculated. The resulting continuous proportion sequence more realistically restores the natural laws of defect distribution.
[0105] For example, in the inspection of pressure pipeline welds, the density distribution matrix is 15 rows (length direction) × 5 columns (width direction). When aggregating along the length direction, a missing point is found at x=10. The proportion of x=9 to its left is 0.018, and the proportion of x=11 to its right is 0.022. Through linear interpolation, the value at x=10 is 0.020, forming continuous density distribution data. Based on this data, the proportion values in the width direction are extracted. Each column is aggregated into a width segment by 3 rows (since the weld width corresponds to 15 rows of pixels, 3 rows / segment can be divided into 5 segments, balancing detail and efficiency). The average values of the 5 width segments are calculated to be 0.006, 0.012, missing, 0.015, and 0.009, respectively, and arranged in sequence from the inner edge to the outer edge of the track. Cubic spline interpolation was performed on the missing third width segment, and the value obtained by fitting the previous and next points was 0.0135, finally yielding a continuous scale value sequence [0.006, 0.012, 0.0135, 0.015, 0.009].
[0106] In step S17, based on the continuous ratio value sequence, a corresponding color gradient is assigned to the ratio value, and after image rendering, a defect distribution heatmap is obtained, including:
[0107] According to the continuous ratio value sequence, if the ratio value is lower than the preset low density threshold, a blue mapping is assigned to the corresponding defect location; if the ratio value is higher than the preset high density threshold, a red mapping is assigned to the corresponding defect location, thus obtaining a color mapping sequence.
[0108] Based on the color mapping sequence, the continuous ratio value sequence is converted into pixel colors and mapped onto a two-dimensional image grid to generate a defect distribution heatmap.
[0109] It should be noted that when performing color mapping, a gradient logic from cool to warm colors should be followed. Blue, as a cool color, corresponds to low defect density, representing low risk, while red, as a warm color, corresponds to high defect density, representing high risk. This mapping method conforms to human visual perception of color and allows for quick assessment of the severity of defect distribution without the need for precise numerical readings.
[0110] In this embodiment, the preset low-density threshold and high-density threshold are the critical values for dividing the color gradient. Statistical analysis of weld inspection data from multiple fields such as boiler manufacturing, pressure vessel manufacturing, and pressure pipeline installation shows that the common range for continuous ratio values is 0-0.02. When the ratio value is below 0.005, the defect density is extremely low, and its impact on the structural safety of the weld is minimal, belonging to a negligible low-risk area. Therefore, the low-density threshold can be set to 0.005. When the ratio value is above 0.015, the proportion of the effective load-bearing area of the weld cross-section that has been weakened exceeds the safety redundancy range. Under alternating loads (such as pipeline pressure fluctuations, thermal expansion and contraction, etc.), stress concentration is easily generated at the defect location, and the fatigue crack propagation rate will increase by 3-5 times. This will not only shorten the service life of the weld but also increase the overall welding failure risk. Therefore, the high-density threshold is set to 0.015. Those skilled in the art can fine-tune the threshold according to industry characteristics. For example, in fields such as ultra-high pressure vessels or power plant boilers where safety requirements are extremely high, the high-density threshold can be tightened to 0.01, while in other low-pressure equipment scenarios where the risk is relatively low, it can be relaxed to 0.02.
[0111] Furthermore, the ratio values between the preset low-density threshold and the high-density threshold represent medium risk, and are assigned colors in a linear gradient. A ratio value of 0.005-0.01 corresponds to a low defect density with limited impact on structural strength, represented by green; the 0.01-0.0135 range indicates defect aggregation and potential risk, corresponding to yellow for attention; the 0.0135-0.015 range is close to the high-density threshold, where defects have formed a cluster effect, significantly reducing the structural load-bearing capacity, corresponding to orange for intervention. Based on threshold judgment, each ratio value is assigned to a specific color range, forming a color code sequence with the same length as the continuous ratio value sequence, which is the color mapping sequence.
[0112] In one feasible approach, image rendering transforms abstract color codes into concrete two-dimensional images, enabling spatial visualization of defect distribution. During implementation, the size of the two-dimensional image grid is first determined based on the length of the continuous scale value sequence. If the sequence contains n scale values, the image grid is set to n columns (along the weld width direction) and m rows (along the weld length direction, set according to visualization accuracy requirements, such as 50-100 rows), forming a long, narrow grid area that matches the actual shape of the weld. Then, each color code from the color mapping sequence is sequentially filled into the corresponding column of the grid, assigning that color to all pixels in the same column, ensuring color consistency along the length direction and highlighting the distribution differences along the width direction. Finally, the edge pixels of two adjacent columns are taken, involving the rightmost column of the i-th column (70% weight) and the leftmost column of the (i+1)-th column (30% weight). The RGB values of the colors corresponding to these two edge pixels are obtained and weighted averaged to obtain the transition color pixel value. This avoids the harsh edges caused by direct splicing of colors in adjacent columns, making the color transition of the heatmap smoother and more natural, and more in line with the gradual characteristics of defect density.
[0113] It should be noted that the defect distribution heatmap, as a visual representation of weld defect detection results, primarily transforms abstract proportional data into an intuitive color distribution image, helping inspectors quickly grasp the distribution patterns of defects within the weld space. For pressure-bearing equipment such as pressure vessels, pressure pipelines, and boilers, the defect distribution characteristics of welds directly affect the operational safety of the equipment. Concentrated high-defect-density areas are weak points in pressure bearing capacity, easily leading to leaks or even explosions under long-term alternating loads or high pressure. Through the color gradient of the heatmap, inspectors can quickly identify red high-risk areas, orange warning areas, and yellow potential risk areas without analyzing complex data, significantly improving the efficiency of quality assessment and the accuracy of decision-making. Simultaneously, the defect distribution heatmap retains the proportional distribution characteristics along the weld width direction, which helps to trace the root cause of problems and optimize welding parameters.
[0114] For example, in the inspection of weld seams in chemical pipelines, the continuous ratio value sequence is [0.004, 0.007, 0.011, 0.016, 0.008], with a preset low-density threshold of 0.005 and a high-density threshold of 0.015. According to the color mapping algorithm, 0.004 corresponds to blue, 0.007 is between 0.005 and 0.010 and corresponds to green, 0.011 is between 0.010 and 0.015 and corresponds to yellow, 0.016 corresponds to red, and 0.008 corresponds to green, resulting in the color mapping sequence [blue, green, yellow, red, green]. The sequence is mapped onto a 100-column × 50-row image grid. The first column is filled with blue, the second column with green, the third column with yellow, the fourth column with red, and the fifth column with green. After the edges are smoothed, the generated defect distribution heat map clearly highlights the high defect density areas in the red column (the fourth column) and the low-risk areas in the blue column (the first column). Inspectors can intuitively judge the defect distribution pattern in the width direction of the pipe weld and quickly locate the areas that need to be inspected.
[0115] In summary, this invention discloses an intelligent identification and distribution visualization method for weld defects, including acquiring weld radiographic inspection images, denoising the weld radiographic inspection images to obtain smooth images; performing multi-scale feature extraction on the smooth images to obtain feature sets, segmenting the feature sets to obtain weld segmentation images; using a convolutional neural network to classify different defect types in the weld segmentation images to obtain defect classification images, annotating the defect classification images with pixels to determine defect annotation images; extracting pixels of each defect type from the defect annotation images to generate a defect pixel distribution map; uniformly dividing the weld segmentation images into grids, and combining the defect... A set of initial sub-regions is generated from the pixel distribution map. Pixels at the boundaries of these sub-regions are filtered to obtain an optimized set of sub-regions. Based on this optimized set, the ratio of defective pixels to the total number of pixels within each sub-region is calculated. The relationship between this ratio and a preset ratio threshold is determined to obtain a set of categorized sub-regions. The distribution of these categorized sub-regions is mapped onto a two-dimensional matrix to obtain a density distribution matrix. Based on this density distribution matrix, the ratio values are aggregated along the weld length and width directions, and missing data points are interpolated to obtain a continuous ratio value sequence. A corresponding color gradient is assigned to each ratio value based on this continuous ratio value sequence, and image rendering is performed to obtain a defect distribution heatmap. This invention improves the accuracy of external weld defect detection and achieves intuitive visualization of defect distribution by integrating image processing, neural network classification, and density visualization technologies.
[0116] Reference Figure 2 The second embodiment of the present invention provides an intelligent identification and distribution visualization system for weld defects, comprising:
[0117] The image acquisition and processing module is used to acquire weld radiographic inspection images and perform noise reduction processing on the weld radiographic inspection images to obtain smooth images.
[0118] The weld seam segmentation module is used to extract multi-scale features from the smooth image to obtain a feature set, and then segment the feature set to obtain a weld seam segmentation image.
[0119] The defect classification module is used to classify different defect types using a convolutional neural network for the weld seam segmentation image to obtain a defect classification image, and to perform pixel annotation on the defect classification image to determine the defect annotation image.
[0120] The sub-region division module is used to extract pixels of each defect type from the defect annotation image, generate a defect pixel distribution map, perform uniform grid division on the weld segmentation image, generate an initial sub-region set by combining the defect pixel distribution map, filter the sub-region boundary pixels, and obtain an optimized sub-region set.
[0121] The density matrix construction module is used to calculate the ratio of the number of defective pixels to the total number of pixels in each sub-region based on the optimized sub-region set, determine the relationship between the ratio and a preset ratio threshold, obtain a classification sub-region set, and map the distribution of the classification sub-region set to a two-dimensional matrix to obtain a density distribution matrix.
[0122] The proportional sequence generation module is used to aggregate the proportional values along the weld length and width directions respectively according to the density distribution matrix, and to interpolate and fill missing data points to obtain a continuous proportional value sequence.
[0123] The heatmap generation module is used to assign a corresponding color gradient to the continuous proportional value sequence, and then perform image rendering to obtain a defect distribution heatmap.
[0124] It should be noted that the intelligent identification and distribution visualization system for weld defects provided in this embodiment of the invention is used to execute all the process steps of the intelligent identification and distribution visualization method for weld defects in the above embodiment. The working principles and beneficial effects of the two are one-to-one, so they will not be described again.
[0125] This invention also provides an electronic device. The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a Gaussian filtering noise reduction program. When the processor executes the computer program, it implements the steps in the above-described embodiments of the intelligent identification and distribution visualization methods for weld defects, for example... Figure 1The step S11 shown. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the above system embodiments, such as the weld seam segmentation module.
[0126] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.
[0127] The electronic device may be a desktop computer, laptop, handheld computer, or smart tablet, etc. The electronic device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. It may include more or fewer components than described above, or combine certain components, or different components. For example, the electronic device may also include input / output devices, network access devices, buses, etc.
[0128] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the electronic device, connecting all parts of the electronic device via various interfaces and lines.
[0129] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0130] Wherein, if the modules / units integrated in the electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0131] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0132] It should be understood that the above description is merely a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.
Claims
1. A method for intelligent identification and distribution visualization of weld defects, characterized in that, include: Acquire radiographic images of weld seams, and perform noise reduction processing on the radiographic images of weld seams to obtain smooth images; Multi-scale feature extraction is performed on the smoothed image to obtain a feature set, and the feature set is segmented to obtain a weld seam segmentation image; For the weld seam segmentation image, a convolutional neural network is used to classify different defect types to obtain a defect classification image. The defect classification image is then pixel-annotated to determine the defect annotation image. Pixels of each defect type are extracted from the defect annotation image to generate a defect pixel distribution map. The weld segmentation image is divided into uniform grids. An initial set of sub-regions is generated by combining the defect pixel distribution map. Pixels at the boundaries of the sub-regions are filtered to obtain an optimized set of sub-regions. Based on the optimized sub-region set, calculate the ratio of the number of defective pixels to the total number of pixels in each sub-region, determine the relationship between the ratio and a preset ratio threshold, obtain the classification sub-region set, and map the distribution of the classification sub-region set to a two-dimensional matrix to obtain the density distribution matrix. Based on the density distribution matrix, the proportional values are aggregated along the weld length and width directions respectively, and missing data points are filled by interpolation to obtain a continuous proportional value sequence. Based on the continuous proportional value sequence, a corresponding color gradient is assigned to the proportional value, and a defect distribution heatmap is obtained after image rendering. Specifically, the step of using a convolutional neural network to classify different defect types in the weld seam segmentation image to obtain a defect classification image, and then performing pixel annotation on the defect classification image to determine the defect annotation image, includes: Pixel smoothness features are extracted from the weld seam segmentation image, and a convolutional neural network is used to determine the defect regions of the weld seam segmentation image. The type of each defect region is output, and the defect regions are labeled accordingly to obtain the defect classification image. A pixel-level annotation method is used to annotate the regions of the corresponding defect type in the defect classification image, and the annotation boundaries are refined by combining the pixel smoothness feature to obtain the defect annotation image; The process involves pixel-level annotation to pinpoint the defect region in the defect classification image to each pixel, clarifying the boundary and extent of the defect. Refining the annotation boundaries eliminates boundary blurring or mislabeling during classification. Specifically, a preliminary pixel annotation mask is first generated based on the defect classification image. Then, the pixel smoothness features of the mask boundary pixels are extracted. For crack boundaries, pixels with a grayscale variance higher than 50 are retained, and low-variance pixel segments of the fracture are connected to make the crack boundary more continuous. The final defect annotation image accurately outlines the defect contour.
2. The intelligent identification and distribution visualization method for weld defects according to claim 1, characterized in that, The step of performing multi-scale feature extraction on the smoothed image to obtain a feature set, and then segmenting the feature set to obtain a weld seam segmentation image includes: Multi-scale feature extraction is performed on the smoothed image to obtain the texture features and edge features of the weld, which constitute the feature set. The feature set is segmented to divide the weld area and the background area, and the boundary position is determined to obtain an initial segmentation image; The ray field conditions for image acquisition are obtained, and the gray values of the initial segmented image are extracted. When the gray values exceed the preset gray value fluctuation range, the division of the weld area is adjusted in combination with the ray field conditions to obtain the weld segmentation image.
3. The intelligent identification and distribution visualization method for weld defects according to claim 1, characterized in that, The process involves extracting pixels for each defect type from the defect-annotated image to generate a defect pixel distribution map, uniformly dividing the weld segmentation image into a grid, generating an initial set of sub-regions based on the defect pixel distribution map, filtering the boundary pixels of the sub-regions, and obtaining an optimized set of sub-regions, including: Based on the defect-annotated image, obtain the pixel points corresponding to different defect types and generate the defect pixel distribution map; By calculating the width and height of the weld seam segmentation image, grid lines are evenly distributed to form a set of sub-blocks; The defective pixels in the defective pixel distribution map are traversed and assigned to each sub-block to form the initial sub-region set containing defective pixel information; For the initial sub-region set, the median filtering method is used to smooth the boundary pixels, and the boundary pixels whose defect pixel count ratio in the 8-neighborhood is lower than the preset density threshold are removed to obtain the optimized sub-region set.
4. The intelligent identification and distribution visualization method for weld defects according to claim 1, characterized in that, The process involves determining the relationship between the ratio value and a preset ratio threshold to obtain a set of classification sub-regions. The distribution of this set of classification sub-regions is then mapped onto a two-dimensional matrix to obtain a density distribution matrix, including: Determine whether the ratio value exceeds a preset ratio threshold. If yes, mark the corresponding sub-region as a high defect density sub-region; otherwise, mark the corresponding sub-region as a low defect density sub-region. The location information of the high defect density sub-region and the low defect density sub-region is projected into a two-dimensional matrix, and the high defect density sub-region is assigned a value of 1 and the low defect density sub-region is assigned a value of 0 to obtain the density distribution matrix.
5. The intelligent identification and distribution visualization method for weld defects according to claim 1, characterized in that, The step involves aggregating the proportional values along the weld length and width directions based on the density distribution matrix, and interpolating to fill in missing data points to obtain a continuous proportional value sequence, including: For the density distribution matrix, the proportional values are aggregated along the weld length direction using linear interpolation, and the missing data points are filled with the average value of adjacent points to obtain continuous density distribution data; Based on the continuous density distribution data, a set of proportional values along the weld width direction is obtained and divided into width segments. The average value of the set of proportional values in each width segment is calculated to obtain a sequence of proportional values in the width direction. For the width-direction ratio value sequence, cubic spline interpolation is performed on the missing data points to generate a continuous width-direction ratio value distribution, thus obtaining a continuous ratio value sequence.
6. The intelligent identification and distribution visualization method for weld defects according to claim 1, characterized in that, The step of assigning corresponding color gradients to the proportion values according to the continuous proportion value sequence, and obtaining a defect distribution heatmap after image rendering includes: According to the continuous ratio value sequence, if the ratio value is lower than the preset low density threshold, a blue mapping is assigned to the corresponding defect location; if the ratio value is higher than the preset high density threshold, a red mapping is assigned to the corresponding defect location, thus obtaining a color mapping sequence. Based on the color mapping sequence, the continuous ratio value sequence is converted into pixel colors and mapped onto a two-dimensional image grid to generate a defect distribution heatmap.
7. A smart system for identifying and visualizing the distribution of weld defects, characterized in that, The method for intelligent identification and distribution visualization of weld defects as described in any one of claims 1 to 6 includes: The image acquisition and processing module is used to acquire weld radiographic inspection images and perform noise reduction processing on the weld radiographic inspection images to obtain smooth images. The weld seam segmentation module is used to extract multi-scale features from the smooth image to obtain a feature set, and then segment the feature set to obtain a weld seam segmentation image. The defect classification module is used to classify different defect types using a convolutional neural network for the weld seam segmentation image to obtain a defect classification image, and to perform pixel annotation on the defect classification image to determine the defect annotation image. The sub-region division module is used to extract pixels of each defect type from the defect annotation image, generate a defect pixel distribution map, perform uniform grid division on the weld segmentation image, generate an initial sub-region set by combining the defect pixel distribution map, filter the sub-region boundary pixels, and obtain an optimized sub-region set. The density matrix construction module is used to calculate the ratio of the number of defective pixels to the total number of pixels in each sub-region based on the optimized sub-region set, determine the relationship between the ratio and a preset ratio threshold, obtain a classification sub-region set, and map the distribution of the classification sub-region set to a two-dimensional matrix to obtain a density distribution matrix. The proportional sequence generation module is used to aggregate the proportional values along the weld length and width directions respectively according to the density distribution matrix, and to interpolate and fill missing data points to obtain a continuous proportional value sequence. The heatmap generation module is used to assign a corresponding color gradient to the continuous proportional value sequence, and then perform image rendering to obtain a defect distribution heatmap.
Citation Information
Patent Citations
Mechanical welding gap defect identification method
CN120355701A
Vehicle surface defect identification method and system based on artificial intelligence
CN120411910A
