Objective The confirmation of fabric quality in the textile industry is usually to put the woven fabric into the inspection equipment for inspection. When the fabric defects are found in the inspection process, the repair will be carried out and so increases the production time, thereby reducing the workshop efficiency. In order to improve the efficiency of the workshop, by collecting the real-time data of the weaving workshop, the fabric quality prediction model is established to predict the fabric quality and reduce the fabric production time.Method Aiming at the problem of large difference in fabric quality and long time of conventional fabric inspection, a fabric quality grade prediction method based on K - nearest neighbor algorithm (KNN) improved PSO-BP algorithm was proposed by combining KNN and particle swarm optimization (PSO) improved error back propagation (BP) neural network algorithm. Firstly, the fabric quality prediction model is analyzed, and the fabric defects and fabric quality grades are divided. Secondly, 14 factors affecting the fabric quality are selected as the model input, and then the KNN algorithm is adopted to classify the original sample set. Finally, the classified data is brought into the fabric quality prediction model. The fabric quality prediction model is to use the particle swarm optimization algorithm to obtain the position and speed of the optimal solution through iterative update, and take this as the initial weight and threshold into the neural network structure for training to obtain the model. By predicting the fabric quality grade, the fabric quality is improved.Results 16,186 fabric production data collected over a 3 - month period from a textile factory in Lanxi, Zhejiang Province were adopted to establish a fabric quality prediction model. Firstly, the original data set was adopted to compare and analyze PSO - BP and BP algorithms with different training target errors. According to results of KNN-PSO-BP netural network model, PSO-BP algorithm showed higher accuracy and higher training speed than BP algorithm, and PSO-BP neural network model demonstrated an accuracy of 96% with the training target error 0.000 1. The KNN algorithm was adopted to divide the original sample set into five categories. The mean square error, accuracy and training time of the neural network model were calculated when the training target error is 0. 000 1. The accuracy of the KNN-PSO-BP neural network model was 98. 054%.Conclusion This research demonstrated that KNN-PSO-BP algorithm has higher accuracy than PSO-BP algorithm and BP algorithm. The training time of fabric quality grade prediction is only 4. 8 s, and the accuracy rate is 98.054%. The algorithm greatly shortens the detection time while ensuring the accuracy of fabric quality prediction, improves the production efficiency of weaving, and provides a certain basis for subsequent research on the location and size of fabric defects. © 2024 China Textile Engineering Society. All rights reserved.