Surface Defect Detection Method of Workpiece for Unbalanced Sample Space
-
摘要: 针对工件表面缺陷检测中样本的非均匀状态导致检测模型难以构建问题, 提出了一种面向不均衡样本空间的工件表面缺陷检测方法。构建了包含样本空间均衡化采样模型(SSE Model)与缺陷检测模型(A-C Model)的串行整体结构(SSE-D Model)。SSE Model首先通过双路并行结构分别完成原始样本的特征提取与样本区域修复, 随后对所提取特征利用单样本扩充实现特征的扩充, 最后利用泊松融合实现特征与已修复样本的融合, 生成新样本并完成样本空间的均衡化; A-C Model以空间均衡的新样本作为检测模型输入, 利用深度残差思想构建检测模型, 并融合注意力机制提升模型对缺陷特征的学习能力。该模型重点解决了工件表面缺陷检测中原始样本空间不均衡问题, 并提升了检测模型对特征的学习能力与鲁棒性; 最后利用5类工件图像样本完成实验对比, 验证了本文方法的有效性与可行性, 为不均衡样本空间的表面缺陷检测提供了一种新的思路。Abstract: Aiming at the problem that the inhomogeneous state of the sample in the detection of workpiece surface defects makes it to difficultly construct the detection model, a method of workpiece surface defect detection oriented to uneven sample space is proposed. A serial overall structure (SSE-D Model) including sample space equalization sampling model (SSE Model) and defect detection model (A-C Model) is constructed. SSE Model firstly uses a two-way parallel structure to perform feature extraction and sample region restoration of the original sample, and does single-sample expansion to achieve feature expansion for the extracted features, and finally does Poisson Fusion to achieve the fusion of features and repaired samples to generate New samples and complete the equalization of the sample space. AC Model uses spatially balanced new samples as the input of the detection model, and the deep residual idea to construct the detection model, and integrates the attention mechanism to improve the model's learning ability of defect features. The present model focuses on solving the problem of unbalanced original sample space in surface defect detection of workpiece, and improves the feature learning ability and robustness of the detection model. Finally, five types of workpiece image samples are used to complete the experimental comparison, which verifies the effectiveness of this method and feasibility, it provides a new idea for surface defect detection in unbalanced sample space.
-
Key words:
- surface defect detection /
- sample space /
- equalized sampling /
- poisson fusion /
- attention model
-
表 1 实验数据统计
名称 擦花 碰凹 漏底 凸粉 无缺陷 原始数据 26 20 140 64 42 本文采样 374 380 260 336 358 ROS采样 140 140 140 140 140 RUS采样 20 20 20 20 20 实验扩增 400 400 400 400 400 表 2 神经网络参数设置
训练次数(epoch-size) 50 训练批数(batch-size) 5 丢弃率(dropout) 0.5 学习率(learning-rate) 0.001 卷积核尺寸(kernal-size) 1, 3 优化器(optimizer) rmsprop 损失函数(loss) 交叉熵 数据划分比例 8∶1∶1 表 3 不平衡数据采样方法标签分类对比结果
-
[1] 陶显, 侯伟, 徐德. 基于深度学习的表面缺陷检测方法综述[J]. 自动化学报, 2021, 47(5): 1017-1034 https://www.cnki.com.cn/Article/CJFDTOTAL-MOTO202105005.htmTAO X, HOU W, XU D. A survey of surface defect detection methods based on deep learning[J]. Acta Automatica Sinica, 2021, 47(5): 1017-1034 (in Chinese) https://www.cnki.com.cn/Article/CJFDTOTAL-MOTO202105005.htm [2] 汤勃, 孔建益, 伍世虔. 机器视觉表面缺陷检测综述[J]. 中国图象图形学报, 2017, 22(12): 1640-1663 doi: 10.11834/jig.160623TANG B, KONG J Y, WU S Q. Review of surface defect detection based on machine vision[J]. Journal of Image and Graphics, 2017, 22(12): 1640-1663 (in Chinese) doi: 10.11834/jig.160623 [3] 范程华, 王群京, 曹欣远, 等. 基于欠定方程的太阳电池片表面缺陷检测算法[J]. 太阳能学报, 2020, 41(6): 288-292 https://www.cnki.com.cn/Article/CJFDTOTAL-TYLX202006038.htmFAN C H, WANG Q J, CAO X Y, et al. Defect detection algorithm for solar cells surface based on underdetermined equation[J]. Acta Energiae Solaris Sinica, 2020, 41(6): 288-292 (in Chinese) https://www.cnki.com.cn/Article/CJFDTOTAL-TYLX202006038.htm [4] 冯毅雄, 李康杰, 高一聪, 等. 基于特征与形貌重构的轴件表面缺陷检测方法[J]. 浙江大学学报(工学版), 2020, 54(3): 427-434 https://www.cnki.com.cn/Article/CJFDTOTAL-ZDZC202003002.htmFENG Y X, LI K J, GAO Y C, et al. Shaft surface defect detection method based on feature and morphology reconstruction[J]. Journal of Zhejiang University(Engineering Science), 2020, 54(3): 427-434 (in Chinese) https://www.cnki.com.cn/Article/CJFDTOTAL-ZDZC202003002.htm [5] LIU K, WANG H Y, CHEN H Y, et al. Steel surface defect detection using a new haar-weibull-variance model in unsupervised manner[J]. IEEE Transactions on Instrumentation and Measurement, 2017, 66(10): 2585-2596 doi: 10.1109/TIM.2017.2712838 [6] 王兰, 吕昊. 基于数字图像的光学元件表面缺陷检测[J]. 激光杂志, 2017, 38(1): 47-50 https://www.cnki.com.cn/Article/CJFDTOTAL-JGZZ201701012.htmWANG L, LYU H. Surface defect detection of optical components based on digital image[J]. Laser Journal, 2017, 38(1): 47-50 (in Chinese) https://www.cnki.com.cn/Article/CJFDTOTAL-JGZZ201701012.htm [7] 王红军, 黎邹邹, 邹湘军. 基于Adaboost与CNN的木材表面缺陷检测[J]. 系统仿真学报, 2019, 31(8): 1636-1645 https://www.cnki.com.cn/Article/CJFDTOTAL-XTFZ201908018.htmWANG H J, LI Z Z, ZOU X J. Wood surface defect detection based on adaboost and CNN[J]. Journal of System Simulation, 2019, 31(8): 1636-1645 (in Chinese) https://www.cnki.com.cn/Article/CJFDTOTAL-XTFZ201908018.htm [8] XIAO L, HUANG T, WU B, et al. Surface defect detection using hierarchical features[C]//2019 IEEE 15th International Conference on Automation Science and Engineering (CASE). Vancouver, BC, Canada: IEEE, 2019 [9] 景军锋, 范晓婷, 李鹏飞, 等. 应用深度卷积神经网络的色织物缺陷检测[J]. 纺织学报, 2017, 38(2): 68-74 https://www.cnki.com.cn/Article/CJFDTOTAL-FZXB201702011.htmJING J F, FAN X T, LI P F, et al. Defect detection of colored fabrics using deep convolutional neural network[J]. Journal of Textile Research, 2017, 38(2): 68-74 (in Chinese) https://www.cnki.com.cn/Article/CJFDTOTAL-FZXB201702011.htm [10] XIAO L, WU B, HU Y M. Surface defect detection using image pyramid[J]. IEEE Sensors Journal, 2020, 20(13): 7181-7188 doi: 10.1109/JSEN.2020.2977366 [11] ABE Y, ⅡGUNI Y. Image restoration from a downsampled image by using the DCT[J]. Signal Processing, 2007, 87(10): 2370-2380 doi: 10.1016/j.sigpro.2007.03.010 [12] SETHIAN J A. Fast marching methods[J]. SIAM Review, 1999, 41(2): 199-235 doi: 10.1137/S0036144598347059 [13] PÉREZ P, GANGNET M, BLAKE A. Poisson image editing[J]. ACM Transactions on Graphics (TOG), 2003, 22(3): 313-318 doi: 10.1145/882262.882269 [14] HE K M, ZHANG X Y, REN S Q, et al. Deep residual learning for image recognition[C]//2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). Las Vegas, NV, USA: IEEE, 2016 [15] MA B, WANG X R, ZHANG H, et al. CBAM-GAN: generative adversarial networks based on convolutional block attention module[C]//5th International Conference on Artificial Intelligence and Security. New York, NY, USA: Springer, 2019 [16] 刘颖, 雷研博, 范九伦, 等. 基于小样本学习的图像分类技术综述[J]. 自动化学报, 2021, 47(2): 297-315 https://www.cnki.com.cn/Article/CJFDTOTAL-MOTO202102004.htmLIU Y, LEI Y B, FAN J L, et al. Survey on image classification technology based on small sample learning[J]. Acta Automatica Sinica, 2021, 47(2): 297-315 (in Chinese) https://www.cnki.com.cn/Article/CJFDTOTAL-MOTO202102004.htm [17] 张永清, 卢荣钊, 乔少杰, 等. 一种基于样本空间的类别不平衡数据采样方法[J/OL]. 自动化学报, 2020: 1-14. (2020-05-25)[2020-08-23]. http://doi.org/10.16383/j.aas.c200034ZHANG Y Q, LU R Z, QIAO S J, et al. A sampling method of imbalanced data based on sample space[J/OL]. Automated Chemistry News, 2020: 1-14. (2020-05-25)[2020-08-23]. http://doi.org/10.16383/j.aas.c200034 (in Chinese) [18] CASTELLANOS F J, VALERO-MAS J J, CALVO- ZARAGOZA J, et al. Oversampling imbalanced data in the string space[J]. Pattern Recognition Letters, 2018, 103: 32-38 doi: 10.1016/j.patrec.2018.01.003 [19] SUN B, CHEN H Y, WANG J D, et al. Evolutionary under-sampling based bagging ensemble method for imbalanced data classification[J]. Frontiers of Computer Science, 2018, 12(2): 331-350 doi: 10.1007/s11704-016-5306-z