| As the world’s largest textile and garment producer,consumer and exporter,China has the world’s most fabric production machines.However,the traditional cloth spinning machine still continues the labor-intensive production method,which consumes a lot of manpower and material resources to ensure the quality of the cloth.With the rapid development of deep learning algorithms and edge computing equipment in recent years,deep learning technology has been widely used in cloth defect detection.It has gradually become a reality to replace manual guards with artificial intelligence methods.However,due to the complex network structure of deep learning algorithms and large-scale calculations,it is necessary to fully consider the requirements of the actual application scenario for the detection system if it is to be applied to the actual fabric production line for real-time defect detection.This paper takes cloth image as the experimental research object,and develops a real-time detection system for cloth image defects with high accuracy,fast calculation speed,and strong reliability from the aspects of deep learning model design,model optimization,image post-processing,and system optimization.The main tasks completed in this paper are as follows:1.Under the condition of the limited number of samples in the data set,this article used three methods of adding salt and pepper noise,adjusting contrast and brightness,and adjusting the rotation angle to enrich and expand the data set,and then apply the convolutional autoencoder network to unsupervised learning of the cloth image.A lightweight Tensorflow model with good cloth image restoration effect is obtained,and the model is simplified on this basis,and the MNIST data set is used to experiment and analyze the effectiveness of the fully connected layer feature extraction of the model;2.Based on the fixed-point arithmetic characteristics of the NPU in RK3399 Pro,this article applies model compression technology to reduce the size of the convolutional autoencoder model.At the cost of losing some accuracy,the inference speed of the convolutional autoencoder model is increased from that of floating-point data 10.8 frames per second improved to 14.7 frames per second under fixed-point data.On the basis of model compression,image processing methods such as mean filtering,threshold segmentation,mathematical morphology processing are used to calculate the reconstruction error of the model,and a complete cloth image defect detection algorithm is constructed.The algorithm is detected in the first-level defect data set the accuracy rate is 99.8%,and the detection accuracy rate in the secondary defect data set is 96.4%.Finally,on the test set,the effectiveness of the cloth image defect detection algorithm proposed in this paper is verified on the embedded side;3.Designed a streamlined and effective human-computer interaction subsystem,and built a real-time detection system for fabric image defects.Aiming at the problem that the system’s reasoning speed cannot meet the actual production requirements,this article sets different tasks of the system as sub-processes.Under the multi-process method,the efficiency of data transmission between different tasks is improved,and the reasoning time is saved by 40.3%.The system detection speed increases from 7.4 frames per second to 12.3 frames per second,and meet the real-time requirements of the system. |