Traditional particle swarm optimization has obvious advantages, but with increased complexity of the environment. When the traditional algorithm is used, the sensitivity of the clustering center is increased, there are too many empty clusters, and the performance of the class label has insufficient influence on the clustering results. An improved algorithm is proposed, which aims at semi-supervised K-means clustering; first, the clustering center is initialized by random calculation in an adaptive K-value method, and the particles are encoded according to the needs of the mean clustering algorithm. At the same time, the objective function is reconstructed with the concept of soft constraints, and finally the improved algorithm is used for optimization. The adaptive parameters in the improved particle swarm optimization algorithm is improved, two disturbance methods of immune disturbance and chaos disturbance is introduced, and the annealing strategy and dynamic clustering strategy at the same time is applied. Experiments show that the algorithm has solved the above problem.