Chemical fibers play an important role in the textile industry and are widely used in fields such as clothing,medicine,and aerospace.China is one of the largest producers of chemical fibers in the world.Textile companies in China typically wind filaments into yarns and conduct quality inspections on them.However,traditional manual inspection methods suffer from low detection efficiency and visual fatigue among workers.With the development of deep learning and image processing algorithms,textile companies have begun to develop machine vision-based defect detection systems to promote the application of artificial intelligence in industrial production.Currently,many object detection algorithm models have complex structures and a large number of parameters,making it difficult to deploy them in production systems in real time and meet the production requirements of textile mills.Therefore,this paper aims to design a machine vision-based yarn defect detection and sorting system that has high accuracy,strong real-time performance,and reliability,to meet the actual production needs of textile companies.This paper mainly completes the following work:Firstly,based on the production needs of the enterprise,a overall design scheme for the embedded system of defect detection and sorting is designed.The scheme includes the construction of a visual detection platform and the software and hardware design of the embedded sorting system,with sufficient consideration given to hardware selection,platform construction,and software design.At the same time,data collection work is completed,and OpenCv image processing algorithms are used to enhance the images to expand the dataset.In addition,a simple and easy-to-use human-machine interaction subsystem is designed to enable the operator to control the entire system through the display screen.Secondly,this paper conducts research and analysis on visual detection algorithms and uses an improved YOLOv5 object detection algorithm for yarn detection.Specifically,a ShuffleNetv2 lightweight network is used to replace the original backbone network to improve detection speed and accuracy.A CBAM attention mechanism is introduced in the feature extraction network of the YOLOv5 base model to improve overall feature extraction efficiency.Transfer learning is used to solve the problem of slow convergence or even inability to converge due to a small dataset,thereby speeding up model training and improving detection accuracy.Finally,this paper successfully improves the YOLOv5 algorithm and trains a lightweight model,which is deployed in the embedded system for testing.The experimental results show that the detection speed reaches 28.4FPS,which meets the real-time requirements,while the accuracy reaches 92.5%,demonstrating high detection precision.Therefore,this system can meet the requirements of textile companies in actual production. |