Visual Inspection of Steel Surface Defects Based on Improved Auxiliary Classification Generation Adversarial Network
-
摘要: 为提高小样本环境下钢表面缺陷检测精度,提出一种基于改进辅助分类生成对抗网络(Auxiliary classifier generative adversarial network, ACGAN)的钢表面缺陷检测方法。利用残差块优化ACGAN的网络结构,提高模型的特征提取能力;其次,为提高模型训练的稳定性,在网络的卷积层中添加谱范数归一化,防止模型异常的梯度变化;基于正-未标记分类的思想优化判别器的损失函数,提高生成样本的质量;同时,为缓解生成对抗网络的模式崩塌问题,在损失函数中添加梯度惩罚来约束判别器的梯度;通过生成器和判别器的对抗优化训练实现样本扩充。通过对钢表面缺陷数据集的试验,验证了提出的方法能准确有效地实现小样本环境下钢表面缺陷检测。与经典的SVM、ResNet50以及一些小样本分类模型相比,所提方法具有更高的检测精度。
-
关键词:
- 钢表面缺陷检测 /
- 辅助分类生成对抗网络 /
- 小样本 /
- 梯度惩罚
Abstract: In order to improve the accuracy of steel surface defect detection in small sample environment, a new method of steel surface defect detection based on the improved auxiliary classifier generative adversarial network (ACGAN) is proposed. Firstly, the residual block is used to optimize the network of ACGAN to improve the feature extraction ability of the model; Secondly, in order to improve the stability of model training, spectral norm normalization is added to the convolution layer of the network to prevent abnormal gradient changes of the model. Then, the loss function of discriminator is optimized based on positive-unlabeled classification to improve the quality of generated samples. At the same time, a gradient penalty is added to the loss function to constrain the gradient of the discriminator in order to alleviate the mode collapse of the Generative Adversarial Network. Finally, the sample expansion is realized through the adversarial optimization training of generator and discriminator. We conducted experiments on steel surface defect datasets to validate the proposed method can accurately and effectively detect steel surface defects in a small sample environment. Compared with the classical support vector machine, ResNet50 and some small sample classification models, the proposed method has higher detection accuracy. -
算法1:改进ACGAN的伪代码 输入:真实样本和标签{X, C},批次大小B,学习率$ \alpha $,判别器训练次数m,训练次数N,参数$ \delta $、$ \lambda $和$ \gamma $;
初始化判别器$ D $和生成器$ G $的参数$ {\theta _D} $和$ {\theta _G} $;
1: for epoch=1 to N do
2: 从真实样本X中随机采样大小为B的x,从均匀分布中随机采样{z, c};
3: 通过将{z, c}输入生成器生成新样本$ G(z, c) $;
4: 将生成样本和真实样本输入判别器中获得判别概率和类别概率;
5: 通过同批次真实样本x加偏差$ \varphi $,得到扰动样本$ (x + \varphi ) $,并输入判别器得到判别概率,并通过公式(13)计算梯度惩罚项;
6: for i=1 to m do
7: 通过式(14)计算判别器损失L(D);
8: 通过$ {\theta _D} \leftarrow {\text{Adam}}({\nabla _{{\theta _D}}}(L(D)), {\theta _D}, \alpha ) $更新判别器网络;
9: end for
10: 通过式(15)计算生成器损失L(G);
11: 通过$ {\theta _G} \leftarrow {\text{Adam}}({\nabla _{{\theta _G}}}(L(G)), {\theta _G}, \alpha ) $更新生成器网络;
12: if epoch/10000==0 then
13: 保存当前模型参数;
14: end if
15: end for
输出:判别器参数$ {\theta _D} $、生成器参数$ {\theta _G} $和训练准确率。表 1 不同训练样本量的平均分类准确率
每类 平均测试准确率(%) 对比ACGAN的增加(%) 样本量 ACGAN 改进ACGAN 240 95.00 99.44 4.44 200 92.78 99.28 6.50 150 91.00 98.97 7.97 100 87.27 98.39 11.12 50 76.67 96.73 20.06 10 40.56 82.30 41.74 表 2 不同方法下钢表面缺陷检测精度
方法 平均准确率(%) 240 200 150 100 50 10 HOG+SVM 92.78 91.11 90.83 88.10 85.28 77.78 LBP+SVM 94.72 93.5 90.67 89.67 87.20 77.70 ResNet50 97.22 95.72 93.61 90.00 80.80 56.40 Res-ACGAN 97.27 96.76 95.57 92.14 81.90 70.27 Res-WGAN 97.79 97.54 96.87 95.00 90.83 71.67 Res-WGAN-GP 98.61 97.41 97.22 95.04 91.66 72.78 Mult-DA[19] 99.00 98.33 98.06 97.79 96.39 78.95 OSLNet[20] 99.20 99.16 98.05 97.22 95.27 71.85 改进ACGAN 99.44 99.28 98.97 98.39 96.73 82.30 表 3 不同模型MS值和FID值比较
方法 MS FID ACGAN 1.343 0.337 Res-ACGAN 1.368 0.314 Res-WGAN 1.375 0.312 Res-WGAN-GP 1.382 0.309 改进ACGAN 1.384 0.295 -
[1] LUO Q, FANG X, LIU L, et al. Automated visual defect detection for flat steel surface: A survey[J]. IEEE Transactions on Instrumentation and Measurement, 2020, 69(3): 626-644. doi: 10.1109/TIM.2019.2963555 [2] SONG G, SONG K, YAN Y. EDRNet: Encoder-decoder residual network for salient object detection of strip steel surface defects[J]. IEEE Transactions on Instrumentation and Measurement, 2020, 69(12): 9709-9719. doi: 10.1109/TIM.2020.3002277 [3] HE Y, SONG K, MENG Q, et al. An end-to-end steel surface defect detection approach via fusing multiple hierarchical features[J]. IEEE Transactions on Instrumentation and Measurement, 2019, 69(4): 1493-1504. [4] LI H, ZHU B, CHEN Z, et al. Realtime in-plane displacements tracking of the precision positioning stage based on computer micro-vision[J]. Mechanical Systems and Signal Processing, 2019, 124: 111-123. doi: 10.1016/j.ymssp.2019.01.046 [5] WANG H, ZHANG J, TIAN Y, et al. A simple guidance template-based defect detection method for strip steel surfaces[J]. IEEE Transactions on Industrial Informatics, 2019, 15(5): 2798-2809. doi: 10.1109/TII.2018.2887145 [6] FU G, SUN P, ZHU W, et al. A deep-learning-based approach for fast and robust steel surface defects classification[J]. Optics and Lasers in Engineering, 2019, 121: 397-405. doi: 10.1016/j.optlaseng.2019.05.005 [7] ZHENG X, ZHENG S, KONG Y, et al. Recent advances in surface defect inspection of industrial products using deep learning techniques[J]. The International Journal of Advanced Manufacturing Technology, 2021, 113: 35-58. doi: 10.1007/s00170-021-06592-8 [8] ZHANG S, ZHANG Q, GU J, et al. Visual inspection of steel surface defects based on domain adaptation and adaptive convolutional neural network[J]. Mechanical Systems and Signal Processing, 2021, 153: 107541. doi: 10.1016/j.ymssp.2020.107541 [9] 姜洪权, 贺帅, 高建民, 等. 一种改进卷积神经网络模型的焊缝缺陷识别方法[J]. 机械工程学报, 2020, 56(8): 235-242. doi: 10.3901/JME.2020.08.235JIANG Hongquan, HE Shuai, GAO Jianmin, et al. An improved convolutional neural network for weld defect recognition[J]. Journal of Mechanical Engineering, 2020, 56(8): 235-242. doi: 10.3901/JME.2020.08.235 [10] GOODFELLOW I J, POUGET-ABADIE J, MIRZA M, et al. Generative adversarial networks[J]. Advances in Neural Information Processing Systems, 2014, 3: 2672-2680. [11] JIN Q, LIN R, YANG F. E-WACGAN: Enhanced generative model of signaling data based on WGAN-GP and ACGAN[J]. IEEE Systems Journal, 2019, 14(3): 3289-3300. [12] 黄南天, 杨学航, 蔡国伟, 等. 采用非平衡小样本数据的风机主轴承故障深度对抗诊断[J]. 中国电机工程学报, 2020, 40(2): 563-573. https://www.cnki.com.cn/Article/CJFDTOTAL-ZGDC202002018.htmHUANG Nantian, YANG Xuehang, CAI Guowei, et al. A deep adversarial diagnosis method for wind turbine main bearing fault with imbalanced small sample scenarios[J]. Proceedings of the CSEE, 2020, 40(2): 563-573. https://www.cnki.com.cn/Article/CJFDTOTAL-ZGDC202002018.htm [13] SUN G, DING S, SUN T, et al. SA-CapsGAN: Using capsule networks with embedded self-attention for generative adversarial network[J]. Neurocomputing, 2021, 423(5): 399-406. [14] BEKKER J, DAVIS J. Learning from positive and unlabeled data: A survey[J]. Machine Learning, 2020, 109(4): 719-760. doi: 10.1007/s10994-020-05877-5 [15] GUO T, XU C, HUANG J, et al. On positive-unlabeled classification in GAN[C]// 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 2020: 8382-8390. [16] 王坤峰, 苟超, 段艳杰, 等. 生成式对抗网络GAN的研究进展与展望[J]. 自动化学报, 2017, 43(3): 321-332. https://www.cnki.com.cn/Article/CJFDTOTAL-MOTO201703001.htmWANG Kunfeng, GOU Chao, DUAN Yanjie, et al. Generative adversarial networks: The state of the art and beyond[J]. Acta Automatica Sinica, 2017, 43(3): 321-332. https://www.cnki.com.cn/Article/CJFDTOTAL-MOTO201703001.htm [17] LIU F, XU M, LI G, et al. Adversarial symmetric GANs: Bridging adversarial samples and adversarial networks[J]. Neural Networks, 2021, 133: 148-156. doi: 10.1016/j.neunet.2020.10.016 [18] DONG H, SONG K, HE Y, et al. PGA-Net: Pyramid feature fusion and global context attention network for automated surface defect detection[J]. IEEE Transactions on Industrial Informatics, 2020, 16(12): 7448-7458. doi: 10.1109/TII.2019.2958826 [19] LI X, ZHANG W, DING Q, et al. Multi-Layer domain adaptation method for rolling bearing fault diagnosis[J]. Signal Processing, 2019, 157: 180-197. [20] LI X, CHANG D, MA Z, et al. OSLNet: Deep small-sample classification with an orthogonal softmax layer[J]. IEEE Transactions on Image Processing, 2020, 29: 6482-6495. [21] ARJOVSKY M, CHINTALA S, BOTTOU L. Wasserstein generative adversarial networks[C]// Precup D, Teh YW (eds) Proceedings of the 34th International Conference on Machine Learning, PMLR, International Convention Centre, Sydney, Australia. Proceedings of Machine Learning Research, 2017, 70: 214-223. [22] GULRAJANI I, AHMED F, ARJOVSKY M, et al. Improved training of Wasserstein GANs[C]// Proceedings of the 2017 Advances in Neural Information Processing Systems. Long Beach, CA, USA, Curran Associates, Inc, 2017: 5767-5777. [23] TRAN N T, TRAN V H, NGUYEN N B, et al. On data augmentation for GAN training[J]. IEEE Transactions on Image Processing, 2021, 30: 1882-1897.