Simple SummaryPig face recognition plays an important role in the intelligent breeding and accurate management of pigs, and the mobile and embedded applications of this technology in the management of small and medium-sized pig farms are in great demand; therefore, in order to make the model more suitable for use in small and medium-sized pig farms, in this study, PCA pre-treatment was added to the traditional method. The experiment shows that the model is suitable for small and medium-sized pig farms, and it can promote the intelligent transformation of pig breeding management.AbstractTo explore the application of a traditional machine learning model in the intelligent management of pigs, in this paper, the influence of PCA pre-treatment on pig face identification with RF is studied. By this testing method, the parameters of two testing schemes, one adopting RF alone and the other adopting RF + PCA, were determined to be 65 and 70, respectively. With individual identification tests carried out on 10 pigs, accuracy, recall, and f1-score were increased by 2.66, 2.76, and 2.81 percentage points, respectively. Except for the slight increase in training time, the test time was reduced to 75% of the old scheme, and the efficiency of the optimized scheme was greatly improved. It indicates that PCA pre-treatment positively improved the efficiency of individual pig identification with RF. Furthermore, it provides experimental support for the mobile terminals and the embedded application of RF classifiers.