| Varistor is an important component of electronic products,and its surface defect detection is a necessary part to ensure the quality of electronic products.Current surface defect detection methods generally have the problems of difficulty in detecting undefined defects,low detection accuracy and insufficient generalization ability.In response to the above problems,the main work is as follows:(1)A new adaptive image data preprocessing method was proposed,which laid the foundation for improving the accuracy and generalization ability of the detection method.First,color space and image morphology related technologies is used to remove the image background,eliminate the influence of the noise on the image;then edge detection,ellipse feature fitting,affine transformation and other technologies are used to adaptively rotate the image,Cropping operation to standardize it,and solve the problem of inconsistency between image posture and specifications;finally,based on image difference method,image threshold processing and other methods,an adaptive channel selection and image threshold processing algorithm is proposed to accurately extract the difference image,reducing redundant data by at least 93%.(2)The surface defect detection method of single color single specification varistor was improved,and the problems of undefined defect detection difficulty and low detection accuracy are solved.First,a Deep Convolutional Variational AutoEncoder(DCVAE)model with spatial attention mechanism is established to effectively extract the features of good images;then the images before and after reconstruction are differentiated,and the obtained residual images are used to highlight the defect area and attenuates the non-defect area.Finally,experiments are carried out and compared with the two popular unsupervised defect detection methods.The experimental results show that the F1 value of the proposed method is increased by at least 7.4%,and the accuracy is up to 98.58%.(3)The surface defect detection method of multi-color and multi-specification varistor based on transfer learning was improved,and the problem of insufficient generalization ability is solved.First,the DCVAE model is pre-trained with single-color and single-specification source domain data,and then the network parameters of the pre-trained model are migrated to the new DCVAE model.Finally,the DCVAE model is extended with multi-color and multi-specification target domain data.The experimental results show that the average detection accuracy rate is 98.83%.(4)A varistor surface defect detection experimental system was designed and implemented,which verified the effectiveness and real-time performance of the proposed surface defect detection method.The constructed surface defect detection model is used to implement the automatic detection function of the varistor in the actual scene,and the surface defect detection function is tested.The result shows that the detection accuracy rate of the system in actual operation is 96.44%,and the average detection time is 40.2 milliseconds.In summary,the proposed unsupervised detection method for varistor surface defects can detect undefined defects with high detection accuracy and strong generalization ability,and can meet the requirements of varistor surface defect detection scenarios. |