With the widespread application of machine vision in the industrial field,the quality inspection of industrial products is constantly developing towards intelligent.The research content of industrial gasket product defect detection in this thesis is derived from the urgent needs of actual enterprises.In the production process of such gasket products,due to the production environment or improper operation,the outline or surface of the company has defects,such as lack of material at the edge,resulting in shape Does not match the design drawing(template image),or there are stains,scratches,or dents on the surface of the product.Aiming at the problems of low efficiency and high false detection rate in manual detection,this thesis combines the different characteristics of contour defects and surface defects of the gasket product,and proposes a corresponding defect detection scheme based on machine vision.The problems solved by the inspection plan include: in the task of contour defect detection,it is necessary to check whether the contour of the gasket product produced by the factory is different from the contour of the template image,that is,contour defects.If there are defects,the location of the defect needs to be located;on the surface In the defect detection task,if there is a defect,the type and location of the defect must be detected.The innovations and main work of this thesis are as follows:(1)Aiming at the contour defect detection of gasket products,the traditional detection method can not accurately detect irregular contour defects such as sawtooth.This thesis proposes a segmented detection algorithm based on improved Hausdorff distance,which can be used for any irregularity.Visual inspection of contour defects in regular shapes.The algorithm divides the matched and aligned template image contours and the sample image contours to be detected into N small segments,calculates the improved Hausdorff distance corresponding to the segmented point set,and forms a distance vector,and finally terminates the iteration according to the designed distance threshold function The condition detects whether there is a defect in the contour,and if there is a defect,the specific location of the defect is detected.Experiments show that,compared to the subtraction method,the segmented method proposed in this thesis has a better effect in detecting irregular contour defects.(2)Aiming at the problem of low average accuracy(Average Precision,AP)of scratch defects when using YOLOv4 detector for surface defect detection of gasket products,use the method of generating images from the generative countermeasure network to expand the scratch defect data to achieve The data is enhanced to improve the detection accuracy of scratches and defects.Based on the Pedestrian-Synthesis-GAN(PS-GAN)model,this thesis proposes an SD-PSGAN model based on the activation function Se LU and Alpha Dropout.This model improves the quality of image generation while alleviating the occurrence of PS-GAN overfitting..Experiments show that adding the scratch images generated by the SD-PSGAN model to the data set improves the average accuracy of scratch defect detection.(3)First,image collection of a small number of defect samples provided by the factory,and then customize a batch of gasket product samples according to the design drawings provided by the factory,and make a batch of unqualified samples according to the types of defects that may occur,collect the images,and finally combine The two-part image forms a defect detection dataset. |