| With the further promotion of the"Made in China 2025"plan,the manufacturing industry,as the pillar of the national economy,is developing in the direction of intelligence and informatization.Terminal block is a kind of commonly used electrical connector,which has a wide range of use,large demand,and increasingly high inspection requirements.Traditional manual inspection can no longer meet the requirements.Therefore,the research on the surface defect detection technology of terminal block has extensive application value.The main work and research contents of this paper are as follows:(1)The establishment of terminal block image acquisition system and data set.Firstly,the key components of the image acquisition system,such as camera and lens,are calculated and selected,and the image acquisition system is built and debugged.Secondly,the image of the terminal block is collected by the image acquisition system,and then the data is cleaned.Thirdly,the images are labeled,and 1098 images containing 5 kinds of defects are collected and labeled.Finally,the data enhancement method is used to expand the defect detection data set.(2)Terminal block defect detection algorithm based on digital image processing.Firstly,the image is pre-processed to separate the foreground and background of the terminal block.Secondly,the template image and the image to be detected are matched to obtain the homography matrix.Thirdly,the image to be detected is homography transformed and then differentiated from the template image.Fourthly,after the difference image is processed to obtain the binary image,the binary image and the image to be detected are logically combined to obtain the defect area.Finally,feature extraction of defects is carried out,and the defects were classified into classifiers.(3)Terminal block defect detection algorithm based on improved YOLOv3.Firstly,according to the characteristics of terminal block surface defects,Re Ne St with stronger performance is used as the backbone to improve the ability of image feature extraction.Secondly,in the neck network,SPP module is added to aggregate the feature maps of different receptive fields together to achieve the fusion of local features and global features.Thirdly,FPN is replaced by improved PANet,the improved PANet reduce the number of input channels,and increase the input and output of a set of feature maps,reduce network parameters and GFLOPs,and improve the sensitivity of the network to small target objects.Fourthly,the SE module is added to the PANet to further improve the ability of the algorithm to achieve adaptive response in the channel dimension and suppress the role of invalid feature maps.Fifthly,according to the defect size of the dataset,K-means algorithm is used to re-cluster 12 anchor frame sizes,which further improves the detection ability for targets with different scales,especially small targets.Finally,the average precision at intersection over union=0.5(AP0.5)of the algorithm reach 79.1%,the average precision at critical quality defects and missing of CE marks reach more than 90%,and the detection speed reached 36FPS,meeting the real-time detection requirements. |