计算机应用   2017, Vol. 37 Issue (3): 849-853  DOI: 10.11772/j.issn.1001-9081.2017.03.849 0

### 引用本文

CHEN Benzhi, FANG Zhihong, XIA Yong, ZHANG Ling, LAN Shouren, WANG Lisheng. Automatic detection of blowholes defects in X-ray images of thick steel pipes[J]. JOURNAL OF COMPUTER APPLICATIONS, 2017, 37(3): 849-853. DOI: 10.11772/j.issn.1001-9081.2017.03.849.

### 文章历史

1. 上海交通大学 电子信息与电气工程学院, 上海 200240;
2. 宝山钢铁股份有限公司 研究院, 上海 201900;
3. 宝山钢铁股份有限公司 钢管条钢事业部, 上海 201900

Automatic detection of blowholes defects in X-ray images of thick steel pipes
CHEN Benzhi1, FANG Zhihong2, XIA Yong2, ZHANG Ling3, LAN Shouren1, WANG Lisheng1
1. School of Electronic Information and Electrical Engineering, Shanghai Jiao Tong University, Shanghai 200240, China;
2. Research Institute, Baoshan Iron & Steel Company Limited, Shanghai 201900, China;
3. Steel Bars Division, Baoshan Iron & Steel Company Limited, Shanghai 201900, China
Abstract: Due to the intensity distribution of X-ray image of thick steel pipe is not uniform, the contrast is low, the noise is big, and the size, shape, position and contrast of the blowholes defects are different, it is difficult to detect various types of blowholes automatically. Aiming at the problems that the traditional defect detection algorithm has a large workload of manually marking defect data, and the edge of the weld is difficult to accurately extract and other issues, a new unsupervised learning algorithm was proposed for the detection of various blowholes defects. Firstly, fast Independent Component Analysis (ICA) was used to learn a set of independent base vectors from the steel pipe X-ray image set, and a linear combination of the base vectors was used to selectively reconstruct the test image with blowholes defect. Then, the test image was subtracted from its reconstructed image to obtain the difference image, and the various blowholes were separated from the difference image by global threshold. There were 320 images in the training set and 60 images in the test set. The average sensitivity and accuracy of the proposed algorithm were 90.5% and 99.7%. The experimental results show that the algorithm can accurately detect all kinds of blowholes defects without manual marking the data or extracting the edge of the weld.
Key words: X-ray image    Independent Component Analysis (ICA)    defect detection    machine learning    thick steel pipe
0 引言

1 焊缝中气孔检缺陷检测数学建模

 ${{\bf{F}}_D} = {\bf{F}} - {{\bf{F}}_B} - {{\bf{F}}_W}{\rm{ = }}\;{\bf{F}}{\rm{ - }}{{\bf{F}}_{BW}}$ (1)
 图 1 钢管X射线图像看作焊缝区域和缺陷在背景图像上的叠加 Figure 1 X-ray images of steel pipe are considered as weld areas and defects superimposed on the background image

 ${{\bf{F}}_{BW}} = \sum\limits_{i = 1}^N {\theta {_i}} \cdot {{\bf{w}}_i}$ (2)

2 气孔缺陷检测计算框架

 图 2 气孔缺陷检测算法的流程 Figure 2 Flow chart of porosity defect detection algorithm
2.1 对X射线图像集合进行预处理

 $\mathit{\boldsymbol{\bar{F}}}=\frac{{{\alpha }_{1}}}{{{\alpha }_{2}}}\left( {{\mathit{\boldsymbol{F}}}_{2}}-{{\mu }_{2}} \right)+{{\mu }_{1}}$ (3)

 图 3 获取预处理后的训练集合ΨN Figure 3 Getting training set ΨN by preprocessing
2.2 基于快速 ICA 学习测试图像的FBW

1) 将ΨN中每个训练样本(I1, I2, …, INN=320，图像分辨率大小为n×m)拉成一序列的行向量，将这些行向量组合成观测图像矩阵Z

2) 对观测矩阵Z中每个行向量减去对应的均值向量，并进行白化处理，去除Z中每个向量的相关性，得到新的观测矩阵Z1，计算公式为：

 ${{\mathit{\boldsymbol{Z}}}_{1}}=(\mathit{\boldsymbol{V}}/\sqrt{\mathit{\boldsymbol{D}}})\cdot \mathit{\boldsymbol{Z}}$ (4)

3) 初始化随机权矩阵W=(w1, w2, …, wN)，W是一个N*N的权重矩阵，w1, w2, …, wn, 代表每次迭代更新的权重行向量，该变换矩阵可将N*N(M=n*m, $N\ll \mathit{\boldsymbol{M}}$, m*n表示图像分辨率大小, N表示训练图像数)维的观测数据Z1降维为N*N的子空间。根据式(5) ，每循环迭代一次，更新一个wi向量，直到更新完W中每一个行向量，W*W更新的变换矩阵：

 ${{\bf{W}}^*} = E\{ {{\bf{Z}}_1}\tanh ({{\bf{W}}^T}{{\bf{Z}}_1})\} - E\{ \tan {\rm{h'}}({{\bf{W}}^T}{{\bf{Z}}_1})\} {\bf{W}}$ (5)

4) 获得变换矩阵W后，根据式(6) 将观测数据投影到降维后的子空间，得到N个不正交的独立分量，每个分量表示为θ1θ2，…，θN，集合Ψ中每个图像可被这些基向量的线性组合，进行很好的表达。每个独立分量θi是一幅与F尺寸一样的图像。

 $\left[ {{\mathit{\boldsymbol{ }}\!\!\theta\!\!\rm{ }}_{\rm{1}}},{{\mathit{\boldsymbol{ }}\!\!\theta\!\!\rm{ }}_{2}},\cdots ,{{\mathit{\boldsymbol{ }}\!\!\theta\!\!\rm{ }}_{N}} \right]=\mathit{\boldsymbol{{W}'}}{{\mathit{\boldsymbol{Z}}}_{1}}$ (6)

5) 令HN代表由θ1θ2，…，θN确定的子空间，FBWH表示F投影到子空间HN得到重构图像，这里可认为FBWHFBW，计算公式如下：

 ${{\mathit{\boldsymbol{F}}}_{BW}}\approx {{\mathit{\boldsymbol{F}}}_{BWH}}=\sum\limits_{i=1}^{N}{{{\mathit{\boldsymbol{ }}\!\!\theta\!\!\rm{ }}_{i}}}\cdot {{\mathit{\boldsymbol{w}}}_{i}};{{\mathit{\boldsymbol{w}}}_{i}}=\sum\limits_{x=1}^{n}{\sum\limits_{y=1}^{N}{{{\mathit{\boldsymbol{ }}\!\!\theta\!\!\rm{ }}_{i}}(}}x,y)\cdot F(x,y)$ (7)

2.3 从F中分离各种气孔

 图 4 气孔缺陷检测流程 Figure 4 Blowholes defect detection process

3 实验结果与讨论

 图 5 气孔缺陷检测结果 Figure 5 Detection results of blowholes defects

 \left\{ \begin{align} & SE=\frac{TP}{TP+FN} \\ & SP=\frac{TN}{TN+FP} \\ \end{align} \right. (8)
 $ACC=\frac{TP+TN}{TP+FN+TN+FP}$ (9)

SE, SP, ACC越接近1，表明算法的分割效果越好。23幅图像的统计结果为：平均敏感性、平均特异性、平均准确率分别为0.905, 0.997, 0.997。另外给出图 4(a)图 5(a)~(d)图 5(i)~(l)的检测结果的TP、TN、FP、FN以及SE、SP、ACC统计指标，如表 1所示。

4 结语

 [1] 高炜欣, 胡玉衡, 武晓朦, 等. 埋弧焊X射线焊缝缺陷图像分类算法研究[J]. 仪器仪表学报, 2016, 37 (3) : 518-524. ( GAO W X, HU Y H, WU X M, et al. Sub-arc X-ray welding defect image classifying algorithm[J]. Chinese Journal of Scientific Instrument, 2016, 37 (3) : 518-524. ) [2] 李雪琴, 刘培勇, 殷国富, 等. 基于Fourier拟合曲面的X射线焊缝缺陷检测[J]. 焊接学报, 2014, 35 (10) : 61-64. ( LI X Q, LIU P Y, YIN G F, et al. Weld defect detection by X-ray images method based on Fourier fitting surface[J]. Transactions of the China Welding Institution, 2014, 35 (10) : 61-64. ) [3] 胡海林, 李静, 李剑, 等. 基于视觉与电弧多信息传感的焊缝跟踪算法[J]. 计算机应用, 2012, 32 (6) : 1760-1765. ( HU H L, LI J, LI J, et al. Seam tracking algorithm based on multi-information sensor of vision and arc[J]. Journal of Computer Applications, 2012, 32 (6) : 1760-1765. ) [4] DANG C Y, GAO J M, WANG Z, et al. A novel method for detecting weld defects accurately and reliably in radiographic images[J]. Insight-Non-Destructive Testing and Condition Monitoring, 2016, 58 (1) : 28-34. doi: 10.1784/insi.2016.58.1.28 [5] RATHOD V R, ANAND R S. A comparative study of different segmentation techniques for detection of flaws in NDE weld images[J]. Journal of Nondestructive Evaluation, 2012, 31 (1) : 1-16. doi: 10.1007/s10921-011-0116-6 [6] SHAH M, NIZAM H, RASHID A, et al. Vision based identification and classification of weld defects in welding environments:a review[J]. Indian Journals of Science and Technology, 2016, 9 (20) : 1-15. [7] MOGHADDAM A A, RANGARAJAN L. Classification of welding defects in radiographic images[J]. Pattern Recognition and Image Analysis, 2016, 26 (1) : 54-60. doi: 10.1134/S1054661815040021 [8] ZAPATA J, VILAR R, RUIZ R. An adaptive-network-based fuzzy inference system for classification of welding defects[J]. NDT and E International, 2010, 43 (3) : 191-199. doi: 10.1016/j.ndteint.2009.11.002 [9] VALAVANIS I, KOSMOPOULOS D. Multiclass defect detection and classification in weld radiographic images using geometric and texture features[J]. Expert Systems with Applications, 2010, 37 (12) : 7606-7614. doi: 10.1016/j.eswa.2010.04.082 [10] ZAPATA J, VILAR R, RUIZ R. Performance evaluation of an automatic inspection system of weld defects in radiographic images based on neuro-classifiers[J]. Expert Systems with Applications, 2011, 38 (7) : 8812-8824. doi: 10.1016/j.eswa.2011.01.092 [11] CHANG J, LIU W B, HU H, et al. Improved independent component analysis based modal identification of higher damping structures[J]. Measurement, 2016, 88 : 402-416. doi: 10.1016/j.measurement.2016.03.021 [12] REYHANI N, YLIPAAVALNIEMI J, VIGÁRIO R, et al. Consistency and asymptotic normality of FastICA and bootstrap FastICA[J]. Signal Processing, 2012, 92 (8) : 1767-1778. doi: 10.1016/j.sigpro.2011.11.025 [13] SHYU K K, LEE M H, WU Y T, et al. Implementation of pipelined FastICA on FPGA for real-time blind source separation[J]. IEEE Transactions on Neural Networks, 2008, 19 (6) : 958-970. doi: 10.1109/TNN.2007.915115