| With the rapid development of deep learning in the field of computer vision,deep learning object detection techniques have gained widespread application due to their high detection efficiency,excellent detection stability,and widespread demand in production.However,in terms of defect detection on medium and high-speed production lines,such as the detection of subtle defects on the surfaces of small metal parts,there are still issues with insufficient accuracy and low detection efficiency.This paper carries out in-depth research on the detection of subtle surface defects in small metal parts on production lines,transfer learning,and the construction of defect detection systems,with the main content including:(1)Proposing the HR-YOLOv5s model based on higher-order residual networks and reparameterisation ideas.In response to the insufficient Mean Average Precision(MAP)accuracy of the original YOLOv5s model in the task of detecting subtle defects in small metal parts,an improved HR-YOLOv5s model is proposed,based on higher-order residual networks and convolution kernel reparameterisation algorithms.Experimental results show that the HR-YOLOv5s model improves MAP accuracy by 2.9%and F1score by 2.3%in the task of detecting subtle surface defects in small metal parts.(2)To address the decline in accuracy for the embossing defect category in the HRYOLOv5s model,two improved models,HRPNC-YOLOv5s and HRPNPC-YOLOv5s,based on CBAM attention mechanisms for inter-region feature selection are proposed.Experimental results indicate that,compared to the HR-YOLOv5s model,the HRPNCYOLOv5s model improves MAP accuracy by 1%and F1-score by 1.5%in the task of detecting subtle surface defects in small metal parts;the HRPNPC-YOLOv5s model improves MAP accuracy by 1.4%and F1-score by 2%compared to the HRPNCYOLOv5s model in the same task.Both improved models have higher accuracy in the embossing defect category than the YOLOv5s model.(3)To reduce the time required for retraining neural networks for different types of products,an improved warm-up transfer learning strategy is proposed.Experiments show that,compared to strategies without transfer learning,direct transfer,and staged unfreezing of neural network model weights,the improved warm-up transfer learning strategy adopts a gradual unfreezing of transfer weights and uses a lower learning rate at the initial stage of training,reducing the number of training epochs by 51.0%,36.1%,and 11.7%,respectively.Simultaneously,the HRPNPC-YOLOv5s model improves MAP accuracy by 2.6%and F1-score by 2%compared to the YOLOv5s model in the task of detecting subtle surface defects in PCB printed circuit boards,further demonstrating the effectiveness of the improved model.(4)To address the visualisation issue of defect detection algorithms,a defect detection visualisation system is designed and implemented.To facilitate the use of defect detection algorithm models by workers to inspect workpieces,a desktop-based visualisation system is developed using PyQT.System functions include:model training,defect detection,linkage camera image reading,local image reading,and defect visualisation,making it convenient for workers to use annotated datasets for retraining or transfer of neural network models and defect detection.In summary,this paper investigates the YOLOv5s detection model and its improvement method for small metal parts surface fine defects detection,and proposes HR-YOLOv5s model,HRPNC-YOLOv5s model and HRPNPC-YOLOv5s improved model and conducts experiments on several datasets.The experimental results show that the improved model has different degrees of improvement over the YOLOv5s model on the small metal parts dataset,NEU-DET dataset,GC10-DET dataset and PCB dataset.Meanwhile,for the phenomenon that HR-YOLOv5s model degrades in embossing accuracy,HRPNC-YOLOv5s model and HRPNPC-YOLOv5s improved model effectively solve this problem.In addition,an improved migration learning strategy is studied and proposed for the need of retraining for different batches of products,which significantly reduces the time required for retraining.Finally,in order to cope with the demand for visual operation of defect detection tasks,a defect detection platform operation interface is designed using the PyQT framework.This study provides an efficient and stable inspection solution for real production environments,which helps to improve product quality,reduce production costs,and further promote industrial automation in the field of small metal parts production. |