A weld defect detection method, electronic device and storage medium

CN122694859BActive Publication Date: 2026-10-16CHONGQING SPECIAL EQUIP INSPECTION & RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611161322.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-10-16
Estimated Expiration
2046-08-03

AI Technical Summary

Technical Problem

[0007]有鉴于此,本申请实施例的目的在于提供一种焊缝缺陷检测方法、电子设备及存储介质,能够改善现有技术中模型输出结果稳定性不足的问题

Benefits of technology

[0020] The invention employing the above technical solution has the following advantages:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122694859B_ABST
    Figure CN122694859B_ABST
Patent Text Reader

Abstract

The application provides a weld defect detection method, an electronic device and a storage medium, and relates to the technical field of defect detection. The method comprises the following steps: acquiring a to-be-evaluated radiographic image and process metadata of the radiographic image; extracting a candidate area suspected of having a defect based on a preset strategy; determining a difference feature vector according to a candidate visual feature vector of the candidate area and a first reference visual feature vector of a first reference area; obtaining a first defect hypothesis set of the candidate area through a multi-modal large model; determining a matching score according to the difference feature vector and a prototype difference vector of the first defect category pre-labeled; constructing a plurality of verification views of the candidate area according to a preset image processing tool; obtaining a consistency score of each first defect category; and determining a detection result of whether the candidate area has a defect. The present scheme reduces false positives and false negatives.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of defect detection technology, and more specifically, to a method for detecting weld defects, an electronic device, and a storage medium. Background Technology

[0002] Boiler small-diameter pipe welds require extensive radiographic inspection during manufacturing and maintenance, with results typically relying on manual image interpretation. As the volume of inspection data increases, manual interpretation suffers from high workload, low efficiency, and poor consistency. In recent years, deep learning-based defect detection methods have been applied to radiographic image analysis, automatically outputting the location and category of candidate defects. Simultaneously, multimodal large-scale models, demonstrating strong capabilities in visual understanding and semantic reasoning, are also being explored for industrial inspection scenarios. However, existing methods still have the following shortcomings in radiographic image analysis of boiler small-diameter pipe welds:

[0003] 1. Defects in X-ray images are usually small targets, low contrast, blurred boundaries and similar shapes. They are easily confused with weld background texture, processing marks or imaging noise by relying solely on the candidate region itself for one-time classification, resulting in a high false detection rate.

[0004] 2. Existing methods typically identify candidate regions individually, lacking a mechanism for comparative analysis with normal regions under the same weld seam and imaging conditions, making it difficult to accurately characterize the degree of abnormality of candidate regions relative to the normal background.

[0005] 3. The application of multimodal large models in industrial scenarios often stops at directly inferring from input images, lacking the reasoning chain of "first generating defect hypotheses, then verifying hypotheses", resulting in insufficient stability of model output results;

[0006] 4. Existing methods lack a mechanism to combine candidate region difference features, multimodal reasoning results, and defect prototype knowledge for joint adjudication, making it difficult to simultaneously ensure recognition accuracy, robustness, and interpretability. Summary of the Invention

[0007] In view of this, the purpose of this application is to provide a weld defect detection method, electronic device and storage medium that can improve the problem of insufficient stability of model output results in the prior art.

[0008] To achieve the above technical objectives, the technical solution adopted in this application is as follows:

[0009] In a first aspect, embodiments of this application provide a method for detecting weld defects, the method comprising:

[0010] Acquire the X-ray image to be evaluated, and the process metadata of the X-ray image;

[0011] Based on a preset strategy, candidate regions suspected of having defects are extracted;

[0012] Based on the candidate visual feature vector of the candidate region and the first reference visual feature vector of the first reference region, a difference feature vector is determined. The first reference region has the same size as the candidate region and is located outside all candidate regions of the ray image. The difference feature vector is used to characterize the degree of difference between the candidate region and the first reference region.

[0013] The candidate region, the first reference region, the difference feature vector, and the process metadata are input into the multimodal large model. The first defect hypothesis set of the candidate region is obtained through the multimodal large model. The first defect hypothesis set includes N1 first defect categories, as well as the first initial confidence and process prior score of the first defect category, where N1 is an integer greater than or equal to 2.

[0014] A matching score is determined based on the difference feature vector and the pre-calibrated prototype difference vector of the first defect category, wherein the matching score characterizes the degree of matching between the difference feature vector and the prototype difference vector.

[0015] Based on a preset image processing tool, several verification views of the candidate region are constructed. The verification views are obtained by performing specified operations on the candidate region, and each verification view corresponds one-to-one with a specified operation.

[0016] Based on the multimodal large model, a consistency score is obtained for each of the first defect categories, the consistency score being determined based on the number of verification views that have the same defects as the candidate region;

[0017] Based on the consistency score, matching score, first initial confidence level, and process prior score, the detection result of whether there is a defect in the candidate region is determined.

[0018] Secondly, embodiments of this application also provide an electronic device, the electronic device including a processor and a memory coupled to each other, the memory storing a computer program, and when the computer program is executed by the processor, causing the electronic device to perform the method described in the first aspect.

[0019] Thirdly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method described in the first aspect.

[0020] The invention employing the above technical solution has the following advantages:

[0021] In the technical solution provided in this application, a normal region with the same size as the candidate region is selected in the same X-ray image as the first reference region. The difference in visual features between the two is calculated to obtain a difference feature vector. This transforms the traditional absolute feature judgment into a relative anomaly characterization, which can offset the systematic interference caused by the imaging baseline and background texture of the same image, and accurately reflect the true anomaly attributes of the candidate region. Subsequently, the candidate region, the first reference region, the difference feature vector, and process metadata are input into a multimodal large model to generate a set of defect hypotheses containing multiple defect categories, replacing the single-category output and reducing the randomness of single inference. Finally, the matching score is calculated by combining the pre-calibrated difference vectors of various defect prototypes. This approach provides independent verification criteria for defect identification based on statistical features. Simultaneously, it constructs verification views of candidate regions through various specified image processing operations. A multimodal large model is used to repeatedly verify each defect hypothesis across multiple views. A consistency score is obtained based on the proportion of views with consistent identification results, verifying the stability of defect identification results under different visual perturbations. Finally, the initial confidence level, matching score, consistency score, and process prior score are integrated for comprehensive adjudication, achieving complementary verification of multi-dimensional information. This not only improves the accuracy and anti-interference capability of defect detection but also provides a traceable basis for the judgment process, effectively reducing false detections and missed detections, and ensuring the stability and reliability of radiographic weld defect detection results. Attached Figure Description

[0022] This application can be further illustrated by the non-limiting embodiments given in the accompanying drawings. It should be understood that the following drawings only illustrate some embodiments of this application and should not be considered as limiting the scope. For those skilled in the art, other related drawings can be obtained from these drawings without any inventive effort.

[0023] Figure 1 A flowchart of the weld defect detection method provided in the embodiments of this application.

[0024] Figure 2 This is a sub-flowchart of S180 provided in an embodiment of this application. Detailed Implementation

[0025] The present application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that similar or identical parts are referred to by the same reference numerals in the drawings or description. Implementations not shown or described in the drawings are forms known to those skilled in the art. In the description of this application, terms such as "first" and "second" are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0026] Please refer to Figure 1This application provides a weld defect detection method, which can be applied to electronic devices and whose steps can be executed or implemented by the electronic devices. The electronic devices can be, but are not limited to, personal computers, smartphones, and other electronic devices. The weld defect detection method may include the following steps:

[0027] S110, acquire the X-ray image to be evaluated, and the process metadata of the X-ray image;

[0028] S120, Based on a preset strategy, extract candidate regions that are suspected of having defects;

[0029] S130, a difference feature vector is determined based on the candidate visual feature vector of the candidate region and the first reference visual feature vector of the first reference region. The first reference region has the same size as the candidate region and is located outside all candidate regions of the ray image. The difference feature vector is used to characterize the degree of difference between the candidate region and the first reference region.

[0030] S140, the candidate region, the first reference region, the difference feature vector, and the process metadata are input into the multimodal large model. The first defect hypothesis set of the candidate region is obtained through the multimodal large model. The first defect hypothesis set includes N1 first defect categories, as well as the first initial confidence and process prior score of the first defect category. N1 is an integer greater than or equal to 2.

[0031] S150, determine a matching score based on the difference feature vector and the pre-calibrated prototype difference vector of the first defect category, wherein the matching score characterizes the degree of matching between the difference feature vector and the prototype difference vector.

[0032] S160, according to a preset image processing tool, construct a plurality of verification views of the candidate region. The verification views are obtained by performing specified operations on the candidate region, and each verification view corresponds one-to-one with a specified operation.

[0033] S170, Based on the multimodal large model, obtain a consistency score for each of the first defect categories, the consistency score being determined based on the number of verification views that have the same defects as the candidate region;

[0034] S180, based on the consistency score, matching score, first initial confidence level, and process prior score, determine whether there is a defect in the candidate region.

[0035] In the above implementation, firstly, candidate regions for suspected defects are extracted from the X-ray image to be inspected using a defect detection model. Simultaneously, a normal region with the same size as the candidate region and not overlapping with other candidate regions is selected within the same weld background area as a first reference region. The visual feature difference between the candidate region and the first reference region is calculated, and a difference feature vector is generated. The degree of abnormality of the candidate region relative to the normal background replaces the absolute feature judgment of a single region, avoiding interference from background texture, processing marks, and imaging noise on defect judgment. Subsequently, the candidate region, the first reference region, the difference feature vector, and process metadata are input into a multimodal large model. The multimodal large model combines visual content, difference information, and working condition semantics to generate a set of defect hypotheses containing multiple first defect categories. The first initial confidence score and process prior score of the corresponding category are output simultaneously, replacing single-hypothesis output with multiple hypothesis outputs. A single classification result reduces the randomness of single inference. Multiple verification views are constructed for candidate regions through pre-defined image processing operations. A multimodal large model is used to repeatedly verify each defect hypothesis across multiple views. A consistency score is calculated based on the proportion of views with consistent recognition results, improving the stability of the multimodal large model output. Finally, combining pre-calibrated prototype difference vectors of various defects, a matching score is calculated between the difference feature vector and the prototype difference vector of the pre-calibrated first defect category. The initial confidence score, process prior score, consistency score, and matching score are then weighted and fused to form the final decision criterion, determining the defect detection result of the candidate region. This achieves joint decision-making based on candidate difference features, multimodal inference results, defect prototype knowledge, and process priors, while simultaneously considering the accuracy, robustness, and interpretability of detection, thus improving the overall automation efficiency and result consistency of X-ray inspection.

[0036] The steps of the weld defect detection method will be described in detail below:

[0037] In S110, the radiographic image refers to the original digital image of the boiler weld area taken by digital radiographic (DR) equipment for defect evaluation. It is the core visual carrier for defect detection. The image can intuitively present the grayscale, shape and location characteristics of the base material area, fusion line, weld area and suspected defects such as cracks, pores and inclusions of the boiler weld.

[0038] The process metadata includes at least one or more of the following: material, wall thickness, welding process parameters, detection voltage, or pixel size. It provides the model with a semantic context of the working conditions, enabling the model's inference process to make judgments based on the industrial context rather than solely relying on local texture features. Specifically, the process metadata includes welding process data and imaging data. Welding process data includes at least one or more of the following: material, wall thickness, welding method, welding position, bevel type, welding current, welding voltage, welding speed, or heat input. Imaging data includes at least one or more of the following: detection voltage, exposure time, pixel size, or detector type. The process prior score is determined based on the welding process data; imaging data is not used to generate the process prior score.

[0039] Understandably, before executing S120, the following steps are required to identify the weld area in advance, thereby improving the detection accuracy of the candidate area: grayscale normalization, contrast enhancement, and effective weld area localization are performed on the image to obtain the weld analysis area. It is understandable that the specific method of the above process can be as follows:

[0040] The acquired raw X-ray images are subjected to grayscale normalization. Linear grayscale mapping unifies the original grayscale value range under different illumination conditions to a standard grayscale range, eliminating grayscale baseline shifts caused by batch imaging differences and establishing a unified grayscale benchmark for subsequent processing. Based on this, contrast-limited adaptive histogram equalization is used to enhance image contrast, suppressing excessive amplification of background noise while improving the grayscale resolution of low-contrast details in the weld area and strengthening the grayscale difference between suspected defects and the weld background. Finally, the effective weld area is located using grayscale projection or a lightweight semantic segmentation network. The weld boundary is identified along the weld direction, and irrelevant areas such as the base material on both sides and edge artifacts are removed, extracting only the effective area containing the weld body as the weld analysis area. This narrows the processing scope of subsequent detections and eliminates irrelevant background interference.

[0041] Based on this, the effective range of the weld body refers to the complete weld metal deposition area enclosed by the fusion lines on both sides in the radiographic image. It corresponds to the weld body itself formed by the melting and filling of the base metal in the actual welding process. It is also the only area where welding defects such as porosity, cracks, slag inclusions, and incomplete penetration exist. This range does not include the base metal matrix on both sides of the weld, image edge artifacts, or irrelevant background outside the weld. It is the core target area that defect detection should really focus on.

[0042] In S120, the preset strategy can be a strategy that uses threshold segmentation, edge detection, or deep learning detection models to extract candidate regions.

[0043] The defect detection model can be a dedicated deep learning detection model (such as an object detection network) pre-trained based on a large number of boiler weld radiographic image samples. It is specifically designed to identify weld defects in radiographic images, and operates with a low detection threshold to maximize the detection of suspected defects and ensure defect recall. The input includes the weld analysis region. The X-ray image outputs candidate regions in the image that are suspected of having defects. A low threshold is used to achieve "low threshold high recall" to initially identify all suspected defects and avoid missing real defects.

[0044] Understandably, candidate regions can also be extracted using threshold segmentation and edge detection. For example, considering the imaging characteristics of defects in the radiographic images of small-diameter boiler pipe welds, which often appear as low-grayscale dark areas, local adaptive threshold segmentation can be used to extract candidate regions: in the weld analysis area... The local background grayscale mean is calculated point by point using a sliding window of fixed size, and this is used as the dynamic segmentation threshold at that location. Pixels with grayscale values ​​lower than the threshold are identified as suspected defective pixels. Then, morphological opening operations are performed on the binarized results to remove isolated noise points. All independent pixel clusters are then extracted by connected component labeling. After removing the smallest noise connected components, the remaining connected components are the candidate regions.

[0045] or:

[0046] When using Canny edge detection to extract candidate regions, first analyze the weld seam area. Gaussian smoothing filtering is performed to suppress particle noise in X-ray imaging. Then, the pixel gradient magnitude and direction are calculated using the Sobel operator. After edge refinement by non-maximum suppression, high and low thresholds are set to filter and connect continuous edge pixels to obtain all edge contours within the weld. Subsequently, closed or nearly closed defect contours are extracted, and the internal regions of the contours are filled to obtain binary connected regions. Combined with morphological parameters such as area and compactness, the fine edges formed by the inherent texture of the weld are screened out, and finally, several candidate regions are obtained.

[0047] In this embodiment, based on the aforementioned preset strategy, at least one candidate region suspected of having a defect is obtained, denoted as:

[0048] .

[0049] in, Indicates the first Candidate regions, This represents the number of candidate regions.

[0050] After S120 and before S130, the method described in this embodiment further includes:

[0051] In the region outside all candidate regions of the X-ray image, several candidate regions are determined. The size of all candidate regions is the same as that of the candidate regions. The candidate regions are located on one side of the candidate regions, or the candidate regions are located adjacent to the candidate regions along the weld centerline. The grayscale value of each pixel in the candidate regions is extracted. Based on the grayscale value of each pixel in the candidate regions and the average grayscale of the weld analysis area of ​​the X-ray image, a quality evaluation value of each candidate region is determined. The candidate region corresponding to the smallest quality evaluation value is the first reference region.

[0052] In this embodiment, the reason for setting the candidate areas on both sides of the candidate area or adjacent to it along the weld centerline is to ensure that the first reference area and the candidate area have highly consistent imaging conditions and weld background attributes: the weld segment along the weld centerline has the most stable transmission thickness, X-ray scattering level, material uniformity, and welding process forming state, and there are almost no systematic differences in the background grayscale baseline and texture substrate of adjacent positions; setting the candidate areas adjacent to the candidate area can ensure that the two belong to the same uniform weld body, avoiding problems such as transmission thickness fluctuation, weld structure inhomogeneity, and imaging geometric distortion caused by excessive distance, thereby preventing the grayscale and texture differences of the background itself from being mixed into the subsequent difference feature calculation; the imaging conditions of the first reference area and the candidate area selected in this way are highly homogeneous, and the feature difference between the two can eliminate the systematic interference caused by position and working conditions to the greatest extent, and truly reflect the degree of defect abnormality of the candidate area itself.

[0053] When executed on the electronic device, the discrete coordinate sequence and tangent direction of the weld centerline are first obtained from the weld analysis area through skeleton extraction or polynomial fitting. For each candidate region, its centroid coordinates are calculated and projected onto the weld centerline to obtain the corresponding reference point. Then, with the reference point as the origin, the region is translated to the left and right sides along the tangent direction of the weld centerline by a preset step size to generate several rectangular windows that are completely consistent with the size and orientation of the candidate region. During the generation process, each window is double-checked: first, all pixels of the window are checked to ensure that they fall within the weld analysis area; second, the window does not overlap with the pixels of other candidate regions. Windows that pass the check are included in the candidate region set. Thus, from the algorithm execution level, it is strictly ensured that all candidate regions are distributed along the weld centerline on the adjacent sides of the candidate region.

[0054] When extracting pixel grayscale values ​​of candidate regions on electronic devices, the corresponding image pixel coordinate range is first determined based on the spatial location and boundary range of the candidate region in the original grayscale image. If the candidate region is a regular rectangular window, all row and column pixel coordinates covered by the window are directly traversed, and the grayscale values ​​at the corresponding positions are read from the grayscale pixel matrix of the original image point by point. If the candidate region is an irregular shape, the region is assigned pixel by pixel based on the binary mask of the region, and only the pixel grayscale values ​​marked as valid regions by the mask are extracted. Finally, the grayscale values ​​of all valid pixels in the candidate region are summarized to obtain the set of grayscale values, which are used for subsequent calculation of statistical indicators such as grayscale mean and standard deviation.

[0055] The effective area here refers to the range of pixels actually covered by the current candidate area that needs to be included in the grayscale statistical calculation. It is marked by a binary mask: pixels with positive values ​​in the mask represent pixels within the candidate area, i.e., effective pixels; pixels with a value of 0 in the mask represent irrelevant pixels outside the candidate area boundary (such as base material outside the weld, or pixels in the non-target area within the bounding rectangle of the candidate area), and are considered invalid pixels. By filtering through the mask and extracting only the grayscale values ​​of the effective area, it ensures that all pixels participating in the calculation of the grayscale mean and standard deviation come from the candidate area itself, without mixing in irrelevant background pixels from outside the area. This guarantees that the subsequent calculation results of the reference quality evaluation function can accurately reflect the true background attributes of the candidate area.

[0056] In this embodiment, the quality evaluation value is calculated as follows:

[0057] Based on the grayscale value of each pixel in the candidate region, the mean grayscale value, standard deviation grayscale value, and edge strength of the candidate region are determined; based on the difference between the mean grayscale value of the candidate region and the average grayscale value of the weld seam analysis area in the X-ray image, the standard deviation grayscale value, and the edge strength, the quality evaluation value is determined. Specifically, this can be represented as follows:

[0058] Let the first The first reference region search set of the candidate regions is: For any candidate area Its quality evaluation value can be defined as:

[0059]

[0060] in, Indicates alternative areas The average gray level, This represents the average gray level of the weld analysis area. Indicates alternative areas The standard deviation of gray level Indicates the edge strength of candidate region P. These are the weighting coefficients. Indicates alternative areas The quality evaluation value.

[0061] In practical applications, it is necessary to... , and All were standardized using the min-max method. , and All are uniformly mapped to the [0,1] interval. At this point, the three indicators are at the same numerical magnitude, and then based on... Calculate the candidate area The quality evaluation value.

[0062] The min-max standardization method can be as follows: First, iterate through all candidate regions of the candidate region and calculate the absolute value of the gray-level deviation for each candidate region. Gray standard deviation Edge strength Three sets of original index values ​​were then calculated. The extreme values ​​of each index across all candidate regions were then statistically analyzed: the maximum and minimum values ​​of grayscale deviation, grayscale standard deviation, and edge intensity. For each candidate region P, the standardized index values ​​were calculated using the min-max normalization formula. The original values ​​of the three indices were compressed to the [0,1] interval using linear mapping. A higher normalized value still indicates a higher degree of anomaly in the corresponding dimension. If the maximum and minimum values ​​of an index are equal, it means that all candidate regions are indistinguishable in that dimension, and the normalized value is set to 0. When at least two candidate regions have the same quality evaluation value, the candidate region with the smallest spatial distance from the candidate region is determined as the first reference region. If the spatial distance is still the same, any one of the candidate regions is selected as the first reference region. Here, spatial distance refers to the pixel distance between the geometric centroid of the candidate region and the geometric centroid of the candidate region in the two-dimensional pixel coordinate system of the ray image.

[0063] In this embodiment, All are greater than 0, and .

[0064] In this embodiment, the quality evaluation value is obtained by weighted summing of three factors: the deviation of the average gray level between the candidate area and the weld analysis area, the standard deviation of the area's gray level, and the edge strength of the area. These three factors are cost indicators characterizing the "abnormality" of the area. An ideal clean weld area should be highly consistent with the overall weld gray level baseline, have uniform and smooth internal gray levels, and sparse and smooth edge textures. The lower the values ​​of these three indicators, the smaller the calculated quality evaluation value, indicating a higher degree of similarity to the ideal weld area. Conversely, if the gray level of the candidate area deviates significantly from the overall baseline, the internal gray level fluctuates more violently, and the edge texture is more chaotic, the values ​​of the three indicators will be higher, resulting in a larger quality evaluation value. This indicates a more significant difference in characteristics between the candidate area and the ideal weld background, and a lower degree of similarity. Therefore, the quality evaluation value is negatively correlated with the similarity between the candidate area and the ideal weld area, i.e.:

[0065]

[0066] Indicates the first Candidate regions The first reference area.

[0067] In this embodiment, The grayscale difference formed by pairing is used to constrain the consistency of the macroscopic imaging baseline between the candidate area and the weld analysis area, ensuring that the first reference area and the candidate area are in the same imaging environment with the same transmission thickness and the same scattering level, and avoiding the interference of defect judgment caused by systematic grayscale deviation due to positional differences.

[0068] σ(P) is used to measure the uniformity of meso-grayscale within the candidate area. Ideally, the grayscale fluctuation of the weld matrix without defects is smooth. The smaller the standard deviation, the purer the area is, and there are no hidden micro-defects or grayscale abrupt changes. It can be used as a stable grayscale benchmark.

[0069] e(P) is used to characterize the smoothness of the micro-texture of the candidate area. Normal welds have no obvious step edges. The lower the edge strength, the fewer the defect contours and texture abrupt changes in the area. The texture base is highly consistent with the normal weld, which can ensure the effectiveness of the comparison of subsequent edge and texture difference features. The three are progressive and complementary, which not only ensures that the imaging conditions of the first reference area and the candidate area are from the same source, but also ensures the background purity of the first reference area itself, which perfectly matches the positioning of the first reference area as the "normal control benchmark".

[0070] The first reference region selected in the above manner has the same imaging conditions and background texture as the candidate region, which can reduce the deviation introduced by cross-image and cross-condition comparison.

[0071] In this embodiment, the first reference area and the candidate area are located within the same weld background area, the first reference area and the candidate area have the same scale, and do not overlap with other candidate areas.

[0072] This invention introduces a first reference region to achieve anomaly relative quantity modeling under the same image background conditions. This is because traditional defect detection often relies on absolute visual feature modeling of candidate regions, making the judgment results susceptible to interference from common factors such as fluctuations in the imaging baseline within the same image and uneven texture of the weld background. It is difficult to distinguish whether feature changes originate from the defect itself or from differences in background imaging. This embodiment introduces a first reference region, belonging to the same X-ray image as the candidate region, located in the same weld body, and with highly consistent imaging conditions, as a normal benchmark. The two regions share identical transmission thickness, X-ray scattering level, grayscale baseline, and background texture attributes. All common influences from imaging and the background are synchronously canceled out in the feature difference between the two regions. By calculating the visual feature difference between the candidate region and the first reference region to construct a difference feature vector, the original absolute feature judgment is transformed into an anomaly relative quantity characterization relative to the normal background. The feature difference only reflects the degree of anomaly of the candidate region itself, eliminating systematic interference under the same image background conditions. Therefore, it achieves anomaly relative quantity modeling under the same image background conditions.

[0073] Based on this, in S130, the candidate regions are respectively... With the first reference area Visual feature extraction is performed to obtain candidate visual feature vectors and a first reference visual feature vector:

[0074] in, This represents a feature extraction function whose output includes at least edge gradient features, geometric morphology features, grayscale statistical features, and texture features. This represents the candidate visual feature vector of the i-th candidate region. It represents the first reference visual feature vector of the first reference region corresponding to the i-th candidate region.

[0075] In one implementation, the candidate visual feature vector and the first reference visual feature vector can be represented as follows:

[0076]

[0077]

[0078] in, Represents edge gradient features. Indicates geometric morphological features, Represents the statistical characteristics of grayscale. Represents texture features.

[0079] and Let represent the candidate visual feature vector of the i-th candidate region and the reference visual feature vector of the first reference region corresponding to the i-th candidate region, respectively.

[0080] and These are the edge gradient feature vectors of the i-th candidate region and the edge gradient feature vectors of the first reference region corresponding to the i-th candidate region, respectively.

[0081] and These are the geometric feature vectors of the i-th candidate region and the geometric feature vectors of the first reference region corresponding to the i-th candidate region, respectively.

[0082] and These are the gray-level statistical feature vectors of the i-th candidate region and the gray-level statistical feature vectors of the first reference region corresponding to the i-th candidate region, respectively.

[0083] and These are the texture feature vectors of the i-th candidate region and the texture feature vectors of the first reference region corresponding to the i-th candidate region, respectively.

[0084] The difference feature vector between the candidate region and the first reference region is defined as:

[0085] In another implementation, to enhance robustness, the absolute difference form can be used:

[0086] For gray-level statistical features, the mean gray level of the candidate region With gray variance Represented as:

[0087]

[0088]

[0089] The average gray level of the first reference region With gray variance The same calculation method is used. Then, the grayscale difference is constructed:

[0090]

[0091] Represents the coordinates in the candidate region The grayscale value of the pixel is calculated. and In the expression The cardinality symbol represents the total number of valid pixels contained in the corresponding candidate region.

[0092] Geometric features can be composed of aspect ratio, thinness, and principal direction angle parameters. When extracting geometric difference features, connected component extraction and preprocessing are first performed on the candidate region and the first reference region respectively: a unified binarization rule is used to process the grayscale images of the two regions to obtain the binary mask of the target pixel. The independent pixel clusters in the region are identified by the 8-neighbor connected component labeling algorithm. The main connected component with the largest area in each region is selected as the analysis object, and the row and column coordinates of all pixels in the connected component are extracted as the basis for subsequent parameter calculations. When calculating the aspect ratio, all pixel coordinates of the connected component are traversed, and the smallest rectangle that can completely enclose the connected component is searched by rotating the coordinate system. The pixel lengths of the long side and the short side of the smallest bounding rectangle are determined. The ratio of the long side length to the short side length is used as the aspect ratio parameter to characterize the elongation of the connected component. When calculating the thinness, the total number of pixels contained in the connected component is first counted. The area of ​​the region is obtained, and then the outer contour pixels of the connected domain are extracted using a boundary tracking algorithm. The total number of contour pixels is counted to obtain the perimeter of the region. The ratio of the square of the perimeter to the area is used as the thinness parameter. The larger the value, the thinner and more complex the edge contour of the connected domain. When calculating the principal direction deviation angle, the centroid coordinates are first solved based on the pixel coordinate set of the connected domain, and the covariance matrix is ​​constructed. The direction of the eigenvector corresponding to the largest eigenvalue is solved through principal component analysis, which is the principal direction of pixel distribution in the connected domain. Then, the angle between this principal direction and the tangent direction of the pre-extracted weld centerline is calculated to obtain the principal direction deviation angle of the region, which is used to characterize the degree of deviation between the target direction and the overall direction of the weld. Finally, the aspect ratio, thinness, and principal direction deviation angle of the candidate region and the first reference region are subtracted one by one in each dimension to form the geometric dimension difference feature, which quantifies the degree of morphological abnormality of the target in the candidate region relative to the normal background.

[0093] Texture features can be extracted from the gray-level co-occurrence matrix, local binary pattern, or local entropy. When extracting texture difference features, texture features are extracted separately for candidate regions and the first reference region using completely identical rules. There are three typical implementation paths:

[0094] When extracting based on the gray-level co-occurrence matrix, the gray levels of pixels within the region are first quantized to a fixed number of levels to compress the calculation dimension. The unit neighborhood step size and four statistical directions of 0°, 45°, 90°, and 135° are set. The co-occurrence frequency of different gray-level value pairs in each direction is counted and normalized to obtain the gray-level co-occurrence probability matrix. Then, based on this matrix, four statistical measures are calculated: contrast reflecting the strength of texture step, energy representing the uniformity and regularity of texture, entropy reflecting the degree of disorder of texture information, and correlation measuring the linear correlation of gray-level distribution. The same indicators in the four directions are averaged and concatenated to obtain a 4-dimensional gray-level co-occurrence matrix texture feature vector.

[0095] When extracting based on local binary patterns, a fixed neighborhood is selected centered on each pixel within the region. The gray values ​​of the neighboring pixels are compared one by one with the gray value of the center pixel. If the value is greater than or equal to the center value, it is recorded as 1, and if it is less than, it is recorded as 0. The values ​​are combined in a fixed order to form a binary code and converted into a decimal pattern value. After traversing all valid pixels in the region, the frequency of occurrence of all patterns is counted and normalized to obtain a pattern distribution histogram, which is then arranged in numerical order to form a local binary pattern texture feature vector of the corresponding dimension.

[0096] When extracting based on local entropy, a fixed-size sliding window is moved pixel by pixel within the region. The probability of each gray level in the gray distribution within each window is statistically analyzed, and the local gray entropy of the window is calculated by substituting it into the information entropy formula. After traversal, the mean, standard deviation, and extreme value statistics of the local entropy sequence of the entire region are solved to form a local entropy texture feature vector. After obtaining the texture feature vectors of the candidate region and the first reference region that are perfectly aligned in dimension, the difference is calculated one by one according to the feature dimension order to finally obtain the difference features of the texture dimension, which can reflect the degree of difference between the candidate region and the normal weld background in terms of micro-texture distribution and texture complexity.

[0097] When extracting edge gradient features, the candidate region and the first reference region are processed using completely consistent calculation rules to ensure that the feature dimensions and calculation logic are fully aligned: First, the grayscale image covering the region is preprocessed with Gaussian smoothing. A fixed-size Gaussian kernel is used for pixel-by-pixel weighted filtering to suppress particle noise from ray imaging and avoid noise-induced pseudo-gradient interference with feature statistics. Then, 3×3 Sobel horizontal and vertical templates are used to perform convolution operations with the grayscale pixel matrix within the region, respectively, to obtain the horizontal and vertical gradient components of each effective pixel. The square root of the sum of the squares of the two gradient components is then used to calculate the gradient magnitude of the pixel. Simultaneously, the gradient direction angle of the pixel is derived through arctangent calculation, with a value range covering 0° to 180°. This completes the gradient extraction of all pixels in the region. After the degree calculation, multi-dimensional gradient feature statistics are carried out: First, the mean, standard deviation, and maximum value of the gradient amplitude of all effective pixels are calculated to characterize the overall edge strength and fluctuation of the region; Second, a gradient amplitude threshold is preset, and the proportion of strong edge pixels with amplitudes higher than the threshold is calculated to reflect the density of significant edges in the region; Third, the gradient direction is evenly divided into multiple equal-width intervals, and the proportion of pixels in each directional interval is calculated to form a gradient direction distribution histogram feature; Finally, the amplitude statistical features and the directional distribution features are concatenated in a fixed order to obtain the edge gradient feature vector of the region. The feature vectors of the candidate region and the first reference region are subtracted one by one according to their dimensions to obtain the difference features of the edge gradient dimensions, which quantifies the degree of abnormality of the edge strength and distribution pattern of the candidate region relative to the normal weld background.

[0098] All differential features are concatenated to form the differential feature vector of the candidate region:

[0099]

[0100] The difference feature vector corresponding to the i-th candidate region is composed of multi-dimensional difference features concatenated in sequence, and is used to comprehensively characterize the degree of abnormality of the candidate region relative to the normal weld background.

[0101] The difference feature subset of the edge gradient dimension consists of gradient magnitude statistics, the proportion of strong edge pixels, and the difference in gradient direction distribution, reflecting the differences between the two in edge strength and edge distribution pattern.

[0102] The geometric morphology dimension difference subset consists of the differences in aspect ratio, thinness, and principal direction angle, which characterize the degree of morphological abnormality of the target within the candidate region relative to the normal background.

[0103] The subset of differences in gray-scale statistical dimensions consists of the differences between the candidate region and the first reference region in gray-scale statistical indicators such as gray-scale mean and gray-scale standard deviation, reflecting the differences in their attributes in terms of macro gray-scale baseline and gray-scale uniformity.

[0104] The difference subset of texture features is composed of the difference between gray-level co-occurrence matrix statistics, local binary pattern distribution, or local entropy texture indices, reflecting the differences between the two in micro-texture distribution and texture complexity.

[0105] Dissimilarity feature vectors This is used to characterize the degree of anomaly of the candidate region relative to the normal weld background. Compared to analyzing only the candidate region itself, this embodiment introduces a first reference region to achieve anomaly relative quantity modeling under the same image background conditions.

[0106] Four types of difference features—grayscale statistics, geometric morphology, edge gradient, and texture—were chosen to construct the difference feature vector because they comprehensively cover the abnormal behavior of weld defects relative to the normal background from different physical levels and observational dimensions. They complement and corroborate each other. Specifically: grayscale statistics reflect the degree of deviation and uniformity of the grayscale baseline between the candidate region and the normal background at the macroscopic grayscale level, and matching X-ray defects often exhibit imaging characteristics of low grayscale dark areas; geometric morphology describes the length, width, slenderness, and orientation characteristics of the target at the structural shape level, which can distinguish defects of different shapes from regular weld processing traces. Edge gradient differences reflect the strength, density, and directional distribution of edges within a region at the meso-level boundary, corresponding to the gray-scale step characteristics brought about by the defect contour; texture differences reflect the complexity and distribution pattern of textures within a region at the micro-level detail, distinguishing between the smooth texture of normal welds and texture disturbances caused by defects; the difference feature vector formed by the combination of these four factors can characterize the abnormal attributes of candidate regions in a multi-dimensional and comprehensive manner, avoiding the problem of easy confusion between single-dimensional features and background textures and imaging noise, and providing rich discrimination basis for subsequent defect prototype matching and multi-modal reasoning, ensuring the accuracy and robustness of anomaly judgment.

[0107] In S140, the candidate region First reference area , differential feature vector and process metadata The common input is a multimodal large model, which generates a set of defect hypotheses for candidate regions based on visual content, differential features, and working condition semantics.

[0108] Among them, process metadata It is used to provide the model with a semantic context of the working conditions, so that the model reasoning process no longer relies solely on local texture features, but can make judgments in combination with the industrial context.

[0109] The first set of defect hypotheses output by the multimodal large model is denoted as:

[0110]

[0111] in, Represents the i-th candidate region. The first defect category This indicates the i-th candidate region. The first initial confidence level for the first defect category This indicates the i-th candidate region. The attribute descriptions for the first defect category include, but are not limited to, “slender”, “round”, “sharp edge”, “low contrast”, and “uneven texture”. This represents the process prior score for the first defect category.

[0112] Unlike existing methods that directly output a single category from the model, this embodiment does not require a large multimodal model to output the final conclusion all at once. Instead, it first generates multiple candidate hypotheses and then verifies them one by one in subsequent steps. This reduces the influence of chance in a single inference and improves the stability of category judgment.

[0113] In one implementation, the input to the multimodal large model consists of candidate regions, a first reference region, differential feature text descriptions, and process metadata. In another implementation, the differential feature vectors can be encoded into discrete cue tags or structured attribute sequences and then input into the multimodal large model to enhance the model's explicit perception of candidate-reference differences.

[0114] After acquiring candidate regions, first reference regions, differential feature vectors, and process metadata, the multimodal large model first extracts the visual semantic features of the candidate regions through a visual understanding module. Combining the relative anomaly degree quantified by the differential feature vectors and the X-ray imaging conditions provided by the imaging data, it matches common defect types within its knowledge system of industrial weld defects. It then infers and filters out several highly probable defect categories, sorts them by inference probability from high to low, and outputs the first defect category corresponding to the j-th defect hypothesis. While generating each defect hypothesis category, the multimodal large model, based on the matching degree between the visual features of the candidate region and the typical visual features of the corresponding defect, and the fit between the differential feature vector and the abnormal pattern of the defect category, obtains the first initial confidence level for each first defect category through internal probabilistic inference and normalization calculation. The higher the value, the higher the probability that the model initially determines that the first defect category is valid.

[0115] During the defect category identification process, the multimodal large model simultaneously performs semantic extraction of visual attributes such as the shape and contour of the target within the candidate region, the clarity of the boundary, the strength of grayscale contrast, and the uniformity of texture. Combined with the quantified anomaly information of geometric, edge, and texture dimensions in the differential features, it generates concrete attribute description text for the corresponding defect category, such as thin and elongated, round, sharp boundary, low contrast, and uneven texture, and outputs the attribute description bound to the j-th first defect category. .

[0116] For each first defect hypothesis category, the multimodal large model generates a corresponding process prior score based on the input process metadata through an independently configured process prior output head. The process prior output head only receives the encoded features of the welding process data and does not receive candidate regions, first reference regions, difference feature vectors, or imaging data.

[0117] During the training phase, multiple historical weld inspection samples were acquired. Each historical weld inspection sample was labeled with welding process data and defect categories confirmed by experts. The historical weld inspection samples were divided into multiple process condition groups according to the same or similar material, wall thickness, welding method, welding position and welding parameters. The occurrence frequency of each defect category under each process condition group was statistically analyzed, and the occurrence frequency was smoothed to obtain the conditional occurrence probability of each defect category under each process condition group.

[0118] The probability of occurrence of the aforementioned conditions is used as a process prior supervision label to train the process prior output head, enabling the process prior output head to learn the correspondence between welding process conditions and the probability of occurrence of each defect category.

[0119] During online inspection, the process prior output head outputs a process prior score for each first defect category based on the welding process data corresponding to the X-ray image to be evaluated. The process prior score is used to characterize the prior probability of the corresponding defect category occurring under the corresponding welding process conditions, and the value range of the process prior score is [0,1].

[0120] When the number of historical samples corresponding to a certain process condition group is insufficient, the occurrence probability of process condition groups corresponding to similar wall thicknesses, the same welding methods, or similar welding parameters can be used, or the overall occurrence probability of the corresponding defect category in all historical samples can be used. After smoothing, the process prior supervision label corresponding to the process condition group can be determined. During the online detection phase, the trained process prior output head still outputs the process prior score for each first defect category based on the welding process data corresponding to the X-ray image to be evaluated.

[0121] In S150, to further improve the stability of the final identification result, this embodiment establishes a prototype difference vector for each first defect category, denoted as: ,in, Characterizing the first The typical differential characteristics of each first defect category under the candidate-reference control condition can be obtained from the statistics of historically labeled samples.

[0122] The difference feature vector of the candidate region and Perform a match and obtain a match score:

[0123]

[0124] in, express Norm.

[0125] This represents the matching score of the j-th first defect category in the i-th candidate region.

[0126] During the online matching phase, for the i-th candidate region to be determined, its differential feature vector is calculated. Afterwards, Prototype difference vector with the first defect category Pairing calculations are performed: Since the historical region and the candidate region have the same size, their difference vector dimensions are perfectly aligned. The difference between the corresponding feature values ​​of the two vectors can be calculated directly dimension by dimension, and the absolute value is taken. The absolute values ​​of all dimensions are summed to obtain the L1 norm (Manhattan distance), which is used to quantify the overall feature difference between the candidate anomaly pattern and the typical defect pattern. This L1 distance is then substituted into the matching score formula, and an exponential operation is performed on the negative L1 distance with the natural constant e as the base to obtain the matching score. The exponential transformation monotonically maps non-negative distance values ​​to the range of (0,1). When the candidate difference features completely match the defect prototype, the distance is 0 and the score is 1. The larger the feature difference, the score decreases exponentially and approaches 0. The higher the final score, the higher the degree of fit between the abnormal feature pattern of the candidate region and the typical prototype of this type of defect.

[0127] In this embodiment, the L1 norm is used to calculate the distance between the difference feature vector and the prototype difference vector. The feature deviation can be accumulated dimension by dimension to comprehensively measure the overall deviation between the candidate anomaly pattern and the typical defect pattern. Moreover, the L1 distance is more robust to single-dimensional outliers and can weaken the disturbance of individual feature dimensions caused by weld imaging noise and local texture fluctuations, resulting in more stable matching results. The distance is mapped to the matching score in a negative exponential form. On the one hand, the inverse distance index of "the greater the difference, the higher the value" can be converted into the positive matching score of "the higher the fit, the higher the value", which is consistent with the semantic logic of the matching score. On the other hand, the unbounded distance value can be monotonically compressed to the (0,1] interval, so that the matching score and the confidence and process prior scores output by the subsequent multimodal model are at the same numerical level, which is convenient for the subsequent fusion and adjudication of multi-source results. At the same time, the exponential decay characteristic can quickly reduce the weight of categories with large differences and retain fine discrimination of highly similar categories, effectively filtering defect categories with low matching degree and highlighting high probability defect hypotheses. The overall calculation process has no complex hyperparameters, clear physical meaning, and strong engineering interpretability and feasibility.

[0128] In this embodiment, prior to S150, the method proposed in this embodiment further includes:

[0129] Multiple historical samples are acquired, wherein each historical sample is labeled with a historical region containing a first defect category, and the size of the historical region is the same as the size of the candidate region; an initial difference vector is determined based on the historical visual feature vector of the historical region and the second reference visual feature vector of the historical sample and the second reference region of the historical region; and the prototype difference vector is determined based on all the initial difference vectors.

[0130] In this embodiment, prototype difference vectors for various defects are first constructed offline, specifically through the following steps: First, multiple historical weld radiographic inspection samples, confirmed by certified nondestructive testing experts, are obtained. Each historical sample is marked with a historical region containing a first defect category. The cropping size of the historical region is strictly consistent with the candidate region size during online inspection, ensuring complete alignment of the subsequent feature extraction dimensions and statistical standards in terms of spatial scale. Second, for each historical sample, the historical visual feature vector of the historical region is extracted, along with the second reference visual feature vector of the second reference region paired with that historical region. The second reference region is obtained by completely replicating the online inspection process, constructing candidate regions adjacent to the weld centerline along the historical region, and filtering them using a quality evaluation function. Both the historical visual feature vector and the second reference visual feature vector cover four categories of indicators: grayscale statistics, geometric shape, edge gradient, and texture features. The initial difference vector of the corresponding sample is calculated based on these two types of visual feature vectors. Third, all initial difference vectors are grouped according to the first defect category. The arithmetic mean of all initial difference vectors under the same category is calculated for each feature dimension, ultimately yielding the prototype difference vector of the j-th defect category. Its dimension and the feature vector of the candidate region difference Completely consistent, it can characterize the typical abnormal feature patterns of this type of defect under uniform size and candidate-reference control conditions.

[0131] In S160, for each first defect category generated in S140 Construct several verification views for each first defect category. Repeated verification is performed. The verification view is obtained by applying different local enhancements, edge enhancements, noise suppression, local occlusions, or local contrast stretching to the candidate region, denoted as:

[0132]

[0133] in, This indicates the number of validation views, and t represents the index of the validation view.

[0134] Among them, local enhancement, edge enhancement, noise suppression, local occlusion, and local contrast stretching all represent specified operation items.

[0135] The preset image processing tools specifically refer to five types of targeted image processing operations: local enhancement, edge enhancement, noise suppression, local occlusion, and local contrast stretching. These tools are used to construct the verification view because they apply controllable perturbations to the visual appearance of the candidate region from five different dimensions: grayscale distribution enhancement, edge contour sharpening, imaging noise smoothing, local feature occlusion, and local contrast stretching. This does not change the core shape and essential attributes of the defect, but can simulate real-world scenarios such as transmission parameter fluctuations, imaging noise differences, local artifact occlusion, and insufficient contrast commonly encountered in on-site inspections. This allows for a comprehensive examination of the stability of the multimodal large model's recognition results for the same defect under different visual disturbances. The consistency score calculated in this way can effectively filter out misjudgments caused by accidental factors in a single imaging session, selecting more robust defect judgment conclusions. At the same time, these operations have low computational costs, interpretable transformation logic, and are suitable for the actual needs of engineering implementation.

[0136] For example, the specific operation method for the specified operation item mentioned above can be:

[0137] The local enhancement operation generates a corresponding local enhancement verification view: taking the candidate region as an independent processing unit, firstly, the mean gray level, extreme gray level, and dynamic distribution range within the region are statistically analyzed. Then, a piecewise linear gray-level mapping function is constructed by combining preset enhancement coefficients. This function specifically compresses the gray-level range in dark areas and expands the distribution width of the mid-to-high gray-level range, thereby increasing the gray-level difference within the region. The processing only applies to pixels within the candidate region. Linear gray-level transition interpolation is performed at the region boundaries to eliminate abrupt boundary traces. Finally, a local enhancement verification view corresponding to the local enhancement operation is output, which can enhance the subtle defect features of low contrast.

[0138] Edge enhancement operation generates an edge enhancement verification view: Candidate regions are processed using an anti-sharpening mask combined with directional weighting. First, Gaussian blur is applied to the candidate regions to obtain a smooth base image. The original region image and the smooth base image are then subtracted pixel by pixel to extract high-frequency detail components containing edges and textures. Subsequently, differential gain weights are set based on the weld seam direction, assigning higher enhancement coefficients to high-frequency components perpendicular to the weld seam extension direction to strengthen the defect contour, while moderately suppressing artifact components along the weld seam direction. Finally, the weighted high-frequency components are superimposed back onto the original image to output an edge enhancement verification view that corresponds one-to-one with the edge enhancement operation, making the defect boundaries clearer and sharper.

[0139] The noise suppression operation generates a corresponding noise suppression verification view: an adaptive bilateral filter is used to traverse all pixels within the candidate region. A fixed-size sliding window is used to calculate the spatial distance weight and grayscale similarity weight of each pixel. The filtered output value of the center pixel is obtained by weighted summation based on the dual weights. Pixels with closer spatial distances and smaller grayscale differences have higher weights. This smooths particle noise in uniform matrix regions and preserves contour details at edge positions. At the same time, the filtering intensity is dynamically adjusted according to the standard deviation of the window grayscale. After processing, a noise suppression verification view corresponding to the noise suppression operation is output, which can filter imaging noise interference while preserving defect features.

[0140] The partial occlusion operation generates a partial occlusion verification view: This operation is mostly used for constructing verification views during the training phase. One or more occlusion regions are randomly selected within the candidate region. The total area of ​​the occlusion regions accounts for 5% to 30% of the candidate region area, and the occlusion regions do not completely cover the main abnormal targets within the candidate region, so that the main visual features used to identify the defect category are still retained after occlusion processing. The shape of the occlusion regions is rectangular, elliptical, or irregular strip-shaped to simulate actual artifacts and occlusion interference. The occlusion regions are filled with the average gray value of the surrounding weld background or random gray values ​​that conform to the background gray value distribution, so that the gray value characteristics of the occlusion regions match those of the surrounding background. After processing, the partial occlusion verification view corresponding to the partial occlusion operation is output to verify the robustness of the defect recognition model to local interference and partially occluded defects.

[0141] The local contrast stretching operation generates a corresponding local contrast stretching verification view: Candidate regions are processed using a limited contrast adaptive histogram equalization method. First, the candidate region is divided into multiple non-overlapping sub-blocks of the same size. The grayscale histogram of each sub-block is calculated, and a preset truncation threshold is set for the histogram. High-frequency grayscale components exceeding the threshold are evenly distributed across the entire grayscale range to avoid excessive noise amplification. Then, a grayscale mapping function is constructed based on the corrected histogram to perform pixel transformation. Bilinear interpolation is used at the boundary pixels of adjacent sub-blocks to achieve a smooth transition and eliminate block artifacts. After processing, a local contrast stretching verification view corresponding one-to-one with the local contrast stretching operation is output, allowing for targeted stretching of local grayscale contrast and enhancement of grayscale differences in subtle defects.

[0142] In S170, each verification view is... Together with the first reference area The attribute description corresponding to the first defect category is input into the multimodal large model to obtain the verification results for each view. Define the first defect category. The consistency score is:

[0143]

[0144] in, This is an indicator function that takes the value 1 when the condition within the parentheses is true, and 0 otherwise. This represents the consistency score of the j-th first defect category in the i-th candidate region.

[0145] In this embodiment, the verification view will be used. First reference area The attribute descriptions corresponding to the first defect category obtained in S140 are input into the multimodal large model, and the multimodal large model outputs each verification view. The second defect hypothesis set includes N2 second defect categories and a second initial confidence level for each second defect category. The verification result of the verification view is determined based on the second defect category with the highest second initial confidence level, wherein the second defect category with the highest second initial confidence level is the same as the first defect category. The verification result indicates that the verification is successful. The consistency score is determined based on the number of verification views that have passed verification.

[0146] In this embodiment, Indicates when Represents the validation view When the first defect category is the same, the indicator function is set to 1 when they are completely consistent, and 0 when they are inconsistent. After traversing all T verification views, the values ​​of all indicator functions are summed and divided by the total number of verification views T to obtain the consistency score of the defect hypothesis. The score range is [0,1]. The higher the value, the more stable the recognition result of the first defect category under different image transformation interference, and the stronger the robustness and reliability of the judgment conclusion.

[0147] In this embodiment, only the verification view needs to be input in S170. Together with the first reference area The reason for describing candidate hypothesis categories is as follows: The goal of the initial defect hypothesis generation stage is to comprehensively explore the abnormal attributes of candidate regions and generate multi-dimensional defect hypotheses. Therefore, it requires inputting full-volume, multi-source information such as differential feature vectors, candidate regions, and process metadata. Through joint reasoning of structured quantitative features and visual and process information, the comprehensiveness and accuracy of the initial hypothesis are ensured. The goal of this stage is to verify the visual robustness of the defect hypothesis, that is, to test whether the model's recognition result for the same defect category is stable when the visual representation of the candidate region undergoes local image processing transformations. Essentially, it is a stability check of the correspondence between visual features and defect categories. Therefore, the input only needs to be designed around the verification logic of "visual comparison + category anchoring." The verification view... It is the visual carrier of the candidate region after a specified transformation, which fully carries the visual information of the candidate region and can directly replace the original candidate region; the first reference region. To maintain the "candidate-reference" same-image comparison judgment paradigm, this ensures that the model's judgment benchmark is aligned with the initial stage, avoiding benchmark deviation from interfering with the verification results. The corresponding attribute description text provides the model with clear verification anchors, guiding the model to perform matching verification for specified defect categories and their typical visual attributes, rather than regenerating all defect categories freely, thus focusing on the verification target while improving inference efficiency.

[0148] The reason why parameters such as the difference feature vector and process metadata do not need to be input is that both are fixed quantities that do not change with image processing transformations: the difference feature vector is calculated based on the original candidate region, and its value remains unchanged. If it were input during the verification stage, it would dominate the model's judgment, ensuring that the recognition result always remains consistent with the initial hypothesis, completely eliminating the visual disturbances brought about by image processing transformations, and losing the meaning of verifying visual robustness; the process metadata is globally stable prior information, which would also fix the model's prior bias and fail to truly reflect the impact of visual feature changes on the recognition result. This input design allows the judgment result in the verification stage to be determined only by the stability of the matching between visual features and categories. The resulting consistency score can truly reflect the visual robustness of the defect hypothesis, while avoiding the repeated calculation of multi-view difference features, thus balancing the validity of verification and the computational efficiency for engineering implementation.

[0149] In this embodiment, if a certain first defect category of a candidate region remains consistent across multiple verification views, it indicates that the hypothesis has strong stability; if the verification results fluctuate frequently, it indicates that the hypothesis is unreliable and may belong to a false defect or difficult example region. Through this consistency score, the "first output" of the multimodal large model can be converted into the "verified output".

[0150] In one implementation, the generation order of the verification view follows the principle of "low-cost perturbation first," that is, local contrast enhancement and edge enhancement are performed first, followed by occlusion verification and noise suppression verification. This ensures both the sufficiency of verification and helps control computational costs.

[0151] Unlike existing methods that directly draw conclusions based on single-image classification results, this embodiment constructs a complete verification and reasoning chain by "first generating defect hypotheses, and then using multiple views to verify these hypotheses." This mechanism has significant advantages for defects such as cracks and inclusions that exhibit significant differences in behavior under different reinforcement methods.

[0152] In S180, such as Figure 2 As shown, the specific steps include the following:

[0153] S181: The consistency score, matching score, first initial confidence level and process prior score corresponding to each first defect category are weighted and averaged to obtain the fusion decision score of the first defect category.

[0154] S182: Compare the maximum fusion decision score with a preset threshold to obtain the comparison result;

[0155] S183: Based on the comparison results, determine the detection results, wherein when the comparison results indicate that the largest fusion decision score is greater than or equal to a preset threshold, the first defect category corresponding to the largest fusion decision score is the detection results.

[0156] In S181, the first initial confidence level is given by combining the multimodal large model. Consistency score and process prior score The fusion score can be expressed as:

[0157] in,

[0158] These represent the weights of the initial confidence level, consistency score, matching score, and process prior score, respectively. This represents the fusion decision score for the j-th first defect category of the i-th candidate region.

[0159] In this embodiment, the normalization calibration of the sub-item scores is first performed. Among the four input scores, the matching score... After negative exponential mapping, the natural value is in the interval (0,1], resulting in a consistency score. The initial confidence score is calculated based on the proportion of consistent views to the total number of verified views, naturally falling within the [0,1] interval. Since both scores have a consistent numerical standard, they can directly participate in subsequent weighted calculations. The first initial confidence score can be probabilistically calibrated or normalized based on the full set of historical labeled samples, ensuring its value falls within the [0,1] interval. The process prior score is output from the process prior output head through a preset probability mapping function, and its value falls within the [0,1] interval, eliminating the need for further min-max normalization. The consistency score and matching score naturally fall within the [0,1] and (0,1] intervals, respectively; therefore, all four scores can directly participate in subsequent weighted calculations.

[0160] After completing the normalization preprocessing, for the j-th first defect category of the i-th candidate region, the normalized initial confidence score, consistency score, matching score, and process prior score are respectively compared with their corresponding weight coefficients. Multiply the results, then sum the four weighted results one by one to obtain the final fusion decision score for the defect hypothesis. All weight coefficients are non-negative and satisfy the following conditions: The sum of the constraints is 1. The weight values ​​can be determined by optimization through grid search on the validation set, or by industry experts combined with engineering experience. The decision weights of each dimension can be adjusted according to the needs of the scenario to achieve a comprehensive multi-dimensional decision on inference confidence, recognition stability, feature matching degree and process rationality.

[0161] The aforementioned full-scale historical labeled samples are a benchmark dataset for radiographic inspection of small-diameter boiler tube welds, completely consistent with the data caliber of this inspection method throughout the entire process. It covers common pipe specifications, welding processes, defect types, and imaging conditions encountered in the field. It includes positive samples of defects such as porosity, cracks, incomplete penetration, lack of fusion, and slag inclusions, all confirmed by certified non-destructive testing experts, as well as negative samples of defect-free weld substrates, forming ripples, surface scratches, and artifacts. Each sample strictly replicates the complete online inspection process, including the corresponding original radiographic image, weld analysis area, and a cropped image of the historical defect area consistent with the online inspection dimensions. The system includes the optimal first reference region selected by the quality evaluation function, the pre-calculated four-dimensional difference feature vector of gray-scale, geometry, edge and texture, welding process data, and the defect category ground truth, confidence ground truth and standard attribute description calibrated by the evaluation experts. It also includes process prior supervision labels obtained by grouping process conditions, statistically analyzing occurrence frequency and smoothing based on the welding process data and defect category ground truth of historical samples. At the same time, it is also the statistical data source of various defect prototype difference vectors in S150. It is a unified benchmark for algorithm parameter calibration, score normalization and performance verification. The data distribution is completely matched with the actual engineering detection conditions.

[0162] Corresponding to the weighted average processing step in S181, the final fusion decision score is calculated using offline confidence calibration and online multi-dimensional weighted fusion. When necessary, the first initial confidence is probabilistically calibrated or normalized using the full set of historical labeled samples as the calibration benchmark, so that its value is in the [0,1] interval. When using the min-max normalization method, the full set of historical labeled samples is input into the multimodal large model according to the complete processing flow of this method, and the first initial confidence of all samples for each type of defect is collected. The global maximum and global minimum values ​​of the first initial confidence are statistically obtained, and this set of extreme values ​​is stored as fixed configuration parameters, which are directly called during online inference without repeated calculation. Among them, the consistency score naturally takes the value in the [0,1] interval, the matching score naturally takes the value in the (0,1] interval after negative exponential mapping, and the process prior score is output by the process prior output head through a preset probability mapping function and is in the [0,1] interval. None of the three require additional normalization processing.

[0163] During the online inference phase, for the j-th first defect category of the i-th candidate region, if necessary, the initial confidence score is first subjected to probability calibration or normalization. Then, the initial confidence score, consistency score, matching score, and process prior score, which are in a uniform numerical range, are multiplied by their corresponding weight coefficients and summed one by one to obtain the final fusion decision score. All weight coefficients are non-negative and satisfy the constraint that the sum is 1. The weight values ​​can be determined by grid search optimization based on the full set of historical labeled samples, or they can be calibrated by industry experts in combination with engineering experience. This achieves a multi-dimensional comprehensive decision on model inference confidence, recognition result stability, feature pattern matching degree, and process rationality.

[0164] In this embodiment, in S182 and S183, the first defect category with the highest score is selected and compared with a preset judgment threshold. If the score is greater than or equal to the threshold, the first defect category is output as the final detection result. If the score is lower than the threshold, the candidate region is marked as a region to be reviewed.

[0165] In one implementation, it is understood that when two or more first defect categories have the same fusion decision score at a preset numerical precision, and both are the highest fusion decision scores, the sub-scores corresponding to each parallel category can be compared step by step. First, the initial confidence scores corresponding to each parallel category are compared, and the first defect category with the higher initial confidence score is selected as the detection result. The initial confidence score is used to characterize the initial judgment result made by the multimodal large model on the corresponding first defect category based on the visual features, difference features, and imaging condition information of the candidate region. When the initial confidence scores corresponding to each parallel category are still the same, the consistency scores are further compared, and the first defect category with the higher consistency score is selected; the consistency score is used to characterize the recognition stability of the corresponding first defect category under multiple verification views. When the consistency scores corresponding to each parallel category are still the same, the matching scores are further compared, and the first defect category with the higher matching score is selected; the matching score is used to characterize the degree of matching between the difference feature vector of the candidate region and the prototype difference vector of the corresponding first defect category. When the matching scores for each parallel category are still the same, the prior process scores are further compared, and the first defect category with the higher prior process score is selected first. The prior process score is used to characterize the prior probability of the corresponding first defect category occurring under the current welding process conditions. When the scores for the above sub-items for each parallel category are the same, the candidate area can be marked as a multi-category suspected area to be reviewed and submitted to manual evaluation for further confirmation; or, in application scenarios that require automatic output of a single defect category, the first defect category with the higher hazard level is output according to the preset defect hazard level order.

[0166] In this embodiment, a fusion decision score is constructed by integrating four parameters: initial confidence, consistency score, matching score, and process prior score. This is because these four parameters comprehensively verify the defect hypothesis from four complementary dimensions: model inference confidence, robustness of recognition results, feature pattern matching degree, and rationality of process mechanism. This effectively avoids the inherent defects of a single decision dimension and ensures the accuracy and engineering rationality of the final detection results. The initial confidence carries the comprehensive inference result of the multimodal model on the visual features, relative anomaly features, and imaging condition information of the candidate region, and is the basis for determining the defect category. The consistency score is obtained based on multi-view transformation verification and can measure the stability of the defect category recognition result under different image processing perturbations. It can filter out single errors caused by local noise and accidental imaging interference. The system filters out more robust defect hypotheses by identifying the first false positive. The matching score relies on typical defect feature prototypes statistically analyzed from historical labeled samples. It verifies the fit between candidate anomaly patterns and known defect patterns from the perspective of quantitative feature matching, providing independent statistical feature verification for model inference and forming a two-way verification between traditional algorithms and deep learning models. The process prior score starts from the welding process mechanism and industry statistical laws, matching the inherent probability of various defects under different pipe specifications and welding methods. It can eliminate low-probability assumptions that do not conform to the working condition logic, making the judgment results consistent with engineering reality. The four complement each other and constrain each other, taking into account the generalization reasoning ability of the model while retaining the interpretability of statistical features and the compliance of process mechanisms. This can effectively reduce the probability of false positives and false negatives and improve the overall reliability of weld defect detection.

[0167] Based on this, the aforementioned multimodal large model belongs to the multimodal large language model adapted to vertical tasks. It is a domain-specific model obtained by fine-tuning the general multimodal large language model with specific instructions for the radiographic inspection of small-diameter weld seams in boilers. Its underlying layer has the cross-modal understanding, semantic reasoning, and knowledge association capabilities of the general multimodal large language model. It can simultaneously process multimodal inputs such as images, structured numerical values, and text descriptions. At the same time, through task boundary constraints and instruction constraints, it outputs structured results only around four fixed objectives: weld defect category determination, confidence quantification, attribute semantic description, and process prior matching. There is no open-ended, freely generated content. It retains the advantages of multi-source information fusion and reasoning of large language models, and ensures the stability and controllability of the output through targeted constraints, effectively reducing the black-box uncertainty of general generative large models.

[0168] This multimodal large language model adopts a three-stage progressive training process: "general base pre-training - domain incremental adaptation - task instruction fine-tuning". Each stage is matched with corresponding training data and supervision objectives.

[0169] The first stage is the pre-training of the general foundation, which is carried out based on large-scale public general image and text datasets and multimodal pre-training data. The model is trained through image and text comparison learning and autoregressive language modeling tasks, so that it has basic visual feature understanding, natural language semantic representation and cross-modal information alignment capabilities, forming a general multimodal large language model foundation.

[0170] The second stage is incremental pre-training in the field of welds. The training data includes digital radiographic films of small-diameter pipe welds at engineering sites, formal evaluation reports from certified film evaluators, text of the NB / T47013 non-destructive testing standard, welding process specifications and typical defect atlases. The field's graphic and textual data are injected into the model to continue pre-training, allowing the model to learn the imaging rules of weld defects, the industry terminology system and process background knowledge, and complete the cognitive transfer from general capabilities to weld vertical categories.

[0171] The third stage is the supervision and fine-tuning of the target task instructions. Specialized labeled samples matching the paradigm of this task are used. Each sample takes "candidate region + first reference region + differential feature vector + process metadata" as multimodal input. The defect categories, confidence levels and standard attribute descriptions calibrated by experts, as well as process prior supervision labels obtained by grouping process conditions, statistically analyzing occurrence frequency and smoothing based on welding process data and defect category ground truth values ​​of historical samples, are used as supervision information. Multimodal instruction samples are constructed through standardized instruction templates, and the cross-modal alignment layer and top-level output parameters of the model are fine-tuned with a small learning rate to make the model accurately adapt to the input-output logic and inference rules of this task.

[0172] This multimodal large language model adopts a standard multimodal large model architecture consisting of a "visual encoding module—cross-modal alignment and fusion layer—large language model backbone + multi-task structured output head." The functional boundaries of each module are clear and traceable: The first layer is a dual-branch visual encoding module with shared weights, which uses a general VisionTransformer visual encoder to extract multi-scale features from candidate and reference region images, outputting a high-dimensional visual feature sequence, which is the standard visual input component of the multimodal large model; The middle layer is a cross-modal alignment and fusion module, which uses a multi-layer linear projection network to uniformly map the visual feature sequence, structured differential feature vectors, and encoded imaging data features to the word embedding space of the large language model backbone, completing the dimensional alignment and semantic splicing of different modal features, and realizing the fusion input of multi-source information; The last layer performs semantic inference based on the Transformer architecture of the large language model backbone, and has four independent structured output heads, corresponding to four outputs: defect category, first initial confidence, attribute description, and process prior score. Each output can be traced back to the corresponding input features, and the inference link is interpretable and verifiable. The defect category output head, initial confidence output head, and attribute description output head receive cross-modal features formed by fusing candidate regions, first reference regions, difference feature vectors, and imaging data. The process prior output head only receives process features formed after encoding welding process data, and does not receive image features, difference feature vectors, or imaging data output by the visual encoding module. The encoded features of the welding process data are input to the process prior output head through an independent data path to avoid visual evidence from the current candidate region affecting the process prior score.

[0173] The three-stage training of this multimodal large language model is configured with corresponding loss functions for each stage, and the model parameters are optimized throughout the process through backpropagation of the loss. The supervision objectives are clear and traceable: The first stage, general foundation pre-training, adopts a joint loss of image-text comparison loss and autoregressive language modeling loss, which respectively constrains the semantic alignment ability of vision and text and the generative representation ability of general language. This is the standard loss function for multimodal large model pre-training. The second stage, domain incremental pre-training, adopts a joint loss of domain image-text alignment loss and domain language modeling loss. It uses image-text samples from the weld seam domain as supervision to strengthen the model's representation of domain knowledge and cross-modal matching ability. The third stage, instruction fine-tuning, adopts a multi-dimensional explicit constraint multi-task joint loss. Each loss corresponds to an independent output head and a corresponding supervision objective: one is the defect category classification cross-entropy loss, which uses the expert-calibrated defect category truth value as the ground truth value. The model employs four main methods: 1) Supervision and constraint on the accuracy of category inference; 2) Mean squared error loss on confidence regression, using expert-annotated confidence ground truth values ​​as a benchmark to constrain the accuracy of confidence quantification; 3) Semantic alignment loss on attribute descriptions, based on domain-pre-trained professional semantic vectors, calculating the semantic similarity deviation between generated attribute descriptions and standard labels to constrain the consistency between attribute descriptions and visual features; 4) Mean squared error loss on process prior score calibration, using process prior supervision labels obtained by grouping and smoothing process conditions according to historical welding process data and defect category ground truth values ​​as a benchmark to constrain the process prior score to match the conditional occurrence probability of each defect category under the corresponding welding process conditions; and finally, the four losses are weighted and summed according to preset weights to obtain the total loss, and the top-level parameters of the model are fine-tuned through gradient backpropagation to ensure the accuracy and rationality of each output dimension.

[0174] The following uses the identification of defects in radiographic images of small-diameter boiler pipe welds as an example to illustrate the method described in this embodiment.

[0175] 1. Data Input: Obtain the radiographic image of a small-diameter pipe weld in a boiler. The pipe diameter is 42mm, the wall thickness is 5.5mm, the detection voltage is 55kV, and the image is processed by grayscale normalization, contrast enhancement, and weld area localization.

[0176] 2. Candidate Region Extraction: Within the weld analysis area, a preset strategy is used to extract candidate regions, resulting in several candidate regions. .

[0177] 3. Construction of the first reference region: Select a normal weld background region with the same scale as each candidate region and which does not overlap with other candidate regions as the first reference region. .

[0178] 4. Differential Feature Modeling: Extract edge gradient features, morphological features, grayscale features, and texture features from the candidate region and the first reference region respectively, and construct differential feature vectors. .

[0179] 5. Hypothesis Generation: The candidate region, the first reference region, the differential feature vector, and process metadata are input into the multimodal large model to generate a Top-N1 defect hypothesis set for candidate defects. .

[0180] 6. Hypothesis Validation: Generate multiple local enhancement, edge enhancement, noise suppression, local occlusion, and local contrast stretching views for the candidate region. Combine these with the first reference region and input the multimodal large model again to repeatedly validate the Top-N1 defect hypothesis and obtain a consistency score. .

[0181] 7. Fusion Decision: The fusion decision score is calculated by combining the initial confidence score, consistency score, matching score, and process prior score output by the multimodal large model. The final defect category is then output based on the maximum score.

[0182] 8. Output Results: Output defect category, spatial location, and markers to be verified. The above method utilizes candidate-reference comparison and multi-view verification reasoning mechanisms to improve the accuracy and stability of identifying low-contrast, small-scale defects.

[0183] This application provides an electronic device that may include a processing module and a memory. The memory stores a computer program, which, when executed by the processor, enables the electronic device to perform the corresponding steps in the aforementioned weld defect detection method.

[0184] In this embodiment, the processor can be an integrated circuit chip with signal processing capabilities. For example, the processor can be a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.

[0185] The memory can be, but is not limited to, random access memory, read-only memory, programmable read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, etc.

[0186] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the electronic device described above can be referred to the corresponding steps in the aforementioned method, and will not be elaborated further here.

[0187] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the weld defect detection method as described in the above embodiments.

[0188] Computer-readable storage media may be magnetic disks, optical disks, read-only memory, random access memory, flash memory, USB flash drives, hard disks, or solid-state drives, etc., and may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implement the methods shown in the above embodiments.

[0189] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the weld defect detection method described above. The computer program product may exist in a computer-readable storage medium in forms including, but not limited to, source files, executable files, and installation package files.

[0190] Based on the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This software product can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, mobile hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, electronic device, or network device, etc.) to execute the methods described in the various implementation scenarios of this application.

[0191] In the embodiments provided in this application, it should be understood that the disclosed methods can also be implemented in other ways. The method embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or part of code, which includes one or more executable instructions for implementing a specified logical function. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0192] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for detecting weld defects, characterized in that, The method includes: Acquire the X-ray image to be evaluated, and the process metadata of the X-ray image; Based on a preset strategy, candidate regions suspected of having defects are extracted. The preset strategy refers to the strategy of using threshold segmentation, edge detection, or deep learning detection models to extract the candidate regions. Based on the candidate visual feature vector of the candidate region and the first reference visual feature vector of the first reference region, a difference feature vector is determined. The first reference region has the same size as the candidate region and is located outside all candidate regions of the ray image. The difference feature vector is used to characterize the degree of difference between the candidate region and the first reference region. The candidate region, the first reference region, the difference feature vector, and the process metadata are input into the multimodal large model. The first defect hypothesis set of the candidate region is obtained through the multimodal large model. The first defect hypothesis set includes N1 first defect categories, as well as the first initial confidence and process prior score of the first defect category, where N1 is an integer greater than or equal to 2. A matching score is determined based on the difference feature vector and the pre-calibrated prototype difference vector of the first defect category, wherein the matching score characterizes the degree of matching between the difference feature vector and the prototype difference vector. Based on a preset image processing tool, several verification views of the candidate region are constructed. The verification views are obtained by performing specified operations on the candidate region, and each verification view corresponds one-to-one with a specified operation. Based on the multimodal large model, a consistency score is obtained for each of the first defect categories, the consistency score being determined based on the number of verification views that have the same defects as the candidate region; The defect detection results of the candidate region are determined based on the consistency score, matching score, first initial confidence level, and process prior score. Between the step of extracting candidate regions suspected of having defects based on a preset strategy, and the step of determining the difference feature vector based on the candidate visual feature vector of the candidate region and the first reference visual feature vector of the first reference region, the method further includes: In the region outside all candidate regions of the X-ray image, a number of candidate regions are determined. All candidate regions have the same size as the candidate regions. The candidate regions are located on one side of the candidate regions, or the candidate regions and the candidate regions are located at adjacent positions along the weld centerline. Extract the grayscale value of each pixel in the candidate region; Based on the grayscale value of each pixel in the candidate region and the average grayscale of the weld analysis region in the X-ray image, a quality evaluation value for each candidate region is determined. The candidate region corresponding to the smallest quality evaluation value is the first reference region. The weld analysis region characterizes the effective range of the weld body in the X-ray image. The step of determining the defect detection result of the candidate region based on the consistency score, matching score, first initial confidence level, and process prior score includes: The consistency score, matching score, first initial confidence level, and process prior score corresponding to each first defect category are weighted and averaged to obtain the fusion decision score of the first defect category. The highest fusion decision score is compared with a preset threshold to obtain the comparison result; Based on the comparison results, the detection results are determined, wherein when the comparison results indicate that the largest fusion decision score is greater than or equal to a preset threshold, the first defect category corresponding to the largest fusion decision score is the detection result; when the largest fusion decision score is less than the preset threshold, the candidate region is determined as the region to be reviewed.

2. The method according to claim 1, characterized in that, The step of determining the quality evaluation value of each candidate region based on the grayscale value of each pixel in the candidate region and the average grayscale of the weld analysis area in the X-ray image includes: Based on the grayscale value of each pixel in the candidate region, determine the mean grayscale value, standard deviation grayscale value, and edge strength of the candidate region; The quality evaluation value is determined based on the difference between the mean gray value of the candidate area and the mean gray value of the weld analysis area in the X-ray image, the gray value standard deviation, and the edge strength.

3. The method according to claim 1, characterized in that, The step of obtaining a consistency score for each of the first defect categories based on the multimodal large model includes: Based on the multimodal large model, a second defect hypothesis set is obtained for each of the verification views. The second defect hypothesis set includes N2 second defect categories of the verification view and a second initial confidence level of the second defect category. The second defect category corresponding to the largest second initial confidence level is the final defect category of the verification view, and N2 is an integer greater than or equal to 2. The number of final defect categories that are the same as the first defect category is counted, wherein the number of final defect categories that are the same as the first defect category represents the number of verification views that have the same defects as the candidate region; The consistency score is determined based on the number of final defect categories that are identical to the first defect category.

4. The method according to claim 1, characterized in that, The step of determining the matching score based on the difference feature vector and the pre-calibrated prototype difference vector of the first defect category includes: Calculate the L1 norm of the difference between the difference feature vector and the prototype difference vector; The matching score is obtained based on the L1 norm.

5. The method according to claim 1, characterized in that, Before determining the matching score based on the difference feature vector and the pre-calibrated prototype difference vector of the first defect category, the method further includes: Multiple historical samples are obtained, wherein each historical sample is marked with a historical region containing a first defect category, and the size of the historical region is the same as the size of the candidate region; An initial difference vector is determined based on the historical visual feature vector of the historical region and the second reference visual feature vector of the historical sample and the second reference region of the historical region. The prototype difference vector is determined based on all the initial difference vectors.

6. An electronic device, characterized in that, The electronic device includes a processor and a memory coupled together, the memory storing a computer program that, when executed by the processor, causes the electronic device to perform the method as described in any one of claims 1 to 5.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Boiler weld defect identification method, electronic equipment and storage medium

    CN122134720A

  • Intelligent weld defect detection method based on X-ray image

    CN122335739A