Abstract:
A surface defect detection method for curved optical lenses based on improved YOLOv5s was proposed to address the issue of low accuracy in surface defect detection. Firstly, a device for collecting surface defects on lenses was designed, and the collected defect images were enhanced to create a dataset of lens defects. Secondly, in order to enhance the utilization of channel information in YOLOv5s network, the SE attention mechanism was introduced into the feature extraction network to enable the network to extract information more accurately, and Transformer was integrated into the last C3 module of the backbone network to help the network better extract global information and improve detection efficiency. Finally, considering the issue of easy loss of feature information for small targets, the feature layer of the backbone network 160×160 was added to the feature fusion of the neck to increase the utilization of shallow information by the network. The mean average precision (
mAP) and recall (
R) of the improved YOLOv5s object detection algorithm are 93.9% and 91.6%, respectively, which are 3.2% and 3.4% higher than that of the original network algorithm, indicating that the improved YOLOv5s algorithm can effectively detect surface defects on lenses.