| At present,research on capsule defect detection technology based on machine vision at home and abroad is becoming more and more mature,and some capsule surface defect detection equipment has appeared one after another.The use of machines to achieve automatic detection can greatly improve the competitiveness of enterprises.Foreign research in this field is earlier than domestic,and the detection technology is more mature,but foreign detection equipment is expensive,which has hindered the transformation of the detection mode of many domestic capsule manufacturers.Therefore,it is of great practical significance to study the online detection technology of capsule defects.The purpose of this paper is to use machine vision technology to realize the automatic online detection of the surface defects of capsules.The main research contents are as follows:Firstly,for the visual inspection system,a capsule image acquisition platform was designed and built,the type and quantity of the capsule image data were designed,and the capsule data acquisition was realized through the image acquisition platform.For the problem of image preprocessing,a corresponding solution is provided: the Tensor Flow deep learning framework is used to perform rotate,transpose offline enhancement and Mosaic online enhancement on the data set.And use grayscale,noise reduction and remove uneven illumination methods to enhance the image.Then,based on the YOLOv5 model,the capsule surface defect detection algorithm was designed.And a capsule surface defect online detection model Yolov5_ours was proposed by improving the YOLOv5 model from the two dimensions of the network width and depth.Optimizing experiments on the two hyperparameters of batch size and learning rate,and the comparison experiment of the proposed model and other mainstream algorithms on the data set of this paper,the model obtained 99.96% accuracy rate,99.80% recall rate and 52.13 frames per second detection speed.Experimental results show that the proposed model has obvious advantages in detection accuracy and speed.Finally,a prototype system for detecting the surface defects of capsules was designed and developed.The research work of the overall design,development environment and functional design of the detection software are introduced in detail,and the software is tested and verified. |