Abstract:
In order to improve the efficiency and accuracy of integrity inspection of machine-made cigars in the packaging process, a visual inspection method for identifying various defects of machine-made cigars in packets was established. An image collection system was configured on a cigar packaging machine to capture the images of the uncovered packets containing cigars of different types of defects and create the dataset of missing and broken cigars and the dataset of damaged cigars separately. The images with typical features in the missing and broken cigar dataset were processed by Hough transform and then identified by edge detection and minimum enclosing rectangle method to judge whether the number of cigars in the packet and the length of each cigar met the specifications. After introducing the Pyramid Squeeze Attention Mechanism (PSA) and the EIoU Loss function into the backbone of YOLOv5s model, the original images were checked against the dataset of cigars with different degrees of damage to judge whether there were any damaged cigars. The results showed that: 1) For the method for missing or broken cigars, it could go through 21 frames of image per second and the identification accuracy reached 100%. 2) For the modified YOLOv5s model, it could go through 30 frames of image per second. When the confidence threshold was set at 0.6, the identification accuracy was 100%, and the inspection accuracy and recall rate increased by 1.80 and 0.93 percentage points, respectively, compared to the original YOLOv5s model. 3) The time for going through a single frame of image was 0.080 s, which met the requirement of real-time inspection of machine-made cigars in packets. This technology supports the improvement of cigar packaging quality.