Internal Thread Defect Detection Based on Spherical Catadioptric Imaging and YOLOv7
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.