Nowadays, the models of deep learning are increasingly used in various industrial applications. However, the storage space of the models is too large, which makes it quite difficult to apply to mobile devices. In order to solve this problem, a model compression algorithm based on optimal clustering is proposed in this paper. Firstly, the model parameters of fully connected layer in deep convolutional neural network are clustered according to the best clustering method. Then the cluster center of the parameters is selected as the representative of the original parameter matrix. At last, the parameters of the cluster center are transformed differently in the forward calculation of the model to achieve the effect of compressing the parameters of the model and ensured the accuracy of the model. The compression algorithm proposed here is compared with other model compression algorithms in several common deep learning models such as Alexnet, VGG16 and so on. The results show that the algorithm proposed in this paper can compress the memory of the model greatly and improve the accuracy.