|
|
Surface defect detection method for aluminum profiles based on improved YOLOv7-tiny |
Junyin WANG1,2( ),Bin WEN1,2,*( ),Yanjun SHEN1,Jun ZHANG1,Zihao WANG1 |
1. School of Electrical and New Energy, China Three Gorges University, Yichang 443002, China 2. Hubei Provincial Engineering Technology Research Center for Power Transmission Line, Yichang 443002, China |
|
|
Abstract An improved YOLOv7-tiny detection algorithm was proposed to address the problems such as various types of surface defects in aluminum profiles, large differences in defect scales and missed detection of small target defects. The spatial pyramid pooling module was reconstructed by utilizing the residual structure, parameter-free attention mechanism (SimAM), activation function (FReLU) and clipping convolution to capture more detailed information and strengthen the multi-scale learning ability of the network. The optimized detection layer was used to obtain more small target features and location information, and improve the detection ability of network multi-scale defect. Partial convolution was introduced to replace the 3×3 convolution in the efficient layer aggregation network (ELAN), then the lightweight model was used to reduce the computing and training burden. Combined with the similarity of normalized Wasserstein distance (NWD) loss measurement, the network convergence was accelerated and the detection ability of small target defects was improved. Test was conducted on the Tianchi aluminium profile dataset, and the results showed that the improved YOLOv7-tiny algorithm achieved the accuracy, recall, mean average accuracy (mAP@0.5) and detection speed of 95.0%, 91.8%, 94.5% and 45 frames per second, respectively, when the confidence threshold was 0.25. Compared with the original algorithm, the mAP@0.5 of the improved algorithm was increased by 4.2 percentage point as a whole, the average accuracy (AP) of the dirty spot defect was increased by 13.1 percentage point; the detection results of the improved algorithm for low-resolution images and interfered images was better than of the original algorithm, which showed that the proposed method had better generalization and anti-interference ability.
|
Received: 25 January 2024
Published: 10 March 2025
|
|
Fund: 国家自然科学基金资助项目(62273200,61876097);湖北省输电线路工程技术研究中心(三峡大学)开放研究基金资助项目(2022KXL03);湖北省自然科学基金联合基金资助项目(2024AFD409). |
Corresponding Authors:
Bin WEN
E-mail: wjy2024011@126.com;wenbin@ctgu.edu.cn
|
基于改进YOLOv7-tiny的铝型材表面缺陷检测方法
针对铝型材表面缺陷具有种类多样、缺陷尺度差异大和小目标缺陷漏检的问题,提出改进的YOLOv7-tiny检测算法. 利用残差结构、无参注意力机制(SimAM)、激活函数(FReLU)和裁剪卷积等重构空间金字塔池化模块,捕捉更多的细节信息,加强网络多尺度学习能力. 优化检测层获取更多小目标特征和位置信息,提高网络多尺度缺陷检测能力. 引入部分卷积替换高效层聚合网络(ELAN)中的3×3卷积建立轻量化模型,减少计算和训练负担. 结合归一化 Wasserstein 距离(NWD)损失度量相似度,加速网络收敛并提升小目标缺陷检测能力. 在天池铝型材数据集上进行测试,结果表明,改进YOLOv7-tiny算法在置信度阈值为0.25时,精确度达到95.0%,召回率达到91.8%,均值平均精度mAP@0.5达到94.5%,检测速度为45帧/s. 相较于原算法,改进算法的mAP@0.5提高4.2个百分点,在脏点缺陷上的平均精度AP提高13.1个百分点;改进算法对于低分辨率图像和被干扰图像有更好的检测结果,表明其具备更好的泛化性和抗干扰能力.
关键词:
铝型材,
表面缺陷,
小目标检测,
SPPCSPC重构,
残差结构,
YOLOv7-tiny,
归一化Wasserstein距离(NWD)损失
|
|
[1] |
邓运来, 张新明 铝及铝合金材料进展[J]. 中国有色金属学报, 2019, 29 (9): 2115- 2141 DENG Yunlai, ZHANG Xinming Development of aluminium and aluminium alloy[J]. The Chinese Journal of Nonferrous Metals, 2019, 29 (9): 2115- 2141
|
|
|
[2] |
杨传礼, 张修庆 基于机器视觉和深度学习的材料缺陷检测应用综述[J]. 材料导报, 2022, 36 (16): 226- 234 YANG Chuanli, ZHANG Xiuqing Survey of applications of material defect detection based on machine vision and deep learning[J]. Materials Reports, 2022, 36 (16): 226- 234
doi: 10.11896/cldb.20070136
|
|
|
[3] |
侯占林, 赵京 基于机器视觉的零件外形缺陷检测[J]. 组合机床与自动化加工技术, 2019, (11): 100- 104 HOU Zhanlin, ZHAO Jing Research on part contour defect detection algorithm based on machine vision[J]. Modular Machine Tool and Automatic Manufacturing Technique, 2019, (11): 100- 104
|
|
|
[4] |
郑彬, 王鑫 基于机器视觉的型材表面缺陷图像处理[J]. 机械设计, 2020, 37 (Suppl.1): 95- 97 ZHENG Bin, WANG Xin Research on image processing of section steel surface defect based on machine vision[J]. Journal of Machine Design, 2020, 37 (Suppl.1): 95- 97
|
|
|
[5] |
赵文宏, 周神特, 吕建标, 等. 基于机器视觉的铝型材表面瑕疵检测方法[J]. 浙江工业大学学报, 2021, 49(1): 76–81. ZHAO Wenhong, ZHOU Shente, LV Jianbiao, et al. Method for detecting surface defects of aluminum profile based on machine vision [J]. Journal of Zhejiang University of Technology . 2021, 49(1): 76–81.
|
|
|
[6] |
GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation [C]// IEEE Conference on Computer Vision and Pattern Recognition . Columbus: IEEE, 2014: 580–587.
|
|
|
[7] |
GIRSHICK R. Fast R-CNN [C]// IEEE International Conference on Computer Vision . Santiago: IEEE, 2015: 1440–1448.
|
|
|
[8] |
REN S, HE K, GIRSHICK R, et al Faster R-CNN: towards real-time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017, 39 (6): 1137- 1149
doi: 10.1109/TPAMI.2016.2577031
|
|
|
[9] |
黄凤荣, 李杨, 郭兰申, 等 基于Faster R-CNN的零件表面缺陷检测算法[J]. 计算机辅助设计与图形学学报, 2020, 32 (6): 883- 893 HUANG Fengrong, LI Yang, GUO Lanshen, et al Method for detecting surface defects of engine parts based on Faster R-CNN[J]. Journal of Computer-aided Design and Computer Graphics, 2020, 32 (6): 883- 893
|
|
|
[10] |
向宽, 李松松, 栾明慧, 等 基于改进Faster RCNN的铝材表面缺陷检测方法[J]. 仪器仪表学报, 2021, 42 (1): 191- 198 XIANG Kuan, LI Songsong, LUAN Minghui, et al Aluminum product surface defect detection method based on improved Faster RCNN[J]. Chinese Journal of Scientific Instrument, 2021, 42 (1): 191- 198
|
|
|
[11] |
REDMON J, DIVVALA S, GIRSHICK R, et al. You Only Look Once: unified, real-time object detection [C]// IEEE Conference on Computer Vision and Pattern Recognition . Las Vegas: IEEE, 2016: 779–788.
|
|
|
[12] |
SUN L S , WEI J X , DU H C , et al. MSFF: a multi-Scale feature fusion network for surface defect detection of aluminum profiles [J]. IEICE Transactions on Information and Systems , 2022, 105(9): 1652–1655.
|
|
|
[13] |
杨畅畅, 李慧玲, 潘广通, 等 基于改进YOLOv4算法的铝型材表面缺陷检测[J]. 组合机床与自动化加工技术, 2022, (11): 66- 69 YANG Changchang, LI Huiling, PAN Guangtong, et al Surface defect detection of aluminum profiles based on improved YOLOv4 Algorithm[J]. Modular Machine Tool and Automatic Manufacturing Technique, 2022, (11): 66- 69
|
|
|
[14] |
张建国, 高飞, 莘明星, 等 基于改进YOLOv5s的铝型材表面弱缺陷识别方法[J]. 船舶工程, 2023, 45 (6): 161- 166 ZHANG Jianguo, GAO Fei, XIN Mingxing, et al Weak defect identification method on profile surface based on image enhancement and YOLOv5s[J]. Ship Engineering, 2023, 45 (6): 161- 166
|
|
|
[15] |
曹义亲, 周一纬, 徐露 基于E-YOLOX的实时金属表面缺陷检测算法[J]. 图学学报, 2023, 44 (4): 677- 690 CAO Yiqin, ZHOU Yiwei, XU Lu, et al A real-time metallic surface defect detection algorithm based on E-YOLOX[J]. Journal of Graphics, 2023, 44 (4): 677- 690
|
|
|
[16] |
LV Z, LI Y, QIAN S Real-time and accurate defect segmentation of aluminum strip surface via a lightweight network[J]. Journal of Real-Time Image Processing, 2023, 20 (2): 37
|
|
|
[17] |
KANG X J, LI J F AYOLOv7-tiny: towards efficient defect detection in solid color circular weft fabric[J]. Textile Research Journal, 2024, 94 (1/2): 225- 245
doi: 10.1177/00405175231205898
|
|
|
[18] |
KONG F Y, LI M X, LIU S W, et al. Residual local feature network for efficient super-resolution [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition . New Orleans: IEEE , 2022: 766–776.
|
|
|
[19] |
MA N N, ZHANG X Y, SUN J. Funnel activation for visual recognition [C]// Computer Vision-ECCV 2020: 16th European Conference . Glasgow: Springer, 2020: 351–368.
|
|
|
[20] |
NING T L, PAN S, ZHOU J. YOLOv7-SIMAM: an effective method for SAR ship detection [C]// 4th International Conference on Neural Networks, Information and Communication . Guangzhou: IEEE, 2024: 754–758.
|
|
|
[21] |
CHEN J R, KAO S H, HE H, et al. Run, don’t walk: chasing higher FLOPS for faster neural networks [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition . Vancouver: IEEE, 2023: 12021–12031.
|
|
|
[22] |
WANG J W, XU C, YANG W, et al. A normalized gaussian wasserstein distance for tiny object detection [EB/OL]. (2021−10−26) [2024−01−01]. https://arxiv.org/abs/2110.13389.
|
|
|
[23] |
沈晓海, 栗泽昊, 李敏, 等 基于多任务深度学习的铝材表面缺陷检测[J]. 激光与光电子学进展, 2020, 57 (10): 10 SHEN Xiaohai, LI Zehao, LI Min, et al Aluminum surface-defect detection based on multi-Task deep learning[J]. Laser and Optoelectronics Progress, 2020, 57 (10): 10
|
|
|
[24] |
邓丁山, 王昊楠, 赵军杰, 等. 基于改进YOLOv7的风力发电机表面缺陷检测算法[EB/OL]. [2024−01−01]. https://doi.org/10.13196/j.cims.2023.0410.
|
|
|
[25] |
陈乐, 周永霞, 祖佳贞 改进YOLOX-S的偏光片表面缺陷检测算法[J]. 计算机工程与应用, 2024, 60 (2): 295- 303 CHEN Le, ZHOU Yongxia, ZU Jianzhen Surface defect detection of polarizer based on improved YOLOX-S algorithm[J]. Computer Engineering and Applications, 2024, 60 (2): 295- 303
doi: 10.3778/j.issn.1002-8331.2209-0375
|
|
|
[26] |
齐向明, 柴蕊, 高一萌, 等 重构SPPCSPC与优化下采样的小目标检测算法[J]. 计算机工程与应用, 2023, 59 (20): 158- 166 QI Xiangming, CHAI Rui, GAO Yimeng, et al Algorithm of reconstructed SPPCSPC and optimized downsampling for small object detection[J]. Computer Engineering and Applications, 2023, 59 (20): 158- 166
doi: 10.3778/j.issn.1002-8331.2305-0004
|
|
|
[27] |
SELVARAJU R R, COGSWELL M, DAS A, et al Grad-CAM: visual explanations from deep networks via gradient-based localization[J]. International Journal of Computer Vision, 2020, 128 (2): 336- 359
doi: 10.1007/s11263-019-01228-7
|
|
|
[28] |
席凌飞, 伊力哈木·亚尔买买提, 刘雅洁, 等 基于改进YOLOv5的铝型材表面缺陷检测方法[J]. 广西师范大学学报: 自然科学版, 2024, 42 (1): 111- 119 XI Lingfei, YAERMAIMAITI Yilihamu, LIU Yajie et al. Surface defect detection method for aluminum profile based on improved YOLOv5[J]. Journal of Guangxi Normal University: Natural Science Edition, 2024, 42 (1): 111- 119
|
|
|
|
Viewed |
|
|
|
Full text
|
|
|
|
|
Abstract
|
|
|
|
|
Cited |
|
|
|
|
|
Shared |
|
|
|
|
|
Discussed |
|
|
|
|