A RECOGNITION ALGORITHM TO DETECT PIPE WELD DEFECTS

Preliminary communication Taking magnetic flux leakage (MFL) imaging of pipe weld defects as the research object, a weld defect image recognition algorithm based on greygradient co-occurrence matrix (GGCM) and cluster analysis and mathematical morphology is proposed. Recognition of different types of welding defects was achieved. Firstly, a continuous non-contact scanning MFL system for the pipe weld was used to collect the three-dimensional MFL. Secondly, the three-dimensional MFL signal was converted to a two-dimensional greyscale image. Then the MFL image characteristics of the two-dimensional grayscale image were extracted using GGCM. Based on extracted image features, the characteristic quantity was analysed by using k-means clustering and then through the combination of histogram equalization, Otsu’s method of binaryzation, morphologically removing small objects, edge detection, and then structuring a morphologically optimized edge extraction method for edge detection on the grayscale. Through combination of several methods, a new algorithm to improve the detection effect was structured. The results indicated that this algorithm is adaptable and practical. This algorithm solved difficulties associated with the MFL method being used in the weld testing to realize the recognition of pipe weld defects and break through the applicable limitations of traditional signal processing technology.


Introduction
The weld is an important connection part of the pipe but during the process of manufacturing and through its use, it produces defects.The weld defects usually occur in the weld fusion zone along the border of the heat affected zone and the weld.Because these areas have a geometric discontinuity and similar mechanical properties and can have a concentration of stress, the area under the joint action of medium pressure is susceptible to stress, corrosion cracking, and induced cracks.Therefore, carrying out efficient detection of the pipe weld defects to ensure the normal use of the pipe has safety and economic significance.
At present, methods such as radiographic testing, ultrasonic testing, and magnetic memory testing [1][2][3][4] are used for online inspection of the weld.Efficient feature selection for neural network based detection of flaws in steel welded joints using ultrasound testing in literature [1].Literature [2] described that Nondestructive evaluation (NDE) techniques of phased array ultrasonic testing (PAUT) and digital X-ray radiography were employed on friction stir (FS)-welded Aluminum Alloy (AA)-2219-T87 specimens.In literature [3], an analysis of the crack distribution in the weld sample is conducted from the acquired 2D radiographs and its corresponding 3D volumetric reconstruction achieved by linear coplanar digital laminography.This in situ approach opens new possibilities in the field of hot crack research by having direct information of both the crack initiation and growth and its correlation to the welding parameters.Literature [4] shows that the parameters of the welding defects are significantly different from parameters of the defect-free regions, which can accurately identify the location of welding defects.Whether it is a welding defect, or welding residual stress, it can lead to changes of magnetic memory signal, but there is essential distinction between above two.Research on the magnetic flux leakage (MFL) method for testing weld defects has shown that this method is easy to carry out and reports demonstrate that MFL detection of weld defects is technically feasible but there is a lack of weld detection instruments and recognition of quantitative analysis of the weld defects in literature [5] and literature [6].The one key technical problem associated with the MFL method for testing for the weld defects is when using MFL in the detection of the weld defect, the MFL signal generated by the weld contour is superimposed on the defect signal.These technical problems lead to limitations in the traditional signal processing for the detection and visual identification of the weld defects.This paper provided solutions to the problem by a new recognition algorithm based on gray-gradient co-occurrence matrix (GGCM), cluster analysis and mathematical morphology.This algorithm combines several methods to improve the detection effect.For example, in evaluation of Literature [7], the combination of the four methods yields 94% correct detection.

Algorithm
Literature [8][9][10][11] described that the GGCM method can clearly describe the distribution of each pixel grey level and gradient in the graphics, and can also describe the space relationship of the pixel and its neighbouring pixels.This method can describe the graphics of the grayscale, shape and texture features well.GGCM can calculate all kinds of statistics of image characteristics.Characteristic parameters are small gradient advantage characteristic (T 1 ), large gradient advantage characteristic (T 2 ), characteristic quantity of the gray distribution nonuniformity (T 3 ), characteristic quantity of the gradient distribution non-uniformity (T 4 ), energy characteristic quantity (T 5 ), characteristic quantity of the gray average (T 6 ), characteristic quantity of the gradient average (T 7 ), characteristic quantity of the gray standard deviation (T 8 ), characteristic quantity of the gradient standard deviation (T 9 ), characteristic quantity of the correlation (T 10 ), characteristic quantity of the gray entropy (T 11 ), The above image data is subtracting the original image data.
Whether or not there are still pixels what have not been processed?
Compare it with B, and add it up, and take the maximum. Maximum>255?

Start
Initialize and read the image of weld gray.
Read a pixel in the original image and four adjacent points around it.
End characteristic quantity of the gradient entropy (T 12 ), characteristic quantity of the hybrid entropy (T 13 ), characteristic quantity of the inertia entropy (T 14 ), characteristic quantity of the inverse different moment (T 15 ).Literature [12][13][14][15] indicated that the mathematical morphology is the new theory and the new method for digital image processing and recognition, and a complete set of system theory, method and algorithm has been developed to describe the basic characteristics of images, while the traditional numerical modelling and analysis, based on the set to analyse signals has been abandoned.An edge detection operator based on mathematical morphology is a kind of nonlinear differential operator.
Because cracks are the main defects that impact the weld's mechanical properties, in many weld defects, precast crack defects on the experimental pipe and analyse distribution characteristics of the cracks in different areas (in the weld and in the fusion zone).Therefore, the algorithm in Fig. 1 is applied to identify the cracks in different positions.
Steps of the algorithm proposed in this study are: (1) Collect three-dimensional distribution signals by MFL system for the pipe weld.
(2) Through three-dimensional distribution signals from three kinds of weld state conversion into twodimensional grayscale.
With the distance as the horizontal axis, the number of channels as the vertical axis, the gray value of each pixel as the amplitude of the leakage magnetic signal, turn the three-dimensional magnetic flux leakage signal into two-dimensional grey image.After the transformation of grayscale patterns, the grey levels were 256, the white grey level was 255, and the black grey level was 0.
(5) Histogram equalization for the image.(6) Binarization threshold was selected by using Otsu's method to process the image for binarization.
The grey value which was less than the threshold value was set at 0, and the grey value bigger than the threshold value, was set as 255.(7) To make the image clearer, mathematical morphology was used to remove small objects.
(8) Expanding edge detection for the image by using E 1 operator.

Numerical example 3.1 Acquisition of three-dimensional signal
The magnetization direction is parallel to the travelling direction in the traditional detection system, but due to different characteristics of the weld structure, the traditional detection system model is no longer applicable.Therefore, this paper discussed a new detection system in which the travelling direction of the MFL detector is rotated 90° to make it vertical to the travelling direction.The proposed MFL testing system is similar to a scan along the longitudinal direction to detect longitudinal defects in the pipelines.Due to the change in the direction of the magnetization relative to the travelling direction, the Hall element array designed to test the new system also changes accordingly, the schematic diagram of which is shown in Fig. 2.And the continuous non-contact scanning MFL system for the pipe weld is shown in Fig. 3.The pipe diameter was 400 mm, and thickness was 8 mm.The weld reinforcement was 3 mm and the weld width was 18 mm.The crack length × width = 40 mm × 1 mm.The defect depth of each group was respectively achieved at 20%, 40%, 60%, and 80% of the thickness of the pipe.The depth of 1#-4# defects (in the weld) was respectively 4.6, 6.2, 7.8, and 9.4 mm (calculated by the sum of the weld reinforcement of 3 mm and achieved 20%, 40%, 60%, and 80% thickness of the pipe, respectively).The depth of 5#-8# defects (in the fusion zone) was 1.6, 3.2, 4.8, and 6.4 mm (with 20%, 40%, 60%, and 80% thickness of the pipe, respectively).The precast cracks in the pipe are shown in Fig. 4.
Six groups for each type of defect signals were collected in the experiment process, 24 samples of each type of defect were collected, and 24 samples of the weld without defects were also collected.A group of threedimensional distribution signals from three kinds of weld states in the experiment are respectively shown in Fig. 5. From Tab. 2, compare the initial sample tag in the clustering results.A crack in the fusion zone (Category 3) is wrongly assigned to cracks in the weld (Category 2), and other samples are separated correctly.And the classification result shows that this method has obtained higher clustering accuracy.
From Tab. 3, the distance between Class 1 and other Classes is bigger than the distance between other Classes.This shows that identifying pipe weld with defects and pipe weld without defects is easier than identifying between pipe weld defects.

Edge detection for weld defects
On the basis of the classification of previous steps, edge detection is carried out.As shown in Fig. 6(a), the contrast between the black line with the weld through channel after grayscale linear transformation and the white line with the weld peak channel after grayscale linear transformation was clear.The edge detection is according to the eighth step of the algorithm, with the result shown in Fig. 6(b).
The cracks in different locations of the weld (cracks in the weld, cracks in the fusion zone) are shown in Figs.According to the sixth step of the algorithm, binarization threshold was selected by using Otsu's method on the basis of Figs.

Conclusion
This paper proposes an image recognition method based on GGCM and cluster analysis and mathematical morphology, which is different from the traditional ideas based on MFL signal processing.By using GGCM and clustering algorithm, this method can identify the pipe weld states effectively for welds without defects, cracks in the pipe weld and cracks in the fusion zone.The results have shown that this method has higher clustering accuracy.On the basis of these classification results, by constructing a mathematical morphology optimization method, the edges of the weld shape contour and the cracks in different areas of the weld (in the weld and in the fusion zone) were extracted.The edges were clear, and had good edge graphics features.
According to the algorithm results, the reliability and validity of approaches proposed have been verified, and break through the applicable limitations of traditional signal processing technology.Later work can explore new ways of pipe weld defect recognition analysis.

Figure 1
Figure 1 Recognition algorithm the original gray value that is replaced by the maximum.Store image data what have been processed.

Figure 2 Figure 4
Figure 2 Diagram of Hall sensor array

Figure 5
Figure 5 3D maps of MFL signal under the three states 7(a) and 8(a).From Figs. 7(a) and 8(a), the differences between the peaks and troughs of the MFL signals increased along with the contrast between the white line with the peak of the cracks after grayscale linear transformation.The information of the weld and the defect can be shown and compared with the MFL signals 3D figure graphics, which is more clearly illustrated by the grayscale graphics.According to the fifth step of the algorithm, on the basis of Figs.7(a) and 8(a), the results of histogram equalization are shown in Figs.7(b) and 8(b).From Figs. 7(b) and 8(b), the overall contrast in the image improved, and the dynamic range of the pixel grey value expanded, which enhanced the overall contrast of the image.
7(b) and 8(b), to process the image for binarization, then the results are shown in Figs.7(c) and 8(c).After binarization processing, the black line (trough) for the cracks in the weld was separated from the background effectively along with the white line (peak) in the fusion zone.)According to the seventh step of the algorithm, using to remove small objects on the basis of Figs.7(c) and 8(c), and then the results are shown in Figs.7(d) and 8(d).According to the eighth step of the algorithm, by the dilation edge detection of Figs.7(d) and 8(d), the edge detection results are shown in Figs.7(e) and 8(e).From Figs. 7(e) and 8(e), the results matched the cracks in the weld and the cracks in the fusion zone.Through the edge detection for weld defects, the results were reliable and had good consistency.It can intuitively judge the distribution and location for the pipe weld cracks, and the experimental results verified the feasibility of the structured algorithm.

Table 1
Fifteen characteristic quantities of GGCM of the three weld kinds

Table 2
Cluster members

Table 3
Distance between centers of final clustering