| In the "Fourteenth Five-Year" development plan,intelligent manufacturing is the inevitable trend of industrial development,and industrial camera is an indispensable part of intelligent manufacturing.The lens is an important part of industrial camera,and the quality of lenses has a decisive influence on the performance of camera.In the production process of lenses,various defects will inevitably occur,but traditional methods for manual visual inspection of lens defects are inefficient,costly and unstable.There is also a machine vision detection method that relies on manual extraction of defect features,which reduces the detection cost and improves the stability by replacing people with machines,but the detection results of this method still depend heavily on the detection experience and environment.The defect detection method based on deep learning reduces the influence of environmental factors,but it is prone to over-fitting problems when the number of training data is too small,and the defect detection accuracy of this method for small target types is low.Aiming at the problems existing in manual visual inspection,a detection system of lens defects based on machine vision was built to realize the detection of multiple lenses defects.To build a machine vision system,it is necessary to select the industrial camera model,design the machine vision lens,and determine the lighting source and lighting mode.This machine vision system can detect scratches with width greater than or equal to 0.06 mm,pockmarks with equivalent diameter greater than or equal to 0.4mm,foreign bodies and other defects.Label Img tool is used to mark defect information on single lens images segmented by image processing algorithm,and 1278 lens defect images are obtained as data sets.To solve the problem that deep learning methods are prone to overfitting,a DualChannel Generative Adversarial Networks(Dual-C GAN)data enhancement method is proposed.The improved VGG-16 model was used as the feature extraction layer in this method to extract the deep features of the lens defect images.The Dual-C GAN is made up of global discriminator and local discriminator.The local discriminator,which uses Patch GAN and YOLO for reference,increases the confidence loss function of defect detection and enhances the detailed information of generated images.The experimental results show that the proposed data enhancement method reaches 0.52,0.15 and 0.28 respectively in the three evaluation indexes of P1-NN value,MMD distance and WD value,the Dual-C GAN can effectively enlarge the data set of lens defects.In order to solve the problem of low detection accuracy of small target type defects,a detection network of lens defects based on multi-scale Faster R-CNN was proposed.The proposed detection network takes Faster R-CNN as the basic network framework,and through verifying the influence of different Io U values on the detection accuracy of lens defects,the detection effect of the detection network on various types of defects is enhanced;Using Feature Pyramid Networks as the feature extraction layer of detection network,the detection accuracy of small targets is improved by extracting shallow fine-grained features and deep semantic features of defects.The comparative experiment shows that the recognition quality of the model is better than other schemes when the Feature Pyramid Networks is adopted and Io U is equal to 0.7.At this time,the comprehensive detection accuracy of the network for four types of defects,i.e.pitting,bubbles,scratches and foreign bodies,reaches 98.59%,and the recall rate reaches 98.28%. |