| Capsule is an indispensable and important product in pharmaceutical industry,its quality is directly related to people’s life safety.In recent years,with the rapid development of big data and artificial intelligence,research on machine vision has become increasingly mature at home and abroad,and some machine vision-based capsule defect detection equipment has emerged.Realizing intelligent machine detection can greatly improve production efficiency and save labor cost.Research in the field of machine vision inspection,the current level of domestic testing technology is obviously slightly lower than that of foreign countries,However,due to the expensive price of foreign testing equipment,so that many small and medium-sized pharmaceutical manufacturers in China are discouraged,which brings obstacles to many pharmaceutical manufacturers in China to realize the transformation from traditional to artificial intelligence detection.Therefore,the study of in-line detection of capsule defects is of great practical importance.This study aims to develop a feasible quality inspection scheme based on machine vision technology for the study of online inspection of capsule surface defects.The main research contents are as follows:Research on capsule surface defect recognition algorithm for the problem of frequent defects in capsule production in the pharmaceutical industry and the drug standards issued by the State Drug Administration.Firstly,Designed and built a capsule image acquisition system,and completed the acquisition of capsule image dataset.At the same time,Foreground segmentation of capsule images was achieved using the U2-net neural network algorithm,which kept the foreground clear and reduced the background interference.In terms of data enhancement,two kinds of data enhancement methods,Opencv offline enhancement and Mosaic online enhancement,were used to augment the image data and complete the capsule dataset.Secondly,Research on capsule surface defect detection algorithm based on YOLOv5 network model.In this study,we first train three network models of YOLOv5 and find that the YOLOv5 network has insensitive small target detection and poor loss function convergence for the capsule surface defect detection in this training.To address the above issues,Based on YOLOv5 s model to improve the network model from two aspects of feature extraction and bounding box regression calculation,the experimental results show that the average mean accuracy(m AP)of the model detection reached 98% and the speed reached 86.076 frames per second detection speed.And compared with other improved algorithms,the data show that the model has significant advantages over the comparison model in terms of detection accuracy,speed,and loss function.Finally,a capsule surface defect online inspection system was designed,the workflow of the capsule inspection system,the design of the software and the function of the visualization interface are introduced in detail,and the software function detection is tested and verified. |