作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2024, Vol. 50 ›› Issue (7): 282-292. doi: 10.19678/j.issn.1000-3428.0068237

• 图形图像处理 • 上一篇    下一篇

基于球面折反射成像和YOLOv7的内螺纹缺陷检测

张诗婧, 莫绪涛*(), 赵行, 董杨林   

  1. 安徽工业大学微电子与数据科学学院, 安徽 马鞍山 243002
  • 收稿日期:2023-08-16 出版日期:2024-07-15 发布日期:2023-11-14
  • 通讯作者: 莫绪涛
  • 基金资助:
    安徽省高校优秀青年人才支持计划项目(gxyq2022014); 教育部2021年第二批产学研合作协同育人项目(202102153068); 安徽省教育厅自然科学研究项目(KJ2020A0238)

Internal Thread Defect Detection Based on Spherical Catadioptric Imaging and YOLOv7

Shijing ZHANG, Xutao MO*(), Xing ZHAO, Yanglin DONG   

  1. School of Microelectronics and Data Science, Anhui University of Technology, Maanshan 243002, Anhui, China
  • Received:2023-08-16 Online:2024-07-15 Published:2023-11-14
  • Contact: Xutao MO

摘要:

螺母在机械制造环节得到广泛应用, 其内壁螺纹质量对于机械联接至关重要。为了实现螺母内螺纹的非接触缺陷检测, 首先提出一种基于球面折反射全景成像原理的图像采集装置, 其次利用该装置采集图像数据集并提出一种基于改进YOLOv7的缺陷检测算法。该成像装置具备一次性成像、无须伸入内壁、采集到的内螺纹图像细节完整等优势, 有效地改进了传统视觉检测方案存在的成像分辨率低、相机视场占比小的问题。对YOLOv7模型进行改进并结合螺母内螺纹的缺陷特征, 使用k-means++算法聚类锚框, 使得模型训练更容易收敛。通过在特征融合网络中加入坐标注意力(CA)机制, 提高网络的特征表达能力。使用SIoU损失函数替换原YOLOv7模型中的CIoU损失函数, 提高模型分类的准确性和可靠性。实验结果表明, 针对缺口、漏攻纹、刮痕、碎屑4种内螺纹缺陷, 改进后的YOLOv7模型的平均精度(AP)分别达到96.89%、100%、98.07%、99.98%, 平均精度均值(mAP)达到98.74%, 检测速度达到39.64帧/s, 与其他常见模型相比, 改进模型精度更高, 能够满足工业现场的实时检测需求。

关键词: 缺陷检测, 内螺纹, 机器视觉, 球面折反射成像, 深度学习

Abstract:

Nuts are crucial components in mechanical manufacturing, where the quality of their internal threads significantly impacts mechanical connections. This study proposes a non-contact defect detection method for the internal threads of nuts using an image acquisition device based on spherical catadioptric imaging. This device efficiently collects image datasets and employs an enhanced YOLOv7-based defect detection algorithm. The imaging device offers several advantages, including single-attempt image capture without the need for inner wall extension, providing comprehensive details of internal thread images. These features address issues commonly encountered in traditional visual inspection methods, such as low imaging resolution and limited field-of-view ratio. We enhance the YOLOv7 model by integrating it with defect characteristics of nut internal threads by using the k-means++ algorithm to cluster anchor boxes, simplifying model training convergence. Additionally, we improve the network's feature expression ability by incorporating the Coordinate Attention (CA) mechanism into the feature fusion network. Replacing the Complete Intersection over Union (CIoU) loss function in the original YOLOv7 model with the Scylla Intersection over Union (SIoU) loss function, enhances model classification accuracy and reliability. The experimental results demonstrate that the enhanced YOLOv7 model achieves significant precision, with an Average Precision(AP) of 96.89%, 100%, 98.07%, and 99.98%, and a mean Average Precision(mAP) of 98.74% across four types of internal thread defects: internal thread breaches, unthreaded, grinding crack, and scraps. The model achieves a detection speed of 39.64 frames per second, surpassing other common models in accuracy and meeting the real-time detection needs of industrial sites.

Key words: defect detection, internal thread, machine vision, spherical catadioptric imaging, deep learning