Image segmentation method of surface defects for metal workpieces based on improved U-net
-
摘要: 针对金属工件表面小尺寸缺陷及受非均匀光照影响的图像缺陷难以分割的问题,提出了一种改进的U-net语义分割网络,实现金属工件表面缺陷图像的精确分割。首先,在U-net网络中融入CBAM(convolutional block attention module)模块来提升图像中缺陷目标的显著度;其次,采用深度超参数化卷积DO-Conv(depthwise over-parameterized convolutional)代替网络中部分传统卷积,增加网络可学习的参数数量;然后,采用Leaky Relu函数代替网络中部分Relu函数,提高模型对负区间的特征提取能力;最后,采用中值滤波及非均匀光照的补偿方法进行图像预处理,减弱非均匀光照对金属工件图像表面缺陷的影响。结果表明:改进后的网络平均交并比、准确率和Dice系数指标分别达到0.8335、0.9332、0.8674,改进的网络显著提升了对金属工件表面缺陷图像的分割效果。Abstract: For the small-size defects of metal workpiece surface and the difficult segmentation of image defects due to non-uniform illumination, an improved U-net semantic segmentation network was proposed to achieve accurate image segmentation of surface defects for metal workpieces. Firstly, the convolutional block attention module (CBAM) was integrated into the U-net netwok to improve the significance of the defective targets in the image. Secondly, part of the traditional convolution in the network was replaced by depthwise over-parameterized convolution (DO-Conv) to increase the number of learnable parameters of the network. Then, the Leaky Relu function was used instead of the partial Relu function in the network to improve the feature extraction ability of the model for the negative intervals. Finally, the median filtering and non-uniform illumination compensation method were used for image preprocessing, so as to reduce the effect of non-uniform illumination on the surface defects of metal workpiece images. The results show that the improved network mean intersection over union, accuracy rate and Dice coefficient index reaches 0.833 5, 0.933 2 and 0.867 4, respectively. The improved network significantly improves the segmentation effect of surface defect images of metal workpieces.
-
表 1 Dice指标对比
Table 1 Comparison of Dice indexes
No. Approach Dice 1 PW-U-net 0.8463 2 U-net 0.8489 3 DO-U-net 0.8516 4 Att-U-net 0.8512 5 Att-DO-U-net 0.8674 -
[1] 赵鹤, 杨晓洪, 杨奇, 等. 融合注意力机制的金属缺陷图像分割方法[J]. 光电子·激光,2021,32(4):403-408. doi: 10.16136/j.joel.2021.04.0411ZHAO He, YANG Xiaohong, YANG Qi, et al. Metal defect image segmentation algorithm combined with attention mechanism[J]. Journal of Optoelectronics·Laser,2021,32(4):403-408. doi: 10.16136/j.joel.2021.04.0411 [2] HE J W, ZHAO C D, GAO R Y, et a1. Life prediction model of machine tool based on deep learning[J]. International Journal of Plant Engineering and Management,2021,26(1):1-15. [3] WU W H, GAO L, DUAN H H, et al. Segmentation of pulmonary nodules in CT images based on 3D-UNEF combined with three-dimensional conditional random field optimization[J]. Medical Physics,2020,47(9):4054-4063. doi: 10.1002/mp.14248 [4] TAO X, ZHANG D P, MA W Z, et al. Automatic metallic surface defect detection and recognition with convolutional neural networks[J]. Applied Sciences,2018,8(9):1575. doi: 10.3390/app8091575 [5] ZHANG K H, WANG W D, LUY Z Q, et al. Computer vision detection of foreign objects in coal processing using attention CNN[J]. Engineering Applications of Artificial Intelligence,2021,102:104242-104253. doi: 10.1016/j.engappai.2021.104242 [6] LI J Y, SU Z F, GENG J H, et al. Real-time detection of steel strip surface defects based on improved YOLO detection network[J]. IFAC-Papers Online,2018,51(21):76-81. doi: 10.1016/j.ifacol.2018.09.412 [7] 徐建桥, 吴俊, 陈向成, 等. 基于规范化样本拆分的轴承缺陷检测[J]. 应用光学,2021,42(2):327-333. doi: 10.5768/JAO202142.0203006XU Jianqiao, WU Jun, CHEN Xiangcheng, et al. Bearing defects detection based on standardized sample split[J]. Journal of Applied Optics,2021,42(2):327-333. doi: 10.5768/JAO202142.0203006 [8] XIAO Z T, LIU B W, GENG L, et al. Segmentation of lung nodules using improved 3D-UNet neural network[J]. Symmetry,2020,12(11):1787. doi: 10.3390/sym12111787 [9] 卢印举, 郝志萍, 戴曙光. 融合双特征的玻璃缺陷图像分割算法[J]. 包装工程,2021,42(23):162-169. doi: 10.19554/j.cnki.1001-3563.2021.23.023LU Yinju, HAO Zhiping, DAI Shuguang. Glass defect image segmentation algorithm fused with dual features[J]. Packaging Engineering,2021,42(23):162-169. doi: 10.19554/j.cnki.1001-3563.2021.23.023 [10] YE M, ZHANG W W, CUI G H, et al. Surface defects inspection of cylindrical metal workpieces based on weakly supervised learning[J]. International Journal of Advanced Manufacturing Technology,2022,119(3/4):1933-1949. [11] 曹富强, 王明泉, 张俊生, 等. 基于深度学习的铸件X射线图像分割研究[J]. 应用光学,2021,42(6):1025-1033. doi: 10.5768/JAO202142.0602003CAO Fuqiang, WANG Mingquan, ZHANG Junsheng, et al. Casting X-ray image segmentation based on deep learning[J]. Journal of Applied Optics,2021,42(6):1025-1033. doi: 10.5768/JAO202142.0602003 [12] HOU Y W, LIU Z Y, ZHANG T, et al. C-UNet: Complement UNet for remote sensing road extraction[J]. Sensors,2021,21(6):2153. doi: 10.3390/s21062153 [13] FU H X, SONG G Q, WANG Y C, et al. Improved YOLOv4 marine target detection combined with CBAM[J]. Symmetry,2021,13(4):623. doi: 10.3390/sym13040623 [14] 王粉花, 张强, 黄超, 等. 融合双流三维卷积和注意力机制的动态手势识别[J]. 电子与信息学报,2021,43(5):1389-1396. doi: 10.11999/JEIT200065WANG Fenhua, ZHANG Qiang, HUANG Chao, et al. Dynamic gesture recognition combining two stream three-dimensional convolution and attention mechanism[J]. Journal of Electronics and Information,2021,43(5):1389-1396. doi: 10.11999/JEIT200065 [15] 高淑萍, 赵清源, 齐小刚, 等. 改进的MobileNet 的图像分类方法研究[J]. 智能制造学报,2021,16(1):11-20.GAO Shuping, ZHAO Qingyuan, QI Xiaogang, et al. Research on the improved image classification method of MobileNet[J]. CAAI Transactions on Intelligent Systems,2021,16(1):11-20. -