Tobacco leaves are often mixed with some non-tobacco-related material(NTRM)in the process of harvesting,curing,purchasing and re-baking.The non-tobacco-related material seriously affects the quality of tobacco products and endangers the health of consumers.How to effectively detect and eliminate non-smoking substances in the sorting process is a long-term technical problem that cannot be solved by tobacco redrying plants.The traditional detection and removal methods of non-smoke substances are mostly manual removal,metal detection removal,photoelectric removal,and winnowing removal.The detection accuracy is not high and the efficiency is low.Recently,with the rapid development of computer vision technology,object detection algorithms based on deep neural networks have achieved great success in a variety of visual detection tasks.The target detection algorithm can detect multiple targets in a picture,and can accurately locate the position and size of different targets.It not only ensures real-time performance,but also has high detection accuracy,which provides a solid foundation for the online detection of non-smoking substances.more feasible solution.Based on the image characteristics of non-smoke substances,this paper optimizes and improves the relatively mature YOLOv5 deep learning model to realize the online detection task of non-smoke substances in the machine tobacco leaf sorting process.The specific content is as follows:(1)Tobacco leaf image acquisition system and non-tobacco substance image set construction.By setting up an online image acquisition system to collect and preprocess the images of tobacco leaves containing non-smoking substances,a non-smoking substance image set containing 2148 images was constructed,and the training set and test set were divided by 4:1 using the hold-out method.The ratio is divided,and the position and size of non-smoking substances in the tobacco leaf image are calibrated using the Label Img tool.(2)CIoU loss function optimization.Since EIoU can change the original width-height ratio to width-height value regression,thereby effectively improving the model detection accuracy,the paper uses the EIoU loss function to optimize the CIoU loss in YOLOv5 and compares the performance of the two models.The experimental results show that,The YOLOv5(EIoU)optimization model can largely avoid missed detection,multiple detection and wrong detection,and the recognition accuracy of non-smoking substances reaches 0.865.(3)Model improvement based on attention mechanism.Since the attention mechanism can effectively reduce the amount of processing information,thereby reducing the consumption of computing resources,the paper introduces three different attention mechanisms(CBAM,CA and ECA)to further optimize the YOLOv5(EIoU)model.The experimental results show that YOLOv5 The improved model of(EIoU)+CA has the best detection accuracy,which can further improve the situation of missed detection,multiple detection and false detection.Compared with the original YOLOv5 detection model,the accuracy rate has increased by 2.17%,and the recognition accuracy of non-smoking substances has reached 0.878;At the end of the paper,Visual Studio was used to develop an online detection system for non-smoking substances.By converting the YOLOv5(EIoU)+CA training model into ONNX format and calling it in C#,the feasibility of the improved model was verified. |