| Because of its unique appearance and low tar content,special-shaped cigarettes have been recognized by consumers.Therefore,the daily sorting volume of special-shaped cigarettes by tobacco companies is very large,and the phenomenon of wrong sorting and missing sorting is inevitable in the sorting process.If the phenomenon of wrong sorting and missing sorting takes place frequently,it can cause certain economic loss and credibility impact to tobacco enterprises.Currently,tobacco enterprises mostly use manual inspection for the phenomenon of wrong sorting and missing sorting,but manual inspection is inefficient and suffers from long detection times and undetected errors.Therefore,it is imperative for tobacco enterprises to adopt computer vision technology,which can automatically identify and detect tobacco products of different types to improve the efficiency of error detection.In this paper,the recognition algorithm of special-shaped cigarettes is studied,and the recognition accuracy of special-shaped cigarettes is guaranteed by barcode recognition and feature extraction.On the basis of the recognition algorithm of special-shaped cigarettes,the error detection system of special-shaped cigarettes sorting line was designed for W tobacco Company.Firstly,the system is analyzed in terms of background and demand,based on which the overall design of the system is carried out,followed by the implementation of image acquisition,product identification,data processing,error processing and other functions are realized.Finally,the function and performance of the system are tested to make the system meet the error detection requirements of W Company.The key and difficulty of this system lies in the recognition of special-shaped cigarette,that is,to overcome the fast transmission speed of special-shaped cigarette,the tilt of smoke posture,but also to avoid the interference of light in the detection environment.The research on the recognition algorithm of special-shaped cigarette is as follows:For barcode recognition,a barcode data set was established,and the YOLOv4 target detection algorithm was used to locate the barcode of the abnormal cigarette,then the bar code correction algorithm based on Hough transform was used to correct the inclined bar code,and finally the pyz Bar decoding tool was used to decode the barcode of the special-shaped cigarette.The algorithm has a high recognition rate and fast speed after locating the barcode.When the tilt Angle of special-shaped cigarette is less than 45°,the recognition accuracy is close to 100%.However,it is difficult to identify special-shaped cigarette when the tilt of smoke shape is too large and the bar code is blocked.Therefore,the matching algorithm based on feature extraction is studied.For the recognition method of different tobacco product regulation based on feature extraction,firstly,the image to be detected is obtained through image binarization,morphological operation,filtering and denoising,contour extraction and other image pretreatment operations,then based on Halcon software,color features were extracted to obtain the color feature range,and the dissimilar color smoke was screened out.Through feature extraction,it is possible to identify the special-shaped cigarette whose bar code is blocked or whose smoke posture is large,but the recognition speed is slower than that based on bar code.Therefore,the two are formed in series to complement each other.The system has been tested and the recognition algorithm used for the special-shaped cigarette has remarkable recognition effect.It has a good performance in both recognition rate and real-time performance,and finally achieves a high recognition rate of 99.99%.In addition,it takes 44ms on average for single image recognition,which meets the requirements of W Company and solves the key problems plaguing tobacco enterprises. |