| With the increasing demand for electronic products in the country,the task of defect detection in the assembly of Printed Circuit Boards(PCB)on production lines has become increasingly important.Defect detection of component assembly is a crucial indicator for ensuring the qualification rate of PCB.Common issues in PCB assembly include component floating height and resistor misplacement,where floating height can result in solder pad cracking during component collision,and resistor misplacement can cause functional abnormalities in the PCB.To address these two problems in PCB assembly,this thesis focuses on researching machine vision-based algorithms for component floating height defect detection and deep learning-based algorithms for resistor misplacement defect detection.The work in this thesis includes the following:(1)Completed the overall design of the PCB component assembly defect detection system,analyzed the production inspection requirements of the factory,formulated system design and implementation,and set up a simulated factory environment.Through capturing images of five different types of PCB boards in the simulated factory environment,collecting 2500 data samples for testing and validation.Finally,after testing and validation,the real-time defect detection for floating height defects and resistor misplacement defects can achieve an accuracy of 89% in the simulated factory environment.(2)For the floating height assembly defect detection issue,this thesis proposes a machine vision-based floating height detection algorithm.The algorithm calculates the pixel translation distance of the component through camera calibration,least squares fitting,edge operator detection,Hough detection,and feature point matching algorithms.The height is calculated based on the fitting parameters,and the floating height value is determined by comparing the height difference with a threshold.Finally,through experiments,the effectiveness of the proposed solution is proven to meet the requirements of the factory,and it can achieve assembly defect detection for floating height values of 2mm within 40 ms.(3)For the resistor misplacement defect detection issue,this thesis proposes a deep learning-based resistor misplacement defect detection algorithm using the YOLOv5 localization algorithm,optimized for the resistor detection environment.To improve the detection speed,the CSP network is replaced with the more efficient Shuffle Net V2 network.Meanwhile,to enhance the detection accuracy,an attention mechanism is introduced into the detection model.The improved network has an average prediction speed of approximately 17 ms with an accuracy of 98.6%,which is a 71% increase in speed and a 0.2% increase in accuracy compared to the original model.After resistor localization and vertical correction,the resistor is classified based on color using a classifier to achieve color ring recognition.Finally,the resistor value is calculated based on the arrangement of the color rings,and the presence of resistor misplacement defect is determined based on the resistor value.Experimental results show that the proposed algorithm achieves an accuracy of 97% and an average detection speed of 30 ms in resistor misplacement defect detection in a simulated factory environment.By integrating machine learning and deep learning approaches,this study has successfully addressed two major challenges in PCB assembly defect detection,and has contributed valuable experience and methods to the task of PCB assembly defect detection for domestically developed defect detection equipment. |