图学学报 ›› 2024, Vol. 45 ›› Issue (1): 47-55.DOI: 10.11996/JG.j.2095-302X.2024010047
胡欣1(), 胡帅1, 马丽军2, 司利云1(
), 肖剑3, 袁晔4
收稿日期:
2023-08-26
接受日期:
2023-11-03
出版日期:
2024-02-29
发布日期:
2024-02-29
通讯作者:
司利云(1975-),女,讲师,博士。主要研究方向为电力系统大数据分析、智能算法等。E-mail:siliyun@chd.edu.cn第一作者:
胡欣(1975-),女,教授,博士。主要研究方向为能源管理、计算机视觉和机器学习等。E-mail:huxin@chd.deu.cn
基金资助:
HU Xin1(), HU Shuai1, MA Lijun2, SI Liyun1(
), XIAO Jian3, YUAN Ye4
Received:
2023-08-26
Accepted:
2023-11-03
Published:
2024-02-29
Online:
2024-02-29
Contact:
SI Liyun (1975-), lecturer, Ph.D. Her main research interests cover power system big data analysis, intelligent algorithms, etc. <break/>E-mail:<email>siliyun@chd.edu.cn</email>
First author:
HU Xin (1975-), associate professor, Ph.D. Her main research interests cover energy management, computer vision and machine learning, etc. E-mail:huxin@chd.deu.cn
Supported by:
摘要:
随着电子信息产业迅速发展,PCB行业作为电子信息产业的基础,其产品质量对后续生产的电子产品有着决定性影响。针对PCB缺陷目标较小,缺陷类型多,特征不明显,在实际生产过程中易产生误检、漏检等问题,提出了一种多分支注意力MBAM模块方法,在3个不同维度对特征图进行关注,以增强特征提取的能力,对缺陷区域给予更多的注意力表示。通过改进YOLOv5结构,将MBAM与YOLOv5网络结合,有效的提升了对PCB中小目标的检测性能。最后通过在网络不同位置添加MBAM模块进行对比实验,选取了最佳的添加位置。通过在PCB缺陷数据集上的实验结果表明,改进后的PCB缺陷检测算法具有良好的检测性能,优于其他对比算法,最终的AP达到了96.7%,对比标准YOLOv5的94.7%提高了2个百分点,其他项指标均有涨点,在保持检测速度基本不变的情况下,精准地识别PCB缺陷类型。
中图分类号:
胡欣, 胡帅, 马丽军, 司利云, 肖剑, 袁晔. 基于融合MBAM与YOLOv5的PCB缺陷检测方法[J]. 图学学报, 2024, 45(1): 47-55.
HU Xin, HU Shuai, MA Lijun, SI Liyun, XIAO Jian, YUAN Ye. PCB defect detection method based on fusion of MBAM and YOLOv5[J]. Journal of Graphics, 2024, 45(1): 47-55.
图1 常见的PCB缺陷((a)漏孔;(b)鼠咬;(c)开路;(d)短路;(e)杂散;(f)杂铜)
Fig. 1 Common PCB defects ((a) Via hole leakage; (b) Mouse bite; (c) Open circuit; (d) Short circuit; (e) Stray; (f) Pseudo copper)
算法 | 评价指标 | ||||||
---|---|---|---|---|---|---|---|
添加MBAM | mAP/% | AP50/% | AP75/% | APS/% | APM/% | FPS/(帧/秒) | |
YOLOv3 | × | 33.9 | 89.8 | 33.9 | 34.5 | 37.1 | 53.3 |
YOLOv4 | × | 46.5 | 93.4 | 36.1 | 45.5 | 50.0 | 75.8 |
RetinaNet | × | 46.5 | 95.2 | 45.7 | 46.3 | 51.4 | 35.2 |
Faster-RCNN | × | 50.1 | 95.6 | 46.3 | 48.7 | 53.2 | 34.1 |
YOLOv5 | × | 50.6 | 94.7 | 45.9 | 48.1 | 54.9 | 110.4 |
YOLOv3 | √ | 36.3 | 91.2 | 40.7 | 36.1 | 40.4 | 52.1 |
YOLOv4 | √ | 46.9 | 94.1 | 39.7 | 46.9 | 50.7 | 74.9 |
RetinaNet | √ | 48.2 | 96.0 | 46.6 | 48.3 | 51.9 | 34.6 |
Faster-RCNN | √ | 51.6 | 96.2 | 47.3 | 49.9 | 54.7 | 32.1 |
本文算法 | √ | 52.3 | 96.7 | 48.1 | 50.6 | 56.4 | 109.1 |
表1 不同算法结果对比
Table 1 Comparison of results of different algorithms
算法 | 评价指标 | ||||||
---|---|---|---|---|---|---|---|
添加MBAM | mAP/% | AP50/% | AP75/% | APS/% | APM/% | FPS/(帧/秒) | |
YOLOv3 | × | 33.9 | 89.8 | 33.9 | 34.5 | 37.1 | 53.3 |
YOLOv4 | × | 46.5 | 93.4 | 36.1 | 45.5 | 50.0 | 75.8 |
RetinaNet | × | 46.5 | 95.2 | 45.7 | 46.3 | 51.4 | 35.2 |
Faster-RCNN | × | 50.1 | 95.6 | 46.3 | 48.7 | 53.2 | 34.1 |
YOLOv5 | × | 50.6 | 94.7 | 45.9 | 48.1 | 54.9 | 110.4 |
YOLOv3 | √ | 36.3 | 91.2 | 40.7 | 36.1 | 40.4 | 52.1 |
YOLOv4 | √ | 46.9 | 94.1 | 39.7 | 46.9 | 50.7 | 74.9 |
RetinaNet | √ | 48.2 | 96.0 | 46.6 | 48.3 | 51.9 | 34.6 |
Faster-RCNN | √ | 51.6 | 96.2 | 47.3 | 49.9 | 54.7 | 32.1 |
本文算法 | √ | 52.3 | 96.7 | 48.1 | 50.6 | 56.4 | 109.1 |
方法 | 评价指标 | |||||
---|---|---|---|---|---|---|
mAP/ % | AP50/ % | AP75/ % | APS/ % | APM/ % | FPS/ (帧/秒) | |
YOLOX | 50.3 | 94.1 | 47.0 | 47.8 | 53.6 | 72.6 |
YOLOv6 | 51.2 | 94.9 | 48.1 | 48.2 | 54.2 | 81.4 |
YOLOv7 | 50.9 | 95.7 | 47.6 | 49.6 | 53.7 | 97.8 |
YOLOv8 | 52.0 | 96.2 | 50.2 | 49.1 | 55.6 | 112.6 |
本文算法 | 52.3 | 96.7 | 48.1 | 50.6 | 56.4 | 109.1 |
表2 YOLO系列算法对比
Table 2 Comparison of YOLO Series Algorithms
方法 | 评价指标 | |||||
---|---|---|---|---|---|---|
mAP/ % | AP50/ % | AP75/ % | APS/ % | APM/ % | FPS/ (帧/秒) | |
YOLOX | 50.3 | 94.1 | 47.0 | 47.8 | 53.6 | 72.6 |
YOLOv6 | 51.2 | 94.9 | 48.1 | 48.2 | 54.2 | 81.4 |
YOLOv7 | 50.9 | 95.7 | 47.6 | 49.6 | 53.7 | 97.8 |
YOLOv8 | 52.0 | 96.2 | 50.2 | 49.1 | 55.6 | 112.6 |
本文算法 | 52.3 | 96.7 | 48.1 | 50.6 | 56.4 | 109.1 |
方法 | 位置 | ||||
---|---|---|---|---|---|
MBAM | 第一个CSP_3 | 第二个CSP_3 | SPP | AP50/% | |
YOLOv5 | × | × | × | × | 94.7 |
YOLOv5 | √ | √ | × | × | 95.1 |
YOLOv5 | √ | √ | √ | × | 95.8 |
本文算法 | √ | √ | √ | √ | 96.7 |
表3 MBAM模块添加在不同位置的结果
Table 3 Results of MBAM modules added in different locations
方法 | 位置 | ||||
---|---|---|---|---|---|
MBAM | 第一个CSP_3 | 第二个CSP_3 | SPP | AP50/% | |
YOLOv5 | × | × | × | × | 94.7 |
YOLOv5 | √ | √ | × | × | 95.1 |
YOLOv5 | √ | √ | √ | × | 95.8 |
本文算法 | √ | √ | √ | √ | 96.7 |
方法 | 评价指标 | |||||
---|---|---|---|---|---|---|
mAP/% | AP50/% | AP75/% | APS/% | APM/% | FPS/(帧/秒) | |
YOLOv5 | 50.6 | 94.7 | 45.9 | 48.1 | 54.9 | 110.4 |
YOLOv5+SE | 51.0 | 94.9 | 46.6 | 47.4 | 55.6 | 83.2 |
YOLOv5+BAM | 51.6 | 94.9 | 45.8 | 48.9 | 55.5 | 79.3 |
YOLOv5+CBAM | 52.0 | 95.3 | 47.2 | 49.3 | 56.0 | 90.9 |
本文算法 | 52.3 | 96.7 | 48.1 | 50.6 | 56.4 | 109.1 |
表4 与其他注意力模块对比
Table 4 Comparison with other attention modules
方法 | 评价指标 | |||||
---|---|---|---|---|---|---|
mAP/% | AP50/% | AP75/% | APS/% | APM/% | FPS/(帧/秒) | |
YOLOv5 | 50.6 | 94.7 | 45.9 | 48.1 | 54.9 | 110.4 |
YOLOv5+SE | 51.0 | 94.9 | 46.6 | 47.4 | 55.6 | 83.2 |
YOLOv5+BAM | 51.6 | 94.9 | 45.8 | 48.9 | 55.5 | 79.3 |
YOLOv5+CBAM | 52.0 | 95.3 | 47.2 | 49.3 | 56.0 | 90.9 |
本文算法 | 52.3 | 96.7 | 48.1 | 50.6 | 56.4 | 109.1 |
图8 本文算法在Neck层的特征可视化图((a)浅层特征图;(b)中间层特征图;(c)深层特征图)
Fig. 8 The feature visualization diagram of the algorithm in Neck layer in this paper ((a) Shallow feature map; (b) Middle layer feature map; (c) Deep feature map)
算法 | 类别 | |||||
---|---|---|---|---|---|---|
短路 | 开路 | 鼠咬 | 杂散 | 杂铜 | 漏孔 | |
YOLOv5 | 94.9 | 97.3 | 98.0 | 97.6 | 97.4 | 98.9 |
本文算法 | 95.7 | 98.1 | 98.1 | 97.7 | 98.6 | 98.9 |
表5 各个类别AP50结果对比/%
Table 5 Comparison of AP50 results by category/%
算法 | 类别 | |||||
---|---|---|---|---|---|---|
短路 | 开路 | 鼠咬 | 杂散 | 杂铜 | 漏孔 | |
YOLOv5 | 94.9 | 97.3 | 98.0 | 97.6 | 97.4 | 98.9 |
本文算法 | 95.7 | 98.1 | 98.1 | 97.7 | 98.6 | 98.9 |
算法 | 类别 | |||||
---|---|---|---|---|---|---|
短路 | 开路 | 鼠咬 | 杂散 | 杂铜 | 漏孔 | |
YOLOv5 | 48.8 | 44.8 | 49.9 | 47.5 | 50.2 | 55.7 |
本文算法 | 50.6 | 46.5 | 51.4 | 48.9 | 52.6 | 56.7 |
表6 各个类别mAP结果对比/%
Table 6 Comparison of mAP results by category/%
算法 | 类别 | |||||
---|---|---|---|---|---|---|
短路 | 开路 | 鼠咬 | 杂散 | 杂铜 | 漏孔 | |
YOLOv5 | 48.8 | 44.8 | 49.9 | 47.5 | 50.2 | 55.7 |
本文算法 | 50.6 | 46.5 | 51.4 | 48.9 | 52.6 | 56.7 |
图9 不同算法检测结果对比((a) YOLOv3;(b) YOLOv4;(c) YOLOv5;(d)本文算法)
Fig. 9 Comparison of detection results of different algorithms ((a) YOLOv3; (b) YOLOv4; (c) YOLOv5; (d) Ours)
[1] | 吴一全, 赵朗月, 苑玉彬, 等. 基于机器视觉的PCB缺陷检测算法研究现状及展望[J]. 仪器仪表学报, 2022, 43(8): 1-17. |
WU Y Q, ZHAO L Y, YUAN Y B, et al. Research status and the prospect of PCB defect detection algorithm based on machine vision[J]. Chinese Journal of Scientific Instrument, 2022, 43(8): 1-17 (in Chinese). | |
[2] | 卢荣胜, 吴昂, 张腾达, 等. 自动光学(视觉)检测技术及其在缺陷检测中的应用综述[J]. 光学学报, 2018, 38(8): 23-58. |
LU R S, WU A, ZHANG T D, et al. Review on automated optical (visual) inspection and its applications in defect detection[J]. Acta Optica Sinica, 2018, 38(8): 23-58 (in Chinese). | |
[3] | SANTOYO J, PEDRAZA J C, MEJÍA L F, et al. PCB inspection using image processing and wavelet transform[M]// MICAI 2007:Advances in Artificial Intelligence. Berlin, Heidelberg: Springer Berlin Heidelberg, 2007: 634-639. |
[4] | PUTERA S H I, IBRAHIM Z. Printed circuit board defect detection using mathematical morphology and MATLAB image processing tools[C]// 2010 2nd International Conference on Education Technology and Computer. New York: IEEE Press, 2010: V5: 359-V5:363. |
[5] | MASHOHOR S, EVANS J R, ARSLAN T. Image registration of printed circuit boards using hybrid genetic algorithm[C]// 2006 IEEE International Conference on Evolutionary Computation. New York: IEEE Press, 2006: 2685-2690. |
[6] |
MAR N S S, YARLAGADDA P K D V, FOOKES C. Design and development of automatic visual inspection system for PCB manufacturing[J]. Robotics and Computer-Integrated Manufacturing, 2011, 27(5): 949-962.
DOI URL |
[7] | BAYGIN M, KARAKOSE M, SARIMADEN A, et al. Machine vision based defect detection approach using image processing[C]// 2017 International Artificial Intelligence and Data Processing Symposium. New York: IEEE Press, 2017: 1-5. |
[8] | 陈世哲. 微电子产品视觉检测中关键技术研究[D]. 哈尔滨: 哈尔滨工业大学, 2006. |
CHEN S Z. Research on the key techniques of microelectronic products vision inspection[D]. Harbin: Harbin Institute of Technology, 2006 (in Chinese). | |
[9] | 李庆, 张丰, 李芬, 等. 一种用于AOI的PCB拼接算法[J]. 华中科技大学学报: 自然科学版, 2011, 39(2): 90-93. |
LI Q, ZHANG F, LI F, et al. A PCB image mosaic algorithm for AOI system[J]. Journal of Huazhong University of Science and Technology: Natural Science Edition, 2011, 39(2): 90-93 (in Chinese). | |
[10] | 宋昀岑. PCB自动光学检测系统基础算法研究[D]. 成都: 电子科技大学, 2014. |
SONG Y C. The study on low-level vision algorithms used in PCB automatic optical inspection systems[D]. Chengdu: University of Electronic Science and Technology of China, 2014 (in Chinese). | |
[11] |
ZHANG F, QIAO N S, LI J F. A PCB photoelectric image edge information detection method[J]. Optik, 2017, 144: 642-646.
DOI URL |
[12] | GUAN S, GUO F L. A new image enhancement algorithm for PCB defect detection[C]// 2011 International Conference on Intelligence Science and Information Engineering. New York: IEEE Press, 2011: 454-456. |
[13] | 姚忠伟. 基于机器视觉的PCB缺陷检测算法研究[D]. 哈尔滨: 哈尔滨工业大学, 2013. |
YAO Z W. Automatic optical inspection on printed circuit board[D]. Harbin: Harbin Institute of Technology, 2013 (in Chinese). | |
[14] |
PARK J Y, HWANG Y, LEE D, et al. MarsNet: multi-label classification network for images of various sizes[J]. IEEE Access, 2020, 8: 21832-21846.
DOI URL |
[15] |
PARK J M, YOO Y H, KIM U H, et al. D3PointNet: dual-level defect detection PointNet for solder paste printer in surface mount technology[J]. IEEE Access, 2020, 8: 140310-140322.
DOI URL |
[16] | HUANG W B, WEI P. A PCB dataset for defects detection and classification[EB/OL]. [2023-08-01]. https://arxiv.org/abs/1901.08204.pdf. |
[17] | 唐三立. 基于高分辨率图像在线PCB缺陷检测关键技术研究[D]. 上海: 上海交通大学, 2019. |
TANG S L. Study on the key technique of PCB defect detection based on high-resolution images[D]. Shanghai: Shanghai Jiao Tong University, 2019 (in Chinese). | |
[18] | 杨杰, 张书杰. 基于密集YOLOv3的印刷电路板缺陷识别[J]. 北京邮电大学学报, 2022, 45(5): 42-48. |
YANG J, ZHANG S J. Defect recognition of printed circuit board based on YOLOv3-dense[J]. Journal of Beijing University of Posts and Telecommunications, 2022, 45(5): 42-48 (in Chinese). | |
[19] | 马德鑫. 基于深度学习的PCB缺陷检测方法研究[D]. 长沙: 湖南大学, 2021. |
MA D X. Research on PCB defect detection method based on deep learning[D]. Changsha: Hunan University, 2021 (in Chinese). | |
[20] | 钱万明, 朱红萍, 朱泓知, 等. 基于自适应加权特征融合的PCB裸板缺陷检测研究[J]. 电子测量与仪器学报, 2022, 36(10): 92-99. |
QIAN W M, ZHU H P, ZHU H Z, et al. Research on defect detection of PCB bare board basedon adaptive weighted feature fusion[J]. Journal of Electronic Measurement and Instrumentation, 2022, 36(10): 92-99 (in Chinese). | |
[21] | 颛孙壮志. 基于图像处理的PCB裸板表面缺陷检测系统[D]. 成都: 电子科技大学, 2022. |
ZHUANSUN Z Z. PCB bare board surface defect detection system based on image processing[D]. Chengdu: University of Electronic Science and Technology of China, 2022 (in Chinese). | |
[22] |
HU B, WANG J H. Detection of PCB surface defects with improved faster-RCNN and feature pyramid network[J]. IEEE Access, 2020, 8: 108335-108345.
DOI URL |
[23] | 何止戈. 基于深度学习方法的PCB图像缺陷检测[D]. 成都: 电子科技大学, 2020. |
HE Z G. Defect of PCB image detection based on deep learning method[D]. Chengdu: University of Electronic Science and Technology of China, 2020 (in Chinese). | |
[24] | BOCHKOVSKIY A, WANG C Y, LIAO H Y M. YOLOv4: optimal speed and accuracy of object detection[EB/OL]. [2023-08-01]. https://arxiv.org/abs/2004.10934.pdf. |
[25] | CHEN K, WANG J Q, PANG J M, et al. MMDetection: open MMLab detection toolbox and benchmark[EB/OL]. [2023- 08-01]. https://arxiv.org/abs/1906.07155.pdf. |
[1] | 李大湘, 吉展, 刘颖, 唐垚. 改进YOLOv7遥感图像目标检测算法[J]. 图学学报, 2024, 45(4): 650-658. |
[2] | 胡欣, 常娅姝, 秦皓, 肖剑, 程鸿亮. 基于改进YOLOv8和GMM图像点集匹配的双目测距方法[J]. 图学学报, 2024, 45(4): 714-725. |
[3] | 牛为华, 郭迅. 基于改进YOLOv8的船舰遥感图像旋转目标检测算法[J]. 图学学报, 2024, 45(4): 726-735. |
[4] | 曾志超, 徐玥, 王景玉, 叶元龙, 黄志开, 王欢. 基于SOE-YOLO轻量化的水面目标检测算法[J]. 图学学报, 2024, 45(4): 736-744. |
[5] | 宫永超, 沈旭昆. 一种用于互惠目标检测与实例分割的深层架构[J]. 图学学报, 2024, 45(4): 745-759. |
[6] | 赵磊, 李栋, 房建东, 曹琪. 面向交通标志的改进YOLO目标检测算法[J]. 图学学报, 2024, 45(4): 779-790. |
[7] | 李跃华, 仲新, 姚章燕, 胡彬. 基于改进YOLOv5s的着装不规范检测算法研究[J]. 图学学报, 2024, 45(3): 433-445. |
[8] | 张相胜, 杨骁. 基于改进YOLOv7-tiny的橡胶密封圈缺陷检测方法[J]. 图学学报, 2024, 45(3): 446-453. |
[9] | 魏陈浩, 杨睿, 刘振丙, 蓝如师, 孙希延, 罗笑南. 具有双层路由注意力的YOLOv8道路场景目标检测方法[J]. 图学学报, 2023, 44(6): 1104-1111. |
[10] | 王大阜, 王静, 石宇凯, 邓志文, 贾志勇. 基于深度迁移学习的图像隐私目标检测研究[J]. 图学学报, 2023, 44(6): 1112-1120. |
[11] | 李利霞, 王鑫, 王军, 张又元. 基于特征融合与注意力机制的无人机图像小目标检测算法[J]. 图学学报, 2023, 44(4): 658-666. |
[12] | 郝帅, 赵新生, 马旭, 张旭, 何田, 侯李祥. 基于TR-YOLOv5的输电线路多类缺陷目标检测方法[J]. 图学学报, 2023, 44(4): 667-676. |
[13] | 邓渭铭, 杨铁军, 李纯纯, 黄琳. 基于神经网络架构搜索的铭牌目标检测方法[J]. 图学学报, 2023, 44(4): 718-727. |
[14] | 胡欣, 周运强, 肖剑, 杨杰. 基于改进YOLOv5的螺纹钢表面缺陷检测[J]. 图学学报, 2023, 44(3): 427-437. |
[15] | 毛爱坤, 刘昕明, 陈文壮, 宋绍楼. 改进YOLOv5算法的变电站仪表目标检测方法[J]. 图学学报, 2023, 44(3): 448-455. |
阅读次数 | ||||||
全文 |
|
|||||
摘要 |
|
|||||