Abstract:Liquid medicine is easy to mix with insoluble foreign matter during the production process. Therefore, the liquid medicine must be tested in time before being put on the market. A detection method based on machine vision and convolutional neural network is designed for ampoule liquid detection, which is different from the traditional sequential image detection algorithm. First, Canny edge detection is used to extract the edge of the ampoule bottle, and the image of the liquid area is cropped,Reduced the amount of subsequent calculations; secondly, the VGG16 convolutional neural network is used for feature extraction of insoluble foreign bodies, which can extract abstract features other than traditional features. Finally, through transfer learning and fine-tuning, 378 of the 400 test samples were identified as correct.The results show that this method can detect insoluble foreign bodies and meet the actual production requirements.