Weld defect recognition method and system based on visual detection

The weld defect identification method, which utilizes multi-angle view data processing, adaptive filtering, multi-layer scanning, and pixel calibration, solves the problem of high-precision automation in weld defect identification in existing technologies. It achieves accurate identification and type confirmation of minute weld defects, thereby improving identification accuracy and automation level.

CN121725305BActive Publication Date: 2026-04-17HUIZHOU TESTING INST OF GUANGDONG SPECIAL EQUIP TESTING INST +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUIZHOU TESTING INST OF GUANGDONG SPECIAL EQUIP TESTING INST
Filing Date
2026-02-26
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing weld defect identification methods are difficult to achieve high-precision automated identification in complex welding environments. They cannot adapt to the dynamic changes in welding arc light interference and environmental noise. Furthermore, manual annotation is inefficient, highly subjective, and difficult to accurately locate minute defects and complete type matching.

Method used

By acquiring the raw data of the weld from multiple angles, grayscale histogram analysis is performed to generate a ray mask. The filter window is dynamically adjusted for adaptive filtering. Weld features are extracted by combining multi-layer scanning and cluster analysis. Local region segmentation and pixel calibration are performed, and differentiated color labels are assigned. Finally, the defect type is confirmed by comparison with historical samples.

Benefits of technology

It effectively eliminates strong light and noise interference in weld seam images, accurately captures subtle texture features, improves the accuracy of identifying minute defects, provides a visual basis for defect types and distribution, and meets the stringent requirements of high-end equipment manufacturing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121725305B_ABST
    Figure CN121725305B_ABST
Patent Text Reader

Abstract

This invention relates to the field of visual inspection technology, and discloses a method and system for weld defect identification based on visual inspection. The method includes: acquiring raw data of the weld from multiple angles and preprocessing it to obtain an initial image; extracting weld edge and texture features through multi-layer scanning, segmenting and filtering abnormal areas to form a defect set; verifying boundary continuity and performing pixel calibration, classifying defects and assigning color labels; adjusting the label transparency and fusing it with the weld image, adapting the resolution to reach a clarity threshold; extracting composite features and comparing them with historical defect samples, confirming the defect type if the similarity meets the standard, and generating a weld defect identification report. This method can achieve high-precision automated identification of weld defects, meeting the stringent requirements for weld quality inspection in the high-end equipment manufacturing field.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of visual inspection technology, and in particular to a method and system for identifying weld defects based on visual inspection. Background Technology

[0002] Currently, in the field of visual inspection technology, with the continuous improvement of welding quality requirements in the manufacturing of high-end equipment such as aviation, automobiles, and ships, weld defect identification, as a key link in ensuring product structural safety and service life, is directly related to the reliability and market competitiveness of finished products. Visual defect detection of welds requires accurate capture of edge texture features in the weld area and isolation of environmental interference to achieve precise defect localization. The integration of high-resolution imaging, multi-layer convolutional feature extraction, and pixel registration technology has become the core technological direction for improving the accuracy and automation level of weld defect identification.

[0003] Existing weld defect identification methods in the industry mainly rely on single-vision imaging or manual assistance, such as removing image noise by fixing filter parameters, extracting weld contours using general edge detection operators, or relying on manual annotation to determine the defect type. However, this approach is clearly insufficient in complex welding environments. Fixed filtering cannot adapt to the dynamic changes in welding arc light interference and environmental noise, easily losing subtle weld texture features; general edge detection struggles to distinguish normal welding marks from defects such as microcracks and porosity; and manual annotation is inefficient, highly subjective, and prone to overlapping and confusion of annotations for multiple defect areas, especially in complex weld structures, making it difficult to accurately locate subtle defects and complete type matching.

[0004] In summary, existing technologies are insufficient to achieve high-precision automated identification of weld defects, and cannot meet the stringent requirements for weld quality inspection in the high-end equipment manufacturing sector. Summary of the Invention

[0005] This invention provides a method and system for weld defect identification based on visual inspection, so as to achieve high-precision automated identification of weld defects and meet the stringent requirements for weld quality inspection in the field of high-end equipment manufacturing.

[0006] In a first aspect, to address the aforementioned technical problems, the present invention provides a method for weld defect identification based on visual inspection, comprising:

[0007] The raw data of the weld seam from multiple angles is obtained, and the raw data is preprocessed to obtain the initial image data.

[0008] The initial image data is scanned in multiple layers. Weld features are extracted from the scan results and integrated to obtain feature image data.

[0009] Based on the feature image data, local region segmentation is performed and feature distribution information of each region is extracted. The feature distribution information is compared with a preset feature significance threshold, and regions that meet the abnormal pattern are selected to obtain a set of defective regions.

[0010] Anomalies are extracted from the defect region set as candidate boundaries. The continuity of the candidate boundaries is determined to be greater than a preset boundary continuity threshold. If it is greater, the boundary is retained; otherwise, it is discarded. The retained boundaries are then pixel-calibrated to obtain accurate image data.

[0011] Based on the precise image data, the abnormal areas are first classified into defect types, then color labels are assigned to different defect types, and the distinguishability of the color labels between multiple defect areas is calculated and determined to be whether it exceeds a preset distinguishability threshold. If it exceeds the threshold, the color labels are retained; if it does not exceed the threshold, they are reassigned to obtain labeled image data.

[0012] Based on the labeled image data, the color label is fused with the overall image of the weld, and then the resolution of the fused image is adapted. The display clarity of the image is calculated and judged to see if it exceeds the preset clarity adaptation threshold. If it exceeds the threshold, it is retained; if it does not exceed the threshold, it is re-adapted to obtain the adapted image.

[0013] Extract the composite feature formed by combining the color annotation and the weld feature from the adapted image, calculate the similarity between the composite feature and the pre-acquired historical defect samples, and if the similarity exceeds the preset sample similarity threshold, confirm the defect type and generate a weld defect identification report.

[0014] In an optional implementation, the step of acquiring the raw data of multi-angle views of the weld and preprocessing the raw data to obtain initial image data includes:

[0015] Obtain raw data for multi-angle views of the weld;

[0016] The original data is subjected to grayscale histogram analysis to determine the light interference peak. If the light interference peak exceeds the preset light interference judgment threshold, a light mask is generated to mark and isolate the strong light interference area in the image, and a light interference-free image is obtained.

[0017] Calculate the noise variance of a local region in the light-dissipated image, dynamically adjust the size of the filtering window based on the noise variance, perform adaptive filtering for environmental noise, and obtain single-angle filtered data.

[0018] The single-angle filtered data from each angle are image registered and then fused to obtain the initial image data.

[0019] In an optional implementation, the step of performing multi-layer scanning on the initial image data, extracting weld features from the scanning results, and integrating the weld features to obtain feature image data includes:

[0020] The initial image data is subjected to multi-layer progressive scanning. After each layer is scanned, a corresponding scale response map is output. All the scale response maps are integrated to obtain preliminary response data.

[0021] The weld region boundary is extracted from the preliminary response data and the boundary gradient value is calculated as the boundary strength. The weld region boundary where the boundary strength exceeds the preset boundary strength threshold is retained to obtain the weld edge data.

[0022] Calculate the gradient change of the weld edge data. If the gradient change exceeds a preset gradient change threshold, extract and integrate the regional texture details to obtain texture feature data.

[0023] Cluster analysis is performed on the initial image data to identify background interference regions, and then a positioning mask is generated for the background interference regions.

[0024] The weld edge data and the texture feature data are superimposed and fused, and the invalid information of the background interference area is removed by the positioning mask to obtain feature image data.

[0025] In an optional implementation, the step of performing local region segmentation and extracting feature distribution information of each region based on the feature image data, comparing the feature distribution information with a preset feature significance threshold, and filtering out regions that conform to the abnormal pattern to obtain a defect region set includes:

[0026] The feature image data is segmented locally to generate a subset of weld seam regions;

[0027] The grayscale and texture feature distribution information of each region in the weld region subset is extracted to obtain region feature data;

[0028] The region feature data is compared with a preset feature significance threshold to filter out regions with high significance features;

[0029] The highly significant feature regions are matched with preset defect anomaly patterns, and the regions that are successfully matched are included in the defect region set.

[0030] In an optional implementation, the step of extracting abnormal regions from the defect region set as candidate boundaries, determining whether the continuity of the candidate boundaries exceeds a preset boundary continuity threshold, retaining them if it exceeds the threshold and discarding them if it does not, and then performing pixel calibration on the retained boundaries to obtain accurate image data, includes:

[0031] Extract the edges of abnormal regions within the defect region set as candidate boundaries;

[0032] Perform contour refinement processing on the candidate boundaries, calculate the boundary continuity and compare it with a preset boundary continuity threshold. If the continuity exceeds the threshold, the corresponding candidate boundary is retained; otherwise, it is discarded.

[0033] The retained candidate boundaries are calibrated at the pixel level. When the deviation between the calibrated candidate boundaries and the preset standard defect boundary template is lower than the preset calibration deviation threshold, the calibration process is completed and accurate image data is obtained.

[0034] In an optional implementation, based on the precise image data, the abnormal regions are first classified into defect types, then color labels are assigned to different defect types. The distinguishability of the color labels among multiple defect regions is calculated and determined to be whether it exceeds a preset distinguishability threshold. If it exceeds, the color labels are retained; otherwise, they are reassigned to obtain labeled image data, including:

[0035] Based on the precise image data, the defect types are classified according to the characteristics of the abnormal regions, and then the defect regions are uniquely encoded according to their types to generate a defect code set.

[0036] Differentiated color labels are assigned to different codes in the defect code set;

[0037] Calculate the distinguishability of the color labels among multiple defective regions. If the distinguishability exceeds a preset distinguishability threshold, retain the corresponding color label to obtain labeled image data.

[0038] In an optional implementation, the step of fusing the color annotations with the overall weld image based on the annotated image data, then performing resolution adaptation on the fused image, calculating and determining whether the image's display clarity exceeds a preset clarity adaptation threshold, retaining the image if it exceeds the threshold, and re-adapting it if it does not exceed the threshold to obtain an adapted image, includes:

[0039] Based on the labeled image data, adjust the transparency of the color label overlay layer and blend it with the overall weld image;

[0040] The merged image is subjected to resolution adaptation processing. After the processing is completed, the display sharpness is calculated and compared with the preset sharpness adaptation threshold. If the display sharpness exceeds the sharpness adaptation threshold, the corresponding image is retained. If it does not exceed the threshold, it is re-adapted to obtain the adapted image.

[0041] In an optional implementation, a composite feature formed by combining the color annotation and the weld feature is extracted from the adapted image. The similarity between the composite feature and pre-acquired historical defect samples is calculated. If the similarity exceeds a preset sample similarity threshold, the defect type is confirmed, and a weld defect identification report is generated, including:

[0042] Extract the composite features formed by fusing the color annotations in the adapted image with the overall weld image;

[0043] The composite features are compared with the features of pre-acquired historical defect samples to calculate the feature similarity.

[0044] If the feature similarity exceeds a preset sample similarity threshold, the defect type is confirmed, and the defect type, location, and size information are integrated to generate the weld defect identification report.

[0045] Secondly, the present invention provides a weld defect identification system based on visual inspection, comprising:

[0046] The data acquisition module is used to acquire the raw data of the weld from multiple angles, and to preprocess the raw data to obtain the initial image data.

[0047] The feature extraction module is used to perform multi-layer scanning on the initial image data, extract weld features from the scanning results, and integrate the weld features to obtain feature image data.

[0048] The defect screening module is used to perform local region segmentation based on the feature image data and extract the feature distribution information of each region, compare the feature distribution information with a preset feature significance threshold, and screen out regions that meet the abnormal pattern to obtain a set of defect regions.

[0049] The boundary calibration module is used to extract abnormal regions from the defect region set as candidate boundaries, determine whether the continuity of the candidate boundaries exceeds a preset boundary continuity threshold, retain them if it exceeds the threshold, and discard them if it does not exceed the threshold. Then, pixel calibration is performed on the retained boundaries to obtain accurate image data.

[0050] The annotation module is used to classify the abnormal areas into defect types based on the accurate image data, assign color annotations to different defect types, calculate and determine whether the distinguishability of the color annotations between multiple defect areas exceeds a preset distinguishability threshold. If it exceeds the threshold, the color annotations are retained; if it does not exceed the threshold, they are reassigned to obtain annotated image data.

[0051] The fusion and adaptation module is used to fuse the color annotation with the overall image of the weld seam according to the annotation image data, and then perform resolution adaptation on the fused image, calculate and determine whether the display clarity of the image exceeds the preset clarity adaptation threshold. If it exceeds the threshold, it is retained; if it does not exceed the threshold, it is re-adapted to obtain the adapted image.

[0052] The report generation module is used to extract the composite features formed by combining the color annotation and the weld features from the adapted image, calculate the similarity between the composite features and the pre-acquired historical defect samples, and if the similarity exceeds a preset sample similarity threshold, confirm the defect type and generate a weld defect identification report.

[0053] Compared with the prior art, the present invention has the following beneficial effects:

[0054] (1) This invention obtains the original data of the weld from multiple angle views, generates a light mask to isolate strong light interference through grayscale histogram analysis, calculates the local noise variance to dynamically adjust the filtering window to complete adaptive filtering, and then registers and fuses the data from each angle to obtain the initial image data. This invention breaks through the limitation that traditional fixed filtering parameters cannot adapt to the dynamic changes of welding arc light and environmental noise, explores the complete morphological features of the weld from multiple angle views, eliminates the interference of strong light and random noise on the image, provides high-precision basic data support for weld defect identification, effectively improves the retention rate of the weld's fine texture features, and solves the problem that fixed filtering easily loses key details of the weld.

[0055] (2) This invention performs multi-layer progressive scanning to integrate the scale response map of the initial image data, extracts the weld edge and calculates the boundary strength, captures the subtle changes on the surface by combining texture gradient analysis, generates a positioning mask through cluster analysis to remove background interference, and then filters the highly significant defect areas after obtaining the feature image data. This invention breaks through the limitation of general edge detection in distinguishing between normal welding traces and minor defects, accurately captures the abnormal features of weld edge contour and surface texture, provides multi-dimensional basis for defect judgment, significantly improves the accuracy of identifying defects such as microcracks and porosity, and makes up for the shortcomings of existing technologies in missing the detection of minor weld defects.

[0056] (3) This invention performs pixel calibration on the boundary of the defect area, assigns differentiated color labels to different defect types and ensures distinguishability, integrates and adapts the labels with the weld image, compares them with historical samples to confirm the type, and then performs pixel-level secondary verification to calibrate the label deviation and generate a complete document. It breaks through the limitations of traditional manual labeling, which is inefficient and prone to overlap and confusion in labeling multiple defect areas. It provides quality inspectors with a visual basis for accurate defect type, location and distribution, solves the problems of confusion in the judgment of multiple defect areas and strong subjectivity in manual inspection, and balances the automation of identification and the accuracy of detection, meeting the stringent requirements of weld quality inspection in the field of high-end equipment manufacturing. Attached Figure Description

[0057] Figure 1 This is a schematic diagram of the weld defect identification method based on visual inspection provided in the first embodiment of the present invention;

[0058] Figure 2 This is a schematic diagram of the structure of a weld defect identification system based on visual inspection provided in the second embodiment of the present invention. Detailed Implementation

[0059] 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.

[0060] Reference Figure 1 The first embodiment of the present invention provides a method for weld defect identification based on visual inspection, including the following steps:

[0061] S101, Obtain the original data of the multi-angle view of the weld, and preprocess the original data to obtain the initial image data;

[0062] S102, perform multi-layer scanning on the initial image data, extract weld features from the scanning results, and integrate the weld features to obtain feature image data;

[0063] S103, based on the feature image data, perform local region segmentation and extract feature distribution information of each region, compare the feature distribution information with a preset feature significance threshold, filter out regions that meet the abnormal pattern, and obtain a set of defective regions.

[0064] S104, extract abnormal regions from the defect region set as candidate boundaries, determine whether the continuity of the candidate boundaries exceeds a preset boundary continuity threshold, retain them if it exceeds the threshold, and discard them if it does not exceed the threshold. Then perform pixel calibration on the retained boundaries to obtain accurate image data.

[0065] S105. Based on the accurate image data, the abnormal area is first classified into defect types, then color labels are assigned to different defect types, and the distinguishability of the color labels between multiple defect areas is calculated and determined to be whether the distinguishability threshold is exceeded. If it is exceeded, the color labels are retained; if it is not exceeded, they are reassigned to obtain labeled image data.

[0066] S106. Based on the labeled image data, the color label is fused with the overall image of the weld, and then the resolution of the fused image is adapted. The display clarity of the image is calculated and determined to be higher than the preset clarity adaptation threshold. If it is higher, it is retained; if it is not higher, it is re-adapted to obtain the adapted image.

[0067] S107, extract the composite feature formed by combining the color annotation and the weld feature from the adapted image, calculate the similarity between the composite feature and the pre-acquired historical defect samples, and if the similarity exceeds the preset sample similarity threshold, confirm the defect type and generate a weld defect identification report.

[0068] In step S101, the process of acquiring the raw data of the multi-angle view of the weld and preprocessing the raw data to obtain initial image data includes:

[0069] Obtain raw data for multi-angle views of the weld;

[0070] The original data is subjected to grayscale histogram analysis to determine the light interference peak. If the light interference peak exceeds the preset light interference judgment threshold, a light mask is generated to mark and isolate the strong light interference area in the image, and a light interference-free image is obtained.

[0071] Calculate the noise variance of a local region in the light-dissipated image, dynamically adjust the size of the filtering window based on the noise variance, perform adaptive filtering for environmental noise, and obtain single-angle filtered data.

[0072] The single-angle filtered data from each angle are image registered and then fused to obtain the initial image data.

[0073] It should be noted that, firstly, when acquiring the raw multi-angle view data of the weld, five industrial CCD cameras with a resolution of 2048×1536 pixels were deployed around the welding station at a frame rate of 30fps, arranged in a ring at five core angles: 0°, 45°, 90°, 135°, and 180°, to ensure comprehensive capture of the weld's three-dimensional morphology. During the acquisition process, operating parameters such as welding current and arc voltage were recorded simultaneously, providing support for subsequent data correlation analysis. After multiple batches of testing with different weld structures, this acquisition method demonstrated no blind spots and could completely cover the key areas of the weld. For example, at the automotive chassis welding station, the five CCD cameras captured images in real time, successfully obtaining complete raw view data of the front, side, and back of the weld.

[0074] Secondly, when generating the light mask by performing grayscale histogram analysis on the original data, a grayscale histogram peak detection algorithm is used to statistically analyze the pixel ratio of each grayscale level and identify abnormally high grayscale value areas caused by arc light. The light interference judgment threshold is based on the statistical data of arc light interference under different welding materials and welding currents over the past year, combined with the industrial weld seam inspection image quality standards, and a basic threshold of 220 is set. This threshold can be adjusted according to the material; it is lowered to 200 for aluminum alloy welding scenarios and raised to 230 for carbon steel welding scenarios. If the light interference peak exceeds the threshold, a mask is generated through binarization processing to isolate the strong light area, resulting in a light interference-free image. For example, if the grayscale histogram of a certain stainless steel weld seam's original image shows an abnormal peak at grayscale level 230, exceeding the basic threshold, the system generates a light mask to effectively isolate arc light interference, resulting in a clear light interference-free image.

[0075] Next, when calculating the local noise variance in the de-lighting image and performing adaptive filtering, an adaptive Gaussian filtering technique is used. An initial 3×3 pixel window is used, and the noise variance of a 5×5 local region is calculated: if the variance is greater than 50, the window is expanded to 5×5 pixels; if the variance is less than 20, it is reduced to 2×2 pixels to accurately match the noise distribution. The filtering effect is judged based on the residual noise level. The basic threshold is set at a pixel percentage ≤ 0.5%, which can be adjusted according to the detection accuracy. For aerospace weld detection, this threshold is lowered to 0.3%, and for ordinary engineering machinery weld detection, it is raised to 0.8%. Once the threshold is met, single-angle filtered data is obtained. For example, a de-lighting image of a weld has random noise due to workshop dust, with a local noise variance of 60. After adjusting the filtering window to 5×5 pixels, the residual noise level drops to 0.4%, meeting the requirement, and single-angle filtered data is obtained.

[0076] Finally, when performing image registration and fusion on the single-angle filtered data from each angle, registration employs SIFT feature matching combined with affine transformation technology to extract weld feature points from each angle image. Coordinate calibration is completed through feature point matching to ensure weld alignment. Fusion uses a weighted average algorithm, with the weights for the 0° and 90° main viewpoints each set to 0.3, the weights for the 45° and 135° viewpoints each set to 0.15, and the weight for the 180° viewpoint set to 0.1, with the total weights being 1 to highlight core viewpoint information. Multiple registration and fusion tests have shown that this method can eliminate angular deviations, resulting in a high degree of weld contour integrity in the fused image. For example, after SIFT feature registration of the filtered data from five angles, weighted fusion yields a complete initial image with no misalignment or missing weld bead or other structural features.

[0077] In step S102, the initial image data is subjected to multi-layer scanning, weld features are extracted from the scanning results, and the weld features are integrated to obtain feature image data, including:

[0078] The initial image data is subjected to multi-layer progressive scanning. After each layer is scanned, a corresponding scale response map is output. All the scale response maps are integrated to obtain preliminary response data.

[0079] The weld region boundary is extracted from the preliminary response data and the boundary gradient value is calculated as the boundary strength. The weld region boundary where the boundary strength exceeds the preset boundary strength threshold is retained to obtain the weld edge data.

[0080] Calculate the gradient change of the weld edge data. If the gradient change exceeds a preset gradient change threshold, extract and integrate the regional texture details to obtain texture feature data.

[0081] Cluster analysis is performed on the initial image data to identify background interference regions, and then a positioning mask is generated for the background interference regions.

[0082] The weld edge data and the texture feature data are superimposed and fused, and the invalid information of the background interference area is removed by the positioning mask to obtain feature image data.

[0083] It should be noted that, firstly, when performing multi-layer progressive scanning on the initial image data and integrating the scale response maps, a multi-layer convolutional kernel scanning technique is employed. The convolutional kernels are designed with progressively larger sizes: the first layer (3×3 pixels) captures fine textures, the second layer (5×5 pixels) extracts medium-sized structures, and the third layer (7×7 pixels) covers the overall contour. Scanning is performed sequentially from top to bottom and left to right, with each layer outputting a corresponding scale response map. The three response maps are then integrated using channel stitching technology to obtain preliminary response data. This scanning method is designed based on the multi-scale feature distribution patterns of welds and, after multiple batches of testing, can completely extract features from microscopic to macroscopic levels. For example, in scanning the weld seam of an aero-engine blade, after the three convolutional kernels are applied sequentially, the preliminary response data clearly presents the crystalline texture and bevel contour of the weld seam.

[0084] Next, when extracting the weld area boundary and calculating the boundary strength from the preliminary response data, the Sobel edge detection operator is used. The gradient values ​​in the horizontal and vertical directions are calculated, and the gradient magnitude is used as the boundary strength. The boundary strength threshold is set to a base threshold of 120 (gradient value range 0-255) based on the boundary gradient statistics of welds of different materials over the past year, combined with industrial weld inspection contour recognition standards. This threshold can be adjusted according to the scenario; it is raised to 130 for high-precision scenarios such as aviation, and lowered to 110 for ordinary engineering machinery scenarios. Boundaries exceeding the threshold are retained as weld edge data. For example, in the preliminary response data of a carbon steel weld, the boundary strength of the bevel area is 135, exceeding the base threshold, and is therefore fully included in the weld edge data.

[0085] Subsequently, when calculating the gradient change of the weld edge data and extracting texture feature data, the gradient change is defined as the difference between the maximum and minimum gradient amplitudes within a 3×3 local region. The gradient change threshold is set based on the statistical differences in texture between normal and defective welds. For normal welds, the gradient change is mostly concentrated below 30, so the base threshold is set to 40, lowered to 35 for high-precision scenarios, and raised to 45 for regular scenarios. If the threshold is exceeded, texture details such as contrast and entropy are extracted using the gray-level co-occurrence matrix and integrated into texture feature data. For example, in the center region of a weld bead in aluminum alloy weld edge data, the gradient change is 45, exceeding the base threshold; therefore, the system extracts its texture details and forms texture feature data.

[0086] When performing cluster analysis on the initial image data to identify background interference regions and generate a positioning mask, the image pixel grayscale values ​​are first normalized using a min-max method, mapping them to the 0-1 range to eliminate dimensional differences. The K-means clustering algorithm is used, with K determined to be 3 using the elbow rule, corresponding to three types of regions: weld body, effective background, and interfering background. Initial cluster centers are randomly selected from each of the grayscale ranges of 0-0.3, 0.4-0.7, and 0.8-1.0, iteratively updated until the center change is ≤0.001 or after 20 iterations. After clustering, the texture entropy of each cluster region is calculated. The texture entropy threshold of 0.8 is set based on the statistical analysis of texture features of normal welds and background interference regions over the past year. Regions with a grayscale mean of 0-0.3 or 0.8-1.0 and a texture entropy below 0.8 are identified as interference regions, and a binarized positioning mask is generated. For example, in an image of a ship weld, the grayscale mean of the reflective area of ​​the fixture is 0.85 and the texture entropy is 0.6, which is lower than the threshold of 0.8. After clustering, it is determined to be an interference area, and the positioning mask accurately marks this area.

[0087] Finally, when overlaying and fusing weld edge data and texture feature data, and combining this with a positioning mask to remove interference, the dimensionality of the two types of data is first unified. The weld edge data is a single-channel binary feature map, containing only boundary contour information, with boundary pixels having a value of 1 and non-boundary pixels having a value of 0. The texture feature data is a 4-channel feature map, containing four texture indices: contrast, entropy, correlation, and uniformity. The two are integrated into a 5-channel feature map using channel stitching technology to ensure dimensionality consistency. Then, a weighted fusion technique is used, with a single-channel weight of 0.6 for the weld edge data and each of the four channels for the texture feature data assigned a weight of 0.1, with the total weights summing to 1. Each pixel in the 5-channel feature map is weighted and summed according to its corresponding weight to obtain the fused feature map. Through mask multiplication, the pixel values ​​corresponding to interference areas are set to 0, eliminating invalid information, and finally, the feature image data is obtained. This fusion method has been tested against various complex backgrounds and can effectively preserve weld defect features. In practical applications, the defect feature retention rate meets industrial inspection standards. For example, the edge data of a weld seam in a certain engineering machinery is a single-channel binary image, with the crack boundary pixel value being 1. The four channels of the texture feature data are contrast 120, entropy 1.9, correlation 0.7, and uniformity 0.6, respectively. After being stitched together into a 5-channel feature image, it is fused according to weights and then multiplied with a binary mask marking workshop debris. The pixel value of the debris area is set to 0. In the feature image, the crack outline and texture details of the weld seam are clear and unobstructed.

[0088] In step S103, based on the feature image data, local region segmentation is performed and feature distribution information of each region is extracted. The feature distribution information is compared with a preset feature significance threshold to filter out regions that conform to the abnormal pattern, thus obtaining a defect region set, including:

[0089] The feature image data is segmented locally to generate a subset of weld seam regions;

[0090] The grayscale and texture feature distribution information of each region in the weld region subset is extracted to obtain region feature data;

[0091] The region feature data is compared with a preset feature significance threshold to filter out regions with high significance features;

[0092] The highly significant feature regions are matched with preset defect anomaly patterns, and the regions that are successfully matched are included in the defect region set.

[0093] It should be noted that, firstly, when performing local region segmentation on the feature image data to generate weld region subsets, a watershed segmentation algorithm is employed. Before execution, morphological gradient operations are used to enhance the differences in region boundaries. Then, the core weld region is marked as the foreground and the non-weld region as the background, avoiding the over-segmentation problem of traditional algorithms. The segmentation process traverses the image from top to bottom and from left to right, dividing independent regions based on differences in grayscale values, with each region corresponding to a weld sub-region. This algorithm has been tested on multiple batches of different weld structures, and the segmentation results show a high degree of consistency with the actual weld regions. For example, in the feature image of an aero-engine blade weld, after processing with the watershed algorithm, the weld bead and heat-affected zone of the weld are accurately divided, generating a weld region subset containing multiple independent sub-regions.

[0094] Next, when extracting grayscale and texture feature distribution information from the weld seam region subset to obtain regional feature data, grayscale features are extracted by calculating the grayscale mean, variance, and skewness of pixels within the region. Texture features are extracted using grayscale co-occurrence matrix (GLCM) technology, with a step size of 1 pixel and four dimensions of 0°, 45°, 90°, and 135°, calculating four core indicators: contrast, entropy, correlation, and uniformity. Grayscale and texture features are then concatenated dimensionally to form complete regional feature data. This extraction method comprehensively covers the grayscale and texture representation of defects, and tests have shown excellent feature capture performance for minute defects. For example, in a region subset of a ship weld seam, a suspected defect region has a grayscale variance of 42, a contrast of 68, and an entropy of 1.9; these feature data are completely extracted and integrated into regional feature data.

[0095] Secondly, when comparing regional feature data with preset feature significance thresholds to screen for highly significant feature regions, the feature significance thresholds are set based on the feature statistics of normal and defective welds over the past year, with a base threshold of 30 for grayscale variance, 50 for contrast, and 1.5 for entropy. These thresholds can be adjusted according to the welding material; for aluminum alloy welds, the contrast threshold can be lowered to 45, while for carbon steel welds it can be raised to 55. If any item in the regional feature data exceeds the corresponding threshold, it is determined to be a highly significant feature region. Multiple verifications have shown that this threshold setting effectively screens suspected defective regions with a low false positive rate. For example, in the regional feature data of a certain carbon steel weld, the contrast is 56 and the entropy is 1.7, both exceeding the base thresholds; this region is therefore included in the highly significant feature region category.

[0096] Finally, highly significant feature regions are matched with preset defect anomaly patterns. Successfully matched regions are included in the defect region set. The defect anomaly pattern library is constructed based on historical defect samples from different welding conditions over the past three years, including feature patterns for three types of defects: cracks, porosity, and slag inclusions. Each pattern corresponds to a specific feature interval. The matching uses a cosine similarity algorithm. First, the features of highly significant regions and pattern features are normalized using a min-max method to eliminate dimensional differences before calculating the similarity. The basic similarity threshold is set at 0.78. This threshold is determined based on statistical analysis of over 12,000 defect matching cases from different welding materials and conditions over the past three years, combined with the need to balance correct matching rate and false positive rate in industrial inspection. This threshold corresponds to a 97% correct matching rate and a false positive rate within 3%, and supports scenario-based adjustments. For high-precision inspection scenarios, it can be increased to 0.82 (corresponding to a 99% correct matching rate), while for regular scenarios, it can be decreased to 0.75 (corresponding to a 95% correct matching rate). A similarity exceeding the threshold is considered a successful match. For example, the high-significance region of a carbon steel weld has a similarity of 0.81 with the crack anomaly pattern, which exceeds the basic threshold of 0.78, and the region is successfully included in the defect region set; the high-significance region of another aluminum alloy weld has a similarity of 0.76 with the porosity pattern, which meets the down-adjustment threshold of 0.75 in a conventional inspection scenario, and the match is also successful.

[0097] In step S104, the abnormal regions extracted from the defect region set are used as candidate boundaries. It is then determined whether the continuity of the candidate boundaries exceeds a preset boundary continuity threshold. If it does, the candidate boundaries are retained; otherwise, they are discarded. Finally, pixel calibration is performed on the retained boundaries to obtain accurate image data, including:

[0098] Extract the edges of abnormal regions within the defect region set as candidate boundaries;

[0099] Perform contour refinement processing on the candidate boundaries, calculate the boundary continuity and compare it with a preset boundary continuity threshold. If the continuity exceeds the threshold, the corresponding candidate boundary is retained; otherwise, it is discarded.

[0100] The retained candidate boundaries are calibrated at the pixel level. When the deviation between the calibrated candidate boundaries and the preset standard defect boundary template is lower than the preset calibration deviation threshold, the calibration process is completed and accurate image data is obtained.

[0101] It should be noted that, firstly, when extracting the edges of abnormal regions within the defect region set as candidate boundaries, the Sobel edge detection operator is used. Before extraction, the image of the defect region set is first subjected to grayscale enhancement processing to improve the contrast between the edges and the background. Then, by calculating the gradient values ​​in the horizontal and vertical directions, the grayscale abrupt changes between the abnormal region and the surrounding normal region are captured, generating initial edge contours as candidate boundaries. After multiple batches of testing with different defect types, this operator can accurately extract the edges of defects such as cracks and porosity without significant omissions. For example, in the defect region set of ship deck welds, the Sobel operator successfully extracted the irregular edges of slag inclusion defects, forming clear candidate boundaries.

[0102] Next, when performing contour refinement processing and calculating boundary continuity for candidate boundaries, the Zhang-Suen morphological refinement algorithm is used. This algorithm achieves boundary refinement through two rounds of alternating iterations. In the first round, it traverses the boundary pixels and deletes pixels that meet the conditions of "having 3-7 foreground pixels in 8 neighborhoods, no isolated pixels, and maintaining boundary connectivity". In the second round, the same judgment logic is used, only adjusting the neighborhood judgment order to avoid over-refinement. Boundary connectivity is checked in real time during the iteration process until no pixels can be deleted in two consecutive rounds. While preserving boundary connectivity, the multi-pixel width boundary is refined to a single-pixel width to eliminate redundant pixels. Boundary continuity is calculated as the proportion of continuous boundary pixels to the total number of boundary pixels. The boundary continuity threshold is set based on the boundary morphology statistics of different types of weld defects in the past year, with a base threshold of 85%. This threshold can be adjusted according to the defect type. Crack defects, whose boundaries are mostly continuous lines, can be lowered to 80%, while porosity defects, whose boundaries are ring-shaped, can be raised to 90%. Candidate boundaries exceeding the threshold are retained, while those below the threshold are discarded. For example, after refining the candidate boundary of a carbon steel weld crack defect, the proportion of continuous boundary pixels reached 88%, which exceeded the 80% threshold for cracks, so the boundary was retained; another porosity defect boundary had a continuity of 88%, which did not reach the 90% threshold for porosity, so it was removed.

[0103] Finally, when performing pixel-level coordinate calibration and judging calibration deviation on the retained candidate boundaries, affine transformation registration technology is used. First, corner points on the boundary are selected as feature control points. These control points are then matched with the corresponding control points of the standard defect boundary template. Coordinate calibration is completed by calculating translation, rotation, and scaling transformation matrices. The standard defect boundary template is constructed based on historical defect samples from different welding materials and working conditions over the past three years, covering typical boundary morphologies of three core defects: cracks, porosity, and slag inclusions. Samples are collected from welding scenarios in multiple fields such as aviation, automotive, and shipbuilding. After image preprocessing to remove noise interference, Sobel operator extraction of accurate boundaries, and min-max normalization to unify dimensions, the boundary accuracy is verified by at least three senior welding quality inspection experts. Samples with deviations exceeding one pixel are removed. Then, cluster analysis is used to integrate the common boundary features of similar defects to form a standardized template library, supporting rapid access by defect type and welding material. The calibration deviation threshold is set based on the pixel positioning accuracy requirements of industrial weld inspection. The basic threshold is 3 pixels, which can be lowered to 2 pixels for high-precision aerospace weld inspection scenarios and raised to 4 pixels for ordinary engineering machinery weld scenarios. If the deviation value after calibration is lower than this threshold, the calibration process is completed, and accurate image data is obtained. For example, the registration deviation of the preserved boundary of a weld defect on an aero-engine blade, after affine transformation calibration, is 2 pixels, which is lower than the basic threshold of 3 pixels. The final accurate image data clearly shows the precise location and range of the defect.

[0104] In step S105, based on the precise image data, the abnormal regions are first classified into defect types, then color labels are assigned to different defect types. The distinguishability of the color labels among multiple defect regions is calculated and determined to be whether it exceeds a preset distinguishability threshold. If it exceeds, the color labels are retained; otherwise, they are reassigned to obtain labeled image data, including:

[0105] Based on the precise image data, the defect types are classified according to the characteristics of the abnormal regions, and then the defect regions are uniquely encoded according to their types to generate a defect code set.

[0106] Differentiated color labels are assigned to different codes in the defect code set;

[0107] Calculate the distinguishability of the color labels among multiple defective regions. If the distinguishability exceeds a preset distinguishability threshold, retain the corresponding color label to obtain labeled image data.

[0108] It should be noted that, firstly, when classifying and encoding defect types based on regional features using accurate image data, a Support Vector Machine (SVM) algorithm is employed for classification. This algorithm achieves category division by finding the optimal hyperplane in a high-dimensional feature space and uses a Radial Basis Function (RBF) kernel function to map low-dimensional defect features to a high-dimensional space, effectively handling the nonlinear feature differences among cracks, porosity, and slag inclusions. The training process is based on over 15,000 weld defect samples from the aerospace, automotive, and shipbuilding industries over the past three years. These samples cover different welding materials, working conditions, and defect morphologies. After min-max normalization preprocessing, the samples are divided into training and testing sets in a 7:3 ratio. The penalty parameter C=10 and the kernel function parameter σ=0.1 are optimized using a grid search method. The final model's accuracy on the testing set meets industrial inspection standards. After classification, unique codes are generated according to industrial weld defect classification standards: cracks correspond to 001, porosity to 002, and slag inclusions to 003. The coding system can be expanded to accommodate new defect types and adapt to special welding conditions. After testing multiple batches of defect samples, the type matching accuracy of this classification coding method meets the requirements of industrial inspection. For example, in a precise image of a weld seam on an aerospace component, the support vector machine identified two cracks and one slag inclusion, generating corresponding defect code sets 001, 001, and 003.

[0109] Next, when assigning differentiated color labels to different codes in the defect coding set, the HSV color space was used for adjustment, with different codes corresponding to fixed hue ranges. Code 001 (crack) corresponds to a red hue of 0°, code 002 (porosity) corresponds to a blue hue of 240°, and code 003 (slag inclusion) corresponds to a green hue of 120°. A fixed saturation of 70% and a brightness of 80% ensure color distinctiveness. The red, blue, and green hues are spaced 120° apart to avoid visual confusion. If there is overlap in the labeled areas, priority is set according to the defect risk level: cracks have a higher priority than slag inclusions, and slag inclusions have a higher priority than porosity. The overlapping areas retain the color of the higher-priority defect. For example, in an image of a carbon steel weld, the crack and slag inclusion labeled areas partially overlap. The crack is labeled in red according to priority, while only a light green slag inclusion label is added at the edge to avoid confusion.

[0110] Finally, when calculating the distinguishability of color annotations among multiple defect areas and comparing it with a preset threshold, the distinguishability is calculated using the CIEDE2000 color difference formula, which accurately quantifies the degree of human eye's perception of color differences. The distinguishability threshold is set based on human visual recognition ability and historical annotation data, with a base threshold of 50 (CIEDE2000 value range 0-100). This threshold can be adjusted according to the display scenario, increasing to 55 for low-resolution devices and decreasing to 45 for high-resolution professional inspection scenarios. If the distinguishability does not exceed the corresponding threshold, a strategy of adjusting the color tone of low-priority defects clockwise in 10° steps is adopted for optimization: prioritizing the adjustment of defect colors with lower risk levels, without changing the colors of high-priority defects (cracks > inclusions > pores); avoiding the ±10° range of already assigned color tones (i.e., 0°, 120°, 240° and their surrounding range) during adjustment to avoid visual confusion with other defect colors; recalculating the distinguishability after each adjustment until the distinguishability of all adjacent defect colors meets the standard. If the distinguishability exceeds the corresponding threshold, the color annotation is retained, and the final annotated image data is obtained. For example, the blue marking for pores and the green marking for slag inclusions on a ship weld had a discrimination index of 52, exceeding the basic threshold of 50, so the color markings were retained. In another case, the red marking for cracks (0°) and the blue marking for pores (240°) had a discrimination index of 43. By adjusting the lower priority pore color to 230° clockwise in 10° increments to avoid the area around 240°, the discrimination index was recalculated and increased to 51, successfully meeting the requirement. As another example, the green marking for slag inclusions (120°) and the blue marking for pores (240°) had a discrimination index of 46. After adjusting the pore color to 250°, the discrimination index reached 53, meeting the requirement.

[0111] In step S106, based on the labeled image data, the color annotations are fused with the overall weld image. Then, the fused image undergoes resolution adaptation. The resolution of the image is calculated and determined to determine whether the image's display clarity exceeds a preset clarity adaptation threshold. If it exceeds, the image is retained; otherwise, it is re-adapted to obtain an adapted image, including:

[0112] Based on the labeled image data, adjust the transparency of the color label overlay layer and blend it with the overall weld image;

[0113] The merged image is subjected to resolution adaptation processing. After the processing is completed, the display sharpness is calculated and compared with the preset sharpness adaptation threshold. If the display sharpness exceeds the sharpness adaptation threshold, the corresponding image is retained. If it does not exceed the threshold, it is re-adapted to obtain the adapted image.

[0114] It should be noted that, firstly, when adjusting the transparency of the color annotation overlay layer and fusing it with the overall weld image, a pixel-level weighted fusion technique is used. The base transparency value is set to 50%, a value determined based on the visualization requirements of industrial weld quality inspection, which highlights the defect locations of the color annotations without obscuring the original texture details of the weld. Transparency can be adjusted according to the scene; in professional quality inspection monitor scenes, it can be lowered to 40% to enhance the original image information, while in ordinary office monitor scenes, it can be increased to 60% to improve annotation recognition. During fusion, the color annotation layer in the annotation image is extracted first, and then the transparency weight matrix is ​​used to perform pixel-by-pixel weighted calculation with the overall weld image to achieve a natural fusion of the two information. For example, in the fusion of annotation images of aerospace component welds, setting the transparency of the blue pore annotation layer to 48% clearly presents the weld bead texture after fusion and clearly identifies the distribution range of pores.

[0115] Next, when performing resolution adaptation processing and detecting display clarity on the fused image, bilinear interpolation technology is used to adjust the resolution. This technology can resample the fused image pixel by pixel according to the resolution parameters of the target display device, smoothly transitioning image details at different resolutions and adapting to mainstream display specifications such as 1080P, 2K, and 4K. Display clarity is quantitatively detected through MTF modulation transfer function analysis, which can accurately reflect the image's detail reproduction capability and edge sharpness. The clarity adaptation threshold is set based on weld quality inspection feedback data from different display devices over the past year, with a base threshold of 75%. This threshold can be lowered to 70% for low-resolution industrial control screen scenarios and raised to 80% for high-resolution professional inspection screen scenarios. If the detected sharpness exceeds the corresponding threshold, the image is retained; otherwise, the interpolation parameters are readjusted and the image is re-fitted. A targeted parameter adjustment strategy is adopted. First, the type of deficiency is determined by the MTF curve. If the low-frequency components are insufficient and the overall sharpness is low, the sampling step size is reduced by 20%. If the mid-frequency components are insufficient (detail loss), the interpolation kernel weight is shifted to adjacent pixels by 15%. If the high-frequency components are insufficient (blurred edges), the interpolation kernel size is increased from 2×2 to 3×3. After adjustment, bilinear interpolation is re-executed until the sharpness meets the standard. This adjustment strategy is designed based on the characteristic requirements of weld seam images at different resolutions to ensure that defect details are not lost during resampling. If the detected sharpness exceeds the corresponding threshold, the image is retained. For example, after the initial adaptation of a weld seam fusion image of a certain engineering machinery to 1080P resolution, the MTF detection sharpness was 72%, which did not reach the basic threshold. After analysis, it was found that the high-frequency components were insufficient. After adjusting the interpolation kernel size to 3×3 and re-fitting, the sharpness was improved to 77%, and the image was successfully retained as the adapted image.

[0116] In step S107, a composite feature formed by combining the color annotation and the weld feature is extracted from the adapted image. The similarity between the composite feature and pre-acquired historical defect samples is calculated. If the similarity exceeds a preset sample similarity threshold, the defect type is confirmed, and a weld defect identification report is generated, including:

[0117] Extract the composite features formed by fusing the color annotations in the adapted image with the overall weld image;

[0118] The composite features are compared with the features of pre-acquired historical defect samples to calculate the feature similarity.

[0119] If the feature similarity exceeds a preset sample similarity threshold, the defect type is confirmed, and the defect type, location, and size information are integrated to generate the weld defect identification report.

[0120] It should be noted that, firstly, when extracting the composite features formed by fusing the color annotations and the overall weld image in the adaptation image, a ResNet-18 convolutional neural network was used to complete the feature extraction. The training process of this network was based on over 18,000 weld defect samples from the aviation, automotive, and shipbuilding industries over the past three years. These samples covered different welding materials such as carbon steel, aluminum alloy, and stainless steel, and included three types of defects: cracks, porosity, and slag inclusions, as well as normal weld samples. Before training, all samples underwent data augmentation processing such as min-max normalization, random flipping, and brightness fine-tuning. The samples were divided into training and validation sets in an 8:2 ratio. A cross-entropy loss function was used, coupled with an Adam optimizer (initial learning rate of 0.001, decaying to 1 / 10 of the original every 50 epochs). Iterative training was conducted for 200 epochs until the accuracy on the validation set stabilized and converged. The final model's defect feature extraction accuracy on the validation set met industrial inspection standards. Before extraction, the adaptation image was first subjected to min-max normalization, mapping pixel values ​​from 0-255 to the 0-1 range to eliminate the interference of dimensional differences on feature extraction. ResNet-18 addresses the vanishing gradient problem in deep networks through residual connections. The shallow convolutional layers (the first 8 layers) capture geometric features such as the boundary shape and position coordinates of color-annotated areas, outputting high-resolution, low-dimensional feature maps. The deep convolutional layers (the last 10 layers) capture material features such as the overall texture gradient and grayscale distribution of the weld, outputting low-resolution, high-dimensional feature maps. To address the size difference between the two types of feature maps, the deep feature maps are upsampled by a factor of 2 using bilinear interpolation, ensuring their one-dimensional size matches that of the shallow feature maps. Figure 1Then, the two types of features are spliced ​​and fused along the channel dimension to form a composite feature with unified dimensions. After testing on multiple batches of defect images, the network can comprehensively cover the key features of defects and has excellent feature discrimination. For example, in the adapted image of the weld seam of an aero-engine blade, ResNet-18 extracts the linear geometric features marked in red for cracks in the shallow layer and the crystalline texture features of the weld seam area in the deep layer. After upsampling and matching the size, the features are spliced ​​and integrated into a precise composite feature.

[0121] Next, when comparing the composite features with the pre-acquired historical defect sample features and calculating the feature similarity, the historical defect sample library is constructed based on defect data of different welding materials and working conditions over the past three years, containing standard feature vectors for three core defects: cracks, porosity, and slag inclusions. The standard feature vectors are all extracted using the same ResNet-18 model trained above. The extraction process is completely consistent with the feature extraction process of the adapted images. First, the historical defect sample images undergo preprocessing such as min-max normalization and color annotation fusion. Then, through shallow and deep feature extraction, size matching, and channel stitching by the model, a standard feature vector with the same dimension as the composite feature to be matched is finally obtained. The sample library supports continuous expansion and updating based on new working condition samples. The similarity calculation uses the cosine similarity algorithm. This algorithm treats the composite feature and sample features as two vectors in a high-dimensional space, quantifying the degree of matching by calculating the cosine value of the angle between the two vectors. The value ranges from 0 to 1, with a value closer to 1 indicating a higher feature match. Before calculation, the two types of features need to be dimensionally aligned to ensure consistent vector dimensions and avoid calculation errors. For example, the cosine similarity between the composite features of a carbon steel weld and crack features in the sample library is 0.86, and the similarity with porosity features is 0.42. It is preliminarily determined that the defect is highly matched with crack features.

[0122] Finally, if the similarity exceeds a preset sample similarity threshold, the defect type is confirmed. When integrating information to generate a weld defect identification report, the sample similarity threshold is set based on the balance between accuracy and false positive rate of historical matching data. By analyzing defect matching cases over the past year, a threshold of 0.82 ensures a correct matching rate of over 98% while keeping the false positive rate below 2%. This threshold can be adjusted according to specific scenarios. For high-precision inspection scenarios such as aerospace, it can be increased to 0.85 to further improve recognition accuracy; for ordinary engineering machinery weld scenarios, it can be decreased to 0.78 to reduce the probability of missed detection. After confirming the defect type, the defect type name, pixel coordinate range, actual size (converted according to image pixel ratio), similarity value, and other information are integrated to generate an identification report in the standard format of an industrial quality inspection report. The report simultaneously marks the key basis for feature matching. For example, if the composite feature similarity of a ship weld is 0.84, which exceeds the basic threshold of 0.82, the system will confirm that it is a slag inclusion defect. After integrating information such as its location x=150-180, y=220-250, and actual size 3mm×5mm, a complete weld defect identification report will be generated.

[0123] In summary, this invention discloses a weld defect identification method based on visual inspection, comprising: acquiring raw data of multi-angle views of the weld; preprocessing the raw data to obtain initial image data; performing multi-layer scanning on the initial image data, extracting weld features from the scanning results, and integrating the weld features to obtain feature image data; performing local region segmentation based on the feature image data and extracting feature distribution information of each region, comparing the feature distribution information with a preset feature saliency threshold, filtering out regions that conform to an abnormal pattern, and obtaining a defect region set; extracting abnormal regions from the defect region set as candidate boundaries, determining whether the continuity of the candidate boundaries exceeds a preset boundary continuity threshold, retaining them if it exceeds the threshold, and discarding them if it does not, and then performing pixel calibration on the retained boundaries to obtain accurate image data; and based on the accurate... The image data is processed as follows: First, the abnormal areas are categorized into defect types. Then, color labels are assigned to different defect types. The distinguishability of the color labels between multiple defect areas is calculated and determined to be whether it exceeds a preset distinguishability threshold. If it exceeds, the color labels are retained; otherwise, they are reassigned to obtain labeled image data. Based on the labeled image data, the color labels are fused with the overall weld image. The fused image is then subjected to resolution adaptation. The display clarity of the image is calculated and determined to be whether it exceeds a preset clarity adaptation threshold. If it exceeds, the image is retained; otherwise, it is re-adapted to obtain an adapted image. From the adapted image, a composite feature formed by combining the color labels and weld features is extracted. The similarity between the composite feature and pre-acquired historical defect samples is calculated. If the similarity exceeds a preset sample similarity threshold, the defect type is confirmed, and a weld defect identification report is generated. This achieves high-precision automated identification of weld defects, meeting the stringent requirements for weld quality inspection in the high-end equipment manufacturing field.

[0124] Secondly, the present invention provides a weld defect identification system based on visual inspection, comprising:

[0125] The data acquisition module is used to acquire the raw data of the weld from multiple angles, and to preprocess the raw data to obtain the initial image data.

[0126] The feature extraction module is used to perform multi-layer scanning on the initial image data, extract weld features from the scanning results, and integrate the weld features to obtain feature image data.

[0127] The defect screening module is used to perform local region segmentation based on the feature image data and extract the feature distribution information of each region, compare the feature distribution information with a preset feature significance threshold, and screen out regions that meet the abnormal pattern to obtain a set of defect regions.

[0128] The boundary calibration module is used to extract abnormal regions from the defect region set as candidate boundaries, determine whether the continuity of the candidate boundaries exceeds a preset boundary continuity threshold, retain them if it exceeds the threshold, and discard them if it does not exceed the threshold. Then, pixel calibration is performed on the retained boundaries to obtain accurate image data.

[0129] The annotation module is used to classify the abnormal areas into defect types based on the accurate image data, assign color annotations to different defect types, calculate and determine whether the distinguishability of the color annotations between multiple defect areas exceeds a preset distinguishability threshold. If it exceeds the threshold, the color annotations are retained; if it does not exceed the threshold, they are reassigned to obtain annotated image data.

[0130] The fusion and adaptation module is used to fuse the color annotation with the overall image of the weld seam according to the annotation image data, and then perform resolution adaptation on the fused image, calculate and determine whether the display clarity of the image exceeds the preset clarity adaptation threshold. If it exceeds the threshold, it is retained; if it does not exceed the threshold, it is re-adapted to obtain the adapted image.

[0131] The report generation module is used to extract the composite features formed by combining the color annotation and the weld features from the adapted image, calculate the similarity between the composite features and the pre-acquired historical defect samples, and if the similarity exceeds a preset sample similarity threshold, confirm the defect type and generate a weld defect identification report.

[0132] It should be noted that the weld defect identification system based on visual inspection provided in this embodiment of the invention is used to execute all the process steps of the weld defect identification method based on visual inspection in the above embodiment. The working principle and beneficial effects of the two are one-to-one, so they will not be described again.

[0133] 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 program. When the processor executes the computer program, it implements the steps in the various embodiments of the vision-based weld defect identification method described above, for example... Figure 1 The step S101 shown. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in the above-described device embodiments, such as the feature extraction module.

[0134] 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.

[0135] 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.

[0136] 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.

[0137] 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.

[0138] 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.

[0139] It should be noted that the device 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 device 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.

[0140] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are 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 weld defect identification based on visual inspection, characterized in that, include: The raw data of the weld seam from multiple angles is obtained, and the raw data is preprocessed to obtain the initial image data. The initial image data is scanned in multiple layers. Weld features are extracted from the scan results and integrated to obtain feature image data. Based on the feature image data, local region segmentation is performed and feature distribution information of each region is extracted. The feature distribution information is compared with a preset feature significance threshold, and regions that meet the abnormal pattern are selected to obtain a set of defective regions. Anomalies are extracted from the defect region set as candidate boundaries. The continuity of the candidate boundaries is determined to be greater than a preset boundary continuity threshold. If it is greater, the boundary is retained; otherwise, it is discarded. The retained boundaries are then pixel-calibrated to obtain accurate image data. Based on the precise image data, the abnormal areas are first classified into defect types, then color labels are assigned to different defect types, and the distinguishability of the color labels between multiple defect areas is calculated and determined to be whether it exceeds a preset distinguishability threshold. If it exceeds the threshold, the color labels are retained; if it does not exceed the threshold, they are reassigned to obtain labeled image data. Based on the labeled image data, the color label is fused with the overall image of the weld, and then the resolution of the fused image is adapted. The display clarity of the image is calculated and judged to see if it exceeds the preset clarity adaptation threshold. If it exceeds the threshold, it is retained; if it does not exceed the threshold, it is re-adapted to obtain the adapted image. Extract the composite feature formed by combining the color annotation and the weld feature from the adapted image, calculate the similarity between the composite feature and the pre-acquired historical defect samples, and if the similarity exceeds a preset sample similarity threshold, confirm the defect type and generate a weld defect identification report.

2. The weld defect identification method based on visual inspection according to claim 1, characterized in that, The process of acquiring the raw data of multi-angle views of the weld seam, and preprocessing the raw data to obtain initial image data, includes: Obtain raw data for multi-angle views of the weld; The original data is subjected to grayscale histogram analysis to determine the light interference peak. If the light interference peak exceeds the preset light interference judgment threshold, a light mask is generated to mark and isolate the strong light interference area in the image, and a light interference-free image is obtained. Calculate the noise variance of a local region in the light-dissipated image, dynamically adjust the size of the filtering window based on the noise variance, perform adaptive filtering for environmental noise, and obtain single-angle filtered data. The single-angle filtered data from each angle are image registered and then fused to obtain the initial image data.

3. The weld defect identification method based on visual inspection according to claim 1, characterized in that, The process involves performing multi-layer scanning on the initial image data, extracting weld features from the scanning results, and integrating the weld features to obtain feature image data, including: The initial image data is subjected to multi-layer progressive scanning. After each layer is scanned, a corresponding scale response map is output. All the scale response maps are integrated to obtain preliminary response data. The weld region boundary is extracted from the preliminary response data and the boundary gradient value is calculated as the boundary strength. The weld region boundary where the boundary strength exceeds the preset boundary strength threshold is retained to obtain the weld edge data. Calculate the gradient change of the weld edge data. If the gradient change exceeds a preset gradient change threshold, extract and integrate the regional texture details to obtain texture feature data. Cluster analysis is performed on the initial image data to identify background interference regions, and then a positioning mask is generated for the background interference regions. The weld edge data and the texture feature data are superimposed and fused, and the invalid information of the background interference area is removed by the positioning mask to obtain feature image data.

4. The weld defect identification method based on visual inspection according to claim 1, characterized in that, The process involves segmenting local regions based on the feature image data and extracting feature distribution information for each region. This feature distribution information is then compared with a preset feature significance threshold to filter out regions that conform to an abnormal pattern, resulting in a defect region set, including: The feature image data is segmented locally to generate a subset of weld seam regions; The grayscale and texture feature distribution information of each region in the weld region subset is extracted to obtain region feature data; The region feature data is compared with a preset feature significance threshold to filter out regions with high significance features; The highly significant feature regions are matched with preset defect anomaly patterns, and the regions that are successfully matched are included in the defect region set.

5. The weld defect identification method based on visual inspection according to claim 1, characterized in that, The process involves extracting abnormal regions from the defect region set as candidate boundaries, determining whether the continuity of the candidate boundaries exceeds a preset boundary continuity threshold, retaining them if it does not, and discarding them if it does not. Then, pixel calibration is performed on the retained boundaries to obtain accurate image data, including: Extract the edges of abnormal regions within the defect region set as candidate boundaries; Perform contour refinement processing on the candidate boundaries, calculate the boundary continuity and compare it with a preset boundary continuity threshold. If the continuity exceeds the threshold, the corresponding candidate boundary is retained; otherwise, it is discarded. The retained candidate boundaries are calibrated at the pixel level. When the deviation between the calibrated candidate boundaries and the preset standard defect boundary template is lower than the preset calibration deviation threshold, the calibration process is completed and accurate image data is obtained.

6. The weld defect identification method based on visual inspection according to claim 1, characterized in that, Based on the precise image data, the abnormal regions are first categorized by defect type, then color labels are assigned to different defect types. The distinguishability of the color labels among multiple defect regions is calculated and determined to be whether it exceeds a preset distinguishability threshold. If it exceeds, the color labels are retained; otherwise, they are reassigned to obtain labeled image data, including: Based on the precise image data, the defect types are classified according to the characteristics of the abnormal regions, and then the defect regions are uniquely encoded according to their types to generate a defect code set. Differentiated color labels are assigned to different codes in the defect code set; Calculate the distinguishability of the color labels among multiple defective regions. If the distinguishability exceeds a preset distinguishability threshold, retain the corresponding color label to obtain labeled image data.

7. The weld defect identification method based on visual inspection according to claim 1, characterized in that, Based on the labeled image data, the color annotations are fused with the overall weld image. Then, the fused image undergoes resolution adaptation. The resolution of the image is calculated and determined to determine whether the image's display clarity exceeds a preset clarity adaptation threshold. If it exceeds, the image is retained; otherwise, it is re-adapted to obtain an adapted image, including: Based on the labeled image data, adjust the transparency of the color label overlay layer and blend it with the overall weld image; The merged image is subjected to resolution adaptation processing. After the processing is completed, the display sharpness is calculated and compared with the preset sharpness adaptation threshold. If the display sharpness exceeds the sharpness adaptation threshold, the corresponding image is retained. If it does not exceed the threshold, it is re-adapted to obtain the adapted image.

8. The weld defect identification method based on visual inspection according to claim 1, characterized in that, Extract the composite feature formed by combining the color annotation and the weld feature from the adapted image, calculate the similarity between the composite feature and pre-acquired historical defect samples, and if the similarity exceeds a preset sample similarity threshold, confirm the defect type and generate a weld defect identification report, including: Extract the composite features formed by fusing the color annotations in the adapted image with the overall weld image; The composite features are compared with the features of pre-acquired historical defect samples to calculate the feature similarity. If the feature similarity exceeds a preset sample similarity threshold, the defect type is confirmed, and the defect type, location, and size information are integrated to generate the weld defect identification report.

9. A weld defect identification system based on visual inspection, characterized in that, include: The data acquisition module is used to acquire the raw data of the weld from multiple angles, and to preprocess the raw data to obtain the initial image data. The feature extraction module is used to perform multi-layer scanning on the initial image data, extract weld features from the scanning results, and integrate the weld features to obtain feature image data. The defect screening module is used to perform local region segmentation based on the feature image data and extract the feature distribution information of each region, compare the feature distribution information with a preset feature significance threshold, and screen out regions that meet the abnormal pattern to obtain a set of defect regions. The boundary calibration module is used to extract abnormal regions from the defect region set as candidate boundaries, determine whether the continuity of the candidate boundaries exceeds a preset boundary continuity threshold, retain them if it exceeds the threshold, and discard them if it does not exceed the threshold. Then, pixel calibration is performed on the retained boundaries to obtain accurate image data. The annotation module is used to classify the abnormal areas into defect types based on the accurate image data, assign color annotations to different defect types, calculate and determine whether the distinguishability of the color annotations between multiple defect areas exceeds a preset distinguishability threshold. If it exceeds the threshold, the color annotations are retained; if it does not exceed the threshold, they are reassigned to obtain annotated image data. The fusion and adaptation module is used to fuse the color annotation with the overall image of the weld seam according to the annotation image data, and then perform resolution adaptation on the fused image, calculate and determine whether the display clarity of the image exceeds the preset clarity adaptation threshold. If it exceeds the threshold, it is retained; if it does not exceed the threshold, it is re-adapted to obtain the adapted image. The report generation module is used to extract the composite features formed by combining the color annotation and the weld features from the adapted image, calculate the similarity between the composite features and the pre-acquired historical defect samples, and if the similarity exceeds a preset sample similarity threshold, confirm the defect type and generate a weld defect identification report.

Citation Information

Patent Citations

  • Weld defect intelligent identification and distribution visualization method and system

    CN120912617A

  • Weldment welding seam automatic detection method and device based on machine vision

    CN121120603A