Data processing is one of the essential methods to optimize the performance of neural networks. In this paper, we give up the traditional data processing method and propose a method to optimize the deep neural network by processing the mini data set based on the loss. Using this method, each Literation training can obtain a relatively optimal result, and the optimization effects of each time are integrated to optimize the results of each epoch finally At the same time, in order to verify the effectiveness of this data processing method, experiments are carried out on MNIST, HAGRID, and CIFAR-10 datasets to compare the effects of using this method and not using this method under different hyperparameters, and finally, the effectiveness of this data processing method is verified. On this basis, the advantages and disadvantages of this method are summarized. Finally, the future research direction has been prospected.