In order to more accurately locate and segment the varistor image to achieve the varistor image data set necessary for automatic construction of deep learning. This paper proposes a method for locating and stitching the body and stitch of varistor based on Hough transform and mathematical morphology. In order to obtain an image that eliminates surface reflection, the method first acquires a varistor image through a coaxial light source. Secondly, performing preprocessing on the image based on denoising, graying, and binarization; then, using the Hough transform based on circle detection to locate the body of the resistor; further separating the body and the stitches, firstly performing edge searching on the positioned body portion, and then performing background filling on the inside of the body, and finally using a mathematical morphology etching operation to eliminate the edge marks of the body to obtain the positioning of the stitches. The experiment aimed to locate and segment 91 varistor samples, and use the effective and correct data indicators to evaluate the segmentation results. The experimental results show that the actual results of the proposed method are ideal and have a good target segmentation effect, which is beneficial to provide reliable varistor image data sets necessary for deep learning.
Surface defect recognition is one of the key technologies for varistor quality inspection, which can greatly improve detection efficiency and performance. In order to more accurately identify the surface defects of a varistor body and the pins, a method for identifying the surface defects based on deep convolutional neural networks (CNN) is proposed. The proposed method mainly includes four stages: image acquisition and data set construction, convolutional neural network modeling, CNN training and testing. Firstly, varistor images are acquired, and the body and pins of the varistor are segmented by image segmentation method. The number of samples is increased by data augmentation to make a data set of 5 classes. Secondly, according to the appearance characteristics of varistor, a CNN model is designed for varistor surface defect recognition. Third, using the created data set, the training data set with category labels are input to the proposed CNN for training. Finally, 1200 test samples were tested on the trained model in the test phase and the performance of the proposed algorithm was evaluated using mean average precision. The experimental results show that our method can identify the surface defects of the main body and pins of varistor efficiently and accurately.