Abstract:
To address the problems of missed or false detection and low detection efficiency in the appearance defect recognition of cigarette packets under complex backgrounds, an appearance defect recognition method based on the improved YOLOv8 model was proposed. Firstly, the input images were preprocessed by a chain-of-thought promoted adaptive enhancer to eliminate background noise in the images. Secondly, an improved YOLOv8 model was constructed, in which the lightweight coordinate attention (CA) module was employed to embed the positional information of features into the channel attention module, and the deformable convolutional network (DCN) was adopted to enable the convolution kernel to adaptively adjust the receptive field shape, so as to accurately capture the irregular contour features such as seal wrinkles and incomplete graphics and texts of cigarette packets. Finally, the accurate classification of defect types was realized through a joint weighting function. The results showed that: 1) Compared with the original YOLOv8 model, the accuracy, average detection precision and recall rate of the improved YOLOv8 model increased by 7.0, 4.9 and 7.0 percentage points respectively, and the model size was reduced. 2) Compared with mainstream object detection models such as Faster R-CNN, the improved YOLOv8 model had significantly higher accuracy, average detection precision and recall rate, exhibiting excellent performance in the defect recognition task of cigarette packets. 3) In practical application, defect recognition was performed on 20 000 real-time collected images of cigarette packets, with an accuracy of 99.995%, a recall rate of 100%, and an average detection speed of 50 FPS. The proposed method effectively identifies different types of defects of cigarette packets and meets the application requirements under actual working conditions, and this study provides technical support for the appearance defect detection of cigarette packets.