Image Recognition-Based Evaporator Welding Defect Detection Method
By defining scan lines along the vertical direction of the weld in X-ray images, extracting the observed profile curves and calculating the vertical spatial entropy, and combining this with the K-Means clustering algorithm, the problem of confusing harmful defects with benign artifacts in X-ray image profile analysis is solved, thus achieving efficient automatic detection of weld defects.
Patent Information
- Application Number
- CN202511841029.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2045-12-09
AI Technical Summary
Existing X-ray image profile analysis methods lose vertical spatial information of the weld, making it impossible to distinguish between harmful internal defects and benign surface artifacts, resulting in a high false alarm rate.
An image recognition-based method is used to define a scan line along the vertical direction of the weld, extract the observed profile curve, calculate the maximum depth curve and vertical spatial entropy curve by baseline fitting and residual defect signal, and combine the K-Means clustering algorithm to distinguish surface artifacts and internal defects.
It enables automatic differentiation between benign artifacts and harmful defects without human intervention, significantly reducing the false alarm rate and improving the automation and reliability of detection.
Smart Images

Figure CN121280428B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of industrial non-destructive testing technology, specifically relating to an image recognition-based method for detecting welding defects in evaporators. Background Technology
[0002] In industries such as chemical and pharmaceutical manufacturing, MVR evaporators are key energy-saving devices. The quality of welds during the manufacturing process (such as cylinder assembly and sealing plate assembly) is an important line of defense to ensure equipment safety and prevent leakage of highly corrosive industrial wastewater.
[0003] Currently, the industry commonly uses X-ray radiography (RT) to detect harmful defects such as porosity, slag inclusions, and cracks within the weld by taking X-ray films or digital images. On X-ray images, these defects appear as low-grayscale (i.e., dark) areas. To achieve automated inspection, a common method is image profile analysis: scanning line by line along the weld centerline, extracting the grayscale values of pixels, and thus converting a two-dimensional X-ray image into a one-dimensional grayscale profile curve. On this curve, healthy weld areas appear as a stable baseline, while defective areas appear as downward troughs.
[0004] However, this traditional average profile or centerline profile method has a fatal flaw: it loses crucial spatial information perpendicular to the weld direction during dimensionality reduction, making it impossible to distinguish between harmful defects and benign artifacts. In real X-ray images, there are two types of dark areas with similar shapes but drastically different properties: one is benign surface artifacts, such as scratches or grinding grooves on the weld surface, which exist only on the workpiece surface and appear as isolated, localized signals in the vertical profile; the other is harmful internal defects, such as internal cracks or through-holes, which exist within the weld volume and appear as continuous, widely distributed signals in the vertical profile. When traditional methods average all pixels in the vertical direction into a single point, these two types of signals are confused. A deep surface scratch and a shallow internal crack may produce the exact same trough on the average profile curve, causing subsequent clustering algorithms to fail to distinguish them, resulting in an extremely high false alarm rate—misclassifying benign scratches as harmful cracks. Summary of the Invention
[0005] This invention provides an image recognition-based method for detecting welding defects in evaporators, which solves the technical problem in the prior art where the loss of vertical spatial information due to X-ray image cross-sectional analysis leads to the inability to distinguish between harmful internal defects and benign surface artifacts, resulting in a high false alarm rate.
[0006] In a first aspect, the present invention provides a method for detecting welding defects in evaporators based on image recognition, comprising:
[0007] Acquire X-ray images of the weld to be inspected and preprocess the X-ray images; define several parallel scan lines along the direction perpendicular to the weld and scan along the length of the weld, extract the gray values on several scan lines, and obtain several sets of observation profile curves.
[0008] Baseline fitting is performed on several sets of observed profile curves to obtain several smooth fitted baselines; by subtracting the observed profile curves from their respective fitted baselines and performing a zero-taking operation, several sets of residual defect signals are obtained.
[0009] At any position along the weld length, the maximum depth curve is calculated based on several sets of residual defect signals, and the vertical spatial entropy curve is also calculated. The maximum depth curve is used to locate potential anomalies, and the vertical spatial entropy curve is used to evaluate the spatial distribution of several sets of residual defect signals in the direction perpendicular to the weld.
[0010] All peaks above the noise threshold are detected on the maximum depth curve; the defect depth and defect entropy at each peak are extracted to construct a two-dimensional feature dataset; the K-Means clustering algorithm is applied to cluster the two-dimensional feature dataset to distinguish the peaks into low-entropy surface artifacts and high-entropy internal defects, thereby realizing the detection of welding defects in evaporators.
[0011] Furthermore, the preprocessing includes applying a medium filter to the X-ray image to remove salt-and-pepper noise and preserve edge information of defects.
[0012] Furthermore, the baseline fitting employs polynomial fitting to track the low-frequency trend of the observed profile curve, thereby reproducing geometric artifacts.
[0013] Furthermore, the calculation formula for obtaining several sets of residual defect signals is as follows:
[0014] ;
[0015] in, For the i-th group of residual defect signals, For the i-th fitted baseline, Let represent the observed grayscale value of the i-th group of observed profile curves, u represent the position along the weld length direction, i represent an integer from 1 to N, and N represent the total number of residual defect signals in several groups.
[0016] Furthermore, the formula for calculating the maximum depth curve is as follows:
[0017] ;
[0018] in, The maximum depth curve, Let N be the residual defect signal of the i-th group, and N be the total number of residual defect signals.
[0019] Furthermore, the calculation of the vertical spatial entropy curve includes:
[0020] Calculate vertical energy distribution ;
[0021] According to the vertical energy distribution Calculate vertical spatial entropy ;
[0022] Where u is the position along the weld length, i is an integer from 1 to N, and N is the total number of the several sets of residual defect signals.
[0023] Furthermore, the vertical energy distribution The calculation formula is:
[0024] ;
[0025] in, Let be the vertical energy distribution of the i-th group of residual defect signals at position u. and This is a residual defect signal. Let be the sum of all N sets of residual defect signals at position u. To prevent extremely small positive numbers with a denominator of zero.
[0026] Furthermore, the vertical spatial entropy The calculation formula is:
[0027] ;
[0028] in, For vertical energy distribution, It is a very small positive number.
[0029] Furthermore, the number of clusters K in the K-Means clustering algorithm is set to 2.
[0030] Furthermore, the clustering includes: comparing the centroids of two clusters on the defect entropy axis; labeling the cluster with the lower entropy centroid as a surface artifact, and labeling the cluster with the higher entropy centroid as an internal defect.
[0031] The beneficial effects are:
[0032] By comparing the centroids of two clusters on the entropy axis, automatic labeling of cluster categories is achieved without manual intervention, thus improving the automation level of detection.
[0033] The core idea of this invention is to abandon the traditional approach of averaging two-dimensional images into a one-dimensional curve, and instead adopt a method of extracting profile curves, thus preserving key spatial information in the vertical direction of the weld. This approach is fundamental to solving the problem of confusing benign artifacts with harmful defects.
[0034] Based on the preserved V-axis information, this invention constructs a vertical spatial entropy index. This index can quantitatively distinguish between two physical phenomena at the data level: energy concentrated on the surface (low-entropy artifacts) and energy diffused internally (high-entropy defects). Ultimately, this invention cleverly transforms the complex high-dimensional image problem into a low-dimensional feature clustering problem. The K-Means algorithm can automatically and unsupervisedly separate benign artifacts from harmful defects, greatly reducing the false alarm rate and improving detection reliability. Attached Figure Description
[0035] Figure 1 This is a flowchart of the present invention.
[0036] Figure 2 This is a schematic diagram of the multi-channel residual defect signal of the present invention.
[0037] Figure 3 This is a schematic diagram of the fusion defect index curve of the present invention.
[0038] Figure 4 This is a schematic diagram of the defect feature clustering results of the present invention. Detailed Implementation
[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0040] An embodiment of the image recognition-based evaporator welding defect detection method provided by the present invention:
[0041] like Figure 1 As shown, the image recognition-based method for detecting welding defects in evaporators includes the following steps:
[0042] S1, Weld seam image acquisition and observation profile curve extraction.
[0043] Specifically, digital X-ray (DR) or computed radiography (CR) images I(u, v) of the critical weld seam of the evaporator are acquired, where u is the direction along the weld seam length and v is the direction perpendicular to the weld seam.
[0044] Before analysis, a median filter is applied to the original image I(u,v). This step aims to remove salt-and-pepper noise, a common feature on X-ray films, which consists of isolated bright or dark pixels. Compared to Gaussian filtering, median filtering better preserves the edge information of defects (such as pores and cracks) and avoids blurring key features when removing this type of impulse noise.
[0045] To preserve spatial information in the v-axis, this invention does not employ averaging. Instead, N=5 parallel scan lines are defined in the v-axis (e.g., weld width H=20 pixels), located at different depths along the v-axis, such as v=0.1H, 0.3H, 0.5H, 0.7H, and 0.9H, corresponding to rows 2, 6, 10, 14, and 18. The grayscale values along these N=5 lines are extracted, resulting in N=5 sets of observation profile curves: P1(u), P2(u), ..., P5(u).
[0046] S2, baseline fitting and residual defect signal extraction.
[0047] After obtaining N sets of observation profile curves, each observation profile curve Pi(u) contains the superimposed signal of geometric artifacts (low frequency) and defects (high frequency).
[0048] First, baseline fitting is performed. Geometric artifacts (such as uneven weld reinforcement) are low-frequency signals that simultaneously affect all N observed profile curves. This invention employs polynomial fitting, such as a 5th-order polynomial, to fit each observed profile curve Pi(u) separately, resulting in N=5 smooth, healthy baselines, i.e., the fitted baselines Bi(u). Polynomial fitting is a robust low-pass filter that effectively tracks the low-frequency trend of the curve while being naturally insensitive to high-frequency trough signals. Therefore, Bi(u) can accurately reproduce the trend of geometric artifacts.
[0049] Next, residual defect signals are extracted. By subtracting the respective fitted baselines from the observed profile curves, N sets of residual defect signals Ri(u) are obtained, calculated using the following formula:
[0050] ;
[0051] in, : Calculate the depth of the indentation caused by the defect. Indicates the observed grayscale value. This represents the fitted baseline. In an X-ray, a defect is a dark area, and its observed gray value is lower than the fitted baseline, so this difference is positive. The operation sets all negative values caused by noise (i.e., observed gray values higher than the fitted baseline) to zero, thus achieving initial signal purification.
[0052] For example, at position u=100, the observed gray value of the i-th profile line Fitting baseline values Then the residual defect signal .
[0053] If the grayscale value is observed at position u=101 (Noise caused the value to be higher than the fitted baseline), fitted baseline Then the residual defect signal .
[0054] S3, core innovation - integration of defect indicators.
[0055] At any position along the u-axis, there exists an N-dimensional residual vector R(u) = [R1(u), R2(u), ..., RN(u)]. This vector is then fused into two core indicator curves: the maximum depth curve D(u) and the vertical spatial entropy curve Ev(u).
[0056] First, the maximum depth curve D(u) is calculated, which is used to locate all potential anomalies. The calculation formula is as follows:
[0057] ;
[0058] Where D(u) refers to the maximum value of the residual defect signal among all N observed profile curves at position u.
[0059] For example, at position u=200 and N=5, the residual vector R(200)=[30, 0, 5, 0, 0], then D(200)=max(30, 0, 5, 0, 0)=30.
[0060] At position u=201, R(201)=[0, 25, 28, 22, 0], then D(201)=max(0, 25, 28, 22, 0)=28.
[0061] The maximum depth curve can capture anomalies such as surface scratches and internal defects, and can locate the location of anomalies, but it cannot distinguish the type of anomaly.
[0062] Next, the vertical spatial entropy curve Ev(u) is calculated, which is used to distinguish the type of anomaly. The reason for the calculation is that the energy of surface scratches is concentrated on a single residual defect signal Ri(u) (corresponding to a high concentration of energy distribution in the vertical direction, i.e., low entropy); while the energy of internal defects diffuses across multiple residual defect signals Ri(u) (corresponding to a high dispersion of energy distribution in the vertical direction, i.e., high entropy).
[0063] a. Calculate the vertical energy distribution This is a prerequisite for calculating entropy, and the formula is as follows:
[0064] ;
[0065] in, At position u, the percentage of the residual on the i-th observation profile curve relative to the total residual energy at that position is the vertical energy distribution. It is the sum of the residuals of N observed profile curves. It is a very small positive number (e.g.) ), used to prevent all When all values are 0, a 0 / 0 condition occurs to ensure the stability of the calculation. Continuing with the example of u=200, R(200)=[30, 0, 5, 0, 0], the total energy = 30+0+5+0+0=35.
[0066] Vertical energy distribution The calculation is as follows: , , , , ;
[0067] so
[0068] b. Calculate the vertical spatial entropy curve The formula is as follows:
[0069] ;
[0070] The value is in 0- between, It is a very small positive number (e.g.) Similarly, it is to prevent hour, Calculation overflow.
[0071] Continuing with the example of u=200, ;
[0072]
[0073]
[0074] (neglect item);
[0075] This is a relatively low entropy value.
[0076] Example of logical relationship:
[0077] Case 1: Surface scratch (low entropy), if the signal R(50) at u=50 is [20, 0, 0, 0, 0], the total energy is 20.
[0078] Energy distribution p(50) = [20 / 20, 0 / 20, 0 / 20, 0 / 20, 0 / 20] = [1, 0, 0, 0, 0].
[0079] The energy distribution is extremely concentrated.
[0080] Case 2: Internal defect (high entropy), if the signal at u=300 is R(300)=[0, 8, 10, 7, 0], and the total energy is 25. The energy distribution is p(300)=[0, 0.32, 0.4, 0.28, 0].
[0081] ;
[0082] ;
[0083] .
[0084] S4, Defect waveform feature extraction and cluster classification.
[0085] After obtaining the two curves D(u) and Ev(u), these curves are then analyzed to achieve automatic defect classification.
[0086] First, peak detection is performed. Using a standard peak detection algorithm, such as find_peaks, all peaks above a noise threshold are detected on the maximum depth curve D(u), for example, R(u) > 3.0, i.e., the grayscale difference is greater than 3. Assume M peaks are detected, and their positions are... .
[0087] Then, feature extraction is performed. For the j-th detected peak (representing a candidate defect), two key features are extracted:
[0088] Defect depth : That is, the peak value of the wave.
[0089] Defect Entropy : That is, the peak is at the same location. The value of the vertical spatial entropy at that location.
[0090] Combine all M defects into a two-dimensional feature dataset:
[0091] .
[0092] Next, K-Means clustering is performed on the two-dimensional feature dataset constructed in step three. The K-Means clustering algorithm is applied, with the number of clusters K=2. The K-Means algorithm will automatically find two cluster centers based on the depth-entropy feature space.
[0093] Finally, defect classification is performed. This is done by comparing the centroids of the two clusters. The height of the axis is used to automatically label the cluster category.
[0094] Cluster 0 (Low Entropy - Surface Artifacts): K-Means will automatically include all [high entropy] clusters. ,Low The data points (i.e., surface scratches and strong noise points) are grouped into one category.
[0095] Cluster 1 (High Entropy - Internal Defects): K-Means will automatically include all [high] ,high Data points (i.e., internal cracks or pores) are grouped into one category.
[0096] The system finally outputs a detection report, marking only defects in "Cluster 1" as harmful defects and highlighting their positions on the u-axis; defects in "Cluster 0" are marked as benign artifacts and no alarm is triggered.
[0097] By transforming the detection problem into a low-dimensional feature clustering problem, the K-Means algorithm can automatically and unsupervisedly separate benign artifacts from harmful defects, greatly reducing the false alarm rate and improving the automation and reliability of detection.
[0098] The effectiveness of this solution can be clearly demonstrated through three data charts, please refer to the attached images for details:
[0099] refer to Figure 2 This figure illustrates multi-channel residual defect signals, where the X-axis represents the weld scan position and the Y-axis represents the residual. Five curves, from R1(u) to R5(u), are plotted side-by-side. In the blue background area of surface artifacts, only R1(u) produces numerous peaks, while the other four curves are almost flat. In the red background area of internal cracks, curves R2(u), R3(u), and R4(u) simultaneously produce towering peaks. This figure visually demonstrates the differences in the vertical spatial distribution of different defects.
[0100] refer to Figure 3This figure illustrates the fusion defect index curves, where the X-axis represents the weld scan location, the left Y-axis represents the maximum depth, and the right Y-axis represents the spatial entropy. The maximum depth curve produces high peaks at both surface artifacts and internal cracks, indicating that this curve can only locate anomalies but cannot distinguish between them. In the surface artifact region, the vertical spatial entropy curve shows a consistently zero entropy value because the signal energy is concentrated on only one line. In the internal crack region, however, the entropy value spikes to a high value because the signal energy diffuses across three lines. This figure demonstrates that the vertical spatial entropy curves successfully label two different types of anomalies as low-entropy and high-entropy.
[0101] refer to Figure 4 This figure shows the clustering results of defect features, where the X-axis represents waveform feature 1 and the Y-axis represents waveform feature 2. It is a two-dimensional scatter plot showing... Figure 2 The figure shows the feature distribution of all detected peaks. Cluster 0 represents the peak feature points of all surface artifacts, which are densely clustered in the low-entropy region of the Y-axis. Cluster 1 represents the peak feature points of all internal cracks, which are clustered in the high-entropy region of the Y-axis. This figure illustrates how the K-Means algorithm utilizes the two features constructed in this invention to automatically and clearly separate benign surface artifacts and harmful internal defects into two clusters, solving the high false alarm problem in the background art.
[0102] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A method for detecting welding defects of an evaporator based on image recognition, characterized in that, The method comprises: acquiring an X-ray image of a weld to be detected, and preprocessing the X-ray image; defining a plurality of parallel scan lines in a direction perpendicular to the weld, and scanning along the length direction of the weld to extract gray scale values on the scan lines, thereby obtaining a plurality of groups of observation profile curves; performing baseline fitting on the plurality of groups of observation profile curves respectively to obtain a plurality of smooth fitted baselines; subtracting the fitted baselines from the observation profile curves respectively and performing zero operation to obtain a plurality of groups of residual defect signals; at any position in the length direction of the weld, calculating a maximum depth curve and a vertical spatial entropy curve according to the plurality of groups of residual defect signals; the maximum depth curve is used for locating potential abnormalities, and the vertical spatial entropy curve is used for evaluating the spatial distribution of the plurality of groups of residual defect signals in the vertical direction of the weld; the calculation formula of the maximum depth curve is: ; wherein is the maximum depth curve, is the i-th group of residual defect signals, and N is the total number of groups of residual defect signals. calculating the vertical spatial entropy curve, comprising: Computing the vertical energy distribution ; According to the vertical energy distribution Computing vertical spatial entropy ; wherein u is the position in the length direction of the weld, i is an integer from 1 to N, and N is the total number of the plurality of groups of residual defect signals; detecting all wave crests higher than a noise threshold on the maximum depth curve; extracting defect depth and defect entropy at each wave crest to construct a two-dimensional feature dataset; applying a K-Means clustering algorithm to the two-dimensional feature dataset to cluster the wave crests into low-entropy surface artifacts and high-entropy internal defects, thereby realizing detection of the welding defects of the evaporator.
2. The image recognition-based evaporator weld defect detection method of claim 1, wherein, The preprocessing comprises applying a median filter to the X-ray image to remove salt and pepper noise and protect edge information of the defects.
3. The image recognition-based evaporator weld defect detection method of claim 1, wherein, The baseline fitting adopts polynomial fitting to track the low-frequency trend of the observation profile curves, thereby reproducing geometric artifacts.
4. The image recognition-based evaporator weld defect detection method of claim 1, wherein, The calculation formula for obtaining the plurality of groups of residual defect signals is: ; wherein, is the i-th set of residual defect signals, is the i-th fitted baseline, is the observed gray value of the i-th set of observed profile curves, u is the position in the direction of the weld length, i is an integer from 1 to N, and N is the total number of sets of residual defect signals.
5. The image recognition-based evaporator weld defect detection method of claim 1, wherein, The vertical energy distribution The formula for the calculation is: ; wherein, is the vertical energy distribution of the i-th group of residual defect signals at the u position, and is the residual defect signal, is the sum of all N groups of residual defect signals at the u position, is a very small positive number to prevent the denominator from being zero.
6. The image recognition-based evaporator weld defect detection method of claim 1, wherein, The vertical spatial entropy The formula for calculating the vertical spatial entropy is: ; wherein is the vertical energy distribution, is a very small positive number.
7. The image recognition-based evaporator weld defect detection method of claim 1, wherein, The number K of clusters of the K-Means clustering algorithm is set to 2.
8. The image recognition-based evaporator weld defect detection method of claim 1 or 7, wherein, The clustering comprises: comparing the heights of the centroids of the two clusters on the defect entropy axis; labeling the cluster with a lower-entropy centroid as a surface artifact, and labeling the cluster with a higher-entropy centroid as an internal defect.
Citation Information
Patent Citations
Weld surface defect feature extraction method based on image gray scale B sweeping curve
CN105931227A
Detection method for identifying surface quality of continuous laser seam of metal workpiece online
CN106442543A