| Surface defect detection is an important part of industrial production.The accuracy and efficiency of detection directly affect the quality of products and the benefits of enterprises.With the rapid improvement of artificial intelligence technology and computer computing power,defect detection technology based on deep learning has become the research frontier and hot spot in the field of defect detection,but the reasoning and deployment process of algorithms often brings high computational and storage costs.To solve this problem,this paper optimizes and lightens the YOLOv4 target detection model to apply it to the surface defect detection task in industry,and has achieved ideal results.The main research work includes:1.This article focuses on the overall lightweight improvement of YOLOv4.The lightweight neural network Mobile Net series(Mobile Netv1,Mobile Netv2,and Mobile Netv3)is used to replace the original backbone CSPdarknet53 in YOLOv4,and the deep separable convolution is introduced to replace the traditional convolution to greatly reduce the number of model parameters.Combining data enhancement Mosaic to enrich the data set and train based on the idea of transfer learning to accelerate the model convergence.The learning rate cosine annealing decay algorithm is used to optimize the convergence effect.The memory consumption of the final optimized model is only one fifth of the original YOLOv4,which significantly reduces the hardware deployment cost of the model.2.The improved model was applied to two challenging data sets of surface defects in industrial products(printed circuit boards and strip steel).Firstly,the image is preprocessed and data enhanced,and then produced into a standard PASCAL VOC dataset format and input to the model for training.Subsequently,the performance of the model was tested through multiple dimensional evaluation indicators and a series of comparative experiments.The experimental results show that compared with the original model,the improved model can detect the strip surface defects on a single GPU at a speed of 88 FPS while maintaining accuracy,and the speed is increased by 214%.In addition,only 0.11% of the average accuracy value is lost on the PCB surface defect data set,and the detection speed is improved by 200%.Extensive test results show that our proposed model can significantly improve detection speed and efficiency without affecting detection accuracy.3.Develop a real-time online surface defect detection system based on the optimization model.According to actual needs and hardware parameters,select CMOS industrial area array cameras,optical fixed focus lenses,LED light sources,etc.to complete the hardware construction of the system.In the system software section,optimization models and image processing programs are integrated with the Py Qt5 framework based on Python3.8 language to develop graphical user interfaces.The final detection system can meet the requirements of real-time surface acquisition and defect detection of industrial products. |