To explore the application of traditional machine learning model in the intelligent management of pigs, in this paper, the influence of LDA pre-treatment on pig face identification with RF is studied. By testing method, the parameter of two testing schemes, one adopting RF alone and the other adopting RF+LDA, were determined to be the same value, the split quality function should be gini, and the number of decision trees should be 65. With individual identification tests carried out on 10 pigs respectively, although the accuracy rate has decreased slightly, the training time and test time have been reduced to 8.1% and 75% of the old scheme, and the operational efficiency of the optimized scheme has been significantly improved. It indicates that LDA pre-treatment had a positive effect on improving the efficiency of individual pig identification with RF. It provides experimental support for the mobile terminals and embedded application of RF classifiers.