Study on the Influence of PCA Pre-Treatment on Pig Face Identification with Random Forest
Abstract
:Simple Summary
Abstract
1. Introduction
2. Materials and Methods
2.1. Sample Collection
2.2. Principle of Pig Face Identification with RF
- (1)
- RF has both anti-over-fitting and anti-noise performances because random steps are included;
- (2)
- High-dimensional data can be processed;
- (3)
- Learning can be achieved in a parallel way;
- (4)
- The training time can be shortened.
- (1)
- The n_tree training set is generated by sampling the pig face training samples for n_tree times, with m samples taken each time, for which the Bootstrapping method, a random sampling with replacement method, is used.
- (2)
- Every training set needs to train a decision tree model.
- (3)
- When splitting the decision tree according to the information gain or gini index, it is necessary to select an optimal feature among all the features.
- (4)
- Each decision tree is split in this way, and finally, all the training samples of this node are classified into the same category, and there is no pruning operation in this process.
- (5)
- In the end, multiple decision trees will be formed to generate the random forest. In the case of multi-classification tasks, the output of the random forest will be determined by voting.
3. Comparison Process in the Experiment
3.1. Pig Face Identification Test Carried out with Random Forest Alone
3.1.1. Random Forest Model Parameter Determination
3.1.2. Evaluation Index of RF Model
3.2. Experiment of Pig Face Identification with RF + PCA Pre-Treatment
3.2.1. Determination of the k Value in Principal Component Analysis
3.2.2. Determination of RF Parameters in the Optimization Plan
3.2.3. Model Evaluation Index of Optimization Plan
4. Discussion
5. Conclusions
- (1)
- For individual identification of pigs, the RF classifier can be used, for which the parameter selection is relative to the pre-treatment method. If RF alone is used, the splitting quality function shall be “gini”, and the number of decision trees shall be 65; in the case of the PCA + RF optimization scheme, the corresponding parameters shall be “entropy” and 70.
- (2)
- PCA pre-treatment can increase the efficiency of individual pig identification with RF, and the accuracy, recall rate, and the f1-score are increased by 2.66, 2.76, and 2.81 percentage points, respectively, while the testing time is reduced to 75% of the original value.
- (3)
- The RF classifier that underwent PCA pre-treatment is more suitable for application in mobile terminals and embedded application, and it is suitable for the development of a portable and real-time pig face identification system; thus, the cost of intelligent breeding and management of small and medium-sized farms can be reduced, and the process of intellectualization of small and medium-sized farms can be promoted.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Voulodimos, A.S.; Patrikakis, C.Z.; Sideridis, A.B.; Ntafis, V.A.; Xylouri, E.M. A complete farm management system based on animal identification using RFID technology. Comput. Electron. Agric. 2010, 70, 380–388. [Google Scholar] [CrossRef]
- Ghosh, P.; Mandal, S.N. PigB: Intelligent pig breeds classification using supervised machine learning algorithms. Int. J. Artif. Intell. Soft Comput. 2022, 7, 242–266. [Google Scholar] [CrossRef]
- Bazi, Y.; Melgani, F. Convolutional SVM Networks for Object Detection in UAV Imagery. IEEE Trans. Geosci. Remote Sens. 2018, 56, 3107–3118. [Google Scholar] [CrossRef]
- Smith, R.P.; Gavin, C.; Gilson, D.; Simons, R.R.L.; Williamson, S. Determining pig holding type from British movement data using analytical and machine learning approaches. Prev. Vet. Med. 2020, 178, 104984. [Google Scholar] [CrossRef]
- Shaik Mazhar, S.A.; Suseendran, G. Precision Pig Farming Image Analysis Using Random Forest and Boruta Predictive Big Data Analysis Using Neural Network and K-Nearest Neighbor. In Proceedings of the International Conference on Intelligent Engineering and Management (ICIEM), London, UK, 28–30 April 2021; pp. 260–264. [Google Scholar] [CrossRef]
- Adeniyi, E.A.; Ogundokun, R.O.; Gbadamosi, B.; Misra, S.; Kalejaiye, O. Classification of Swine Disease Using K-Nearest Neighbor Algorithm on Cloud-Based Framework. In Artificial Intelligence for Cloud and Edge Computing; Springer: Berlin/Heidelberg, Germany, 2022; pp. 71–90. [Google Scholar]
- Lee, W.; Ham, Y.; Ban, T.-W.; Jo, O. Analysis of growth performance in swine based on machine learning. IEEE Access 2019, 7, 161716–161724. [Google Scholar] [CrossRef]
- Kontschieder, P.; Fiterau, M.; Criminisi, A.; Bulo, S.R. Deep Neural Decision Forests. In Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV), Santiago, Chile, 11–18 December 2015. [Google Scholar]
- Szegedy, C.; Liu, W.; Jia, Y.; Sermanet, P.; Reed, S.; Anguelov, D.; Erhan, D.; Vanhoucke, V.; Rabinovich, A. Going Deeper with Convolutions. In Proceedings of the 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Boston, MA, USA, 7–12 June 2015. [Google Scholar] [CrossRef]
- Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You Only Look Once: Unified, Real-Time Object Detection. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016. [Google Scholar]
- Redmon, J.; Farhadi, A. YOLO9000: Better, Faster, Stronger. In Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017. [Google Scholar]
- Redmon, J.; Farhadi, A. YOLOv3: An Incremental Improvement. arXiv 2018, arXiv:1804.02767. [Google Scholar]
- Bochkovskiy, A.; Wang, C.-Y.; Liao, H.-Y.M. YOLOv4: Optimal Speed and Accuracy of Object Detection. arXiv 2020, arXiv:2004.10934. [Google Scholar]
- Yang, X.; Chai, L.; Bist, R.B.; Subedi, S.; Wu, Z. A Deep Learning Model for Detecting Cage-Free Hens on the Litter Floor. Animals 2022, 12, 1983. [Google Scholar] [CrossRef]
- Maselyne, J.; Saeys, W.; De Ketelaere, B.; Mertens, K.; Vangeyte, J.; Hessel, E.F.; Millet, S.; Van Nuffel, A. Validation of a High Frequency Radio Frequency Identification (HF RFID) system for registering feeding patterns of growing-finishing pigs. Comput. Electron. Agric. 2014, 102, 10–18. [Google Scholar] [CrossRef]
- Maselyne, J.; Adriaens, A.; Huybrechts, T.; De Ketelaere, B.; Millet, S.; Vangeyte, J.; Van Nuffel, A.; Saeys, W. Measuring the drinking behaviour of individual pigs housed in group using radio frequency identification (RFID). Animal 2016, 10, 1557–1566. [Google Scholar] [CrossRef]
- Kapun, A.; Adiron, A.; Gallmann, E. Case Study on Recording Pigs’ Daily Activity Patterns with a UHF-RFID System. Agriculture 2020, 10, 542. [Google Scholar] [CrossRef]
- Maselyne, J.; Saeys, W.; Briene, P.; Mertens, K.; Vangeyte, J.; De Ketelaere, B.; Hessel, E.F.; Sonck, B.; Van Nuffel, A. Methods to construct feeding visits from RFID registrations of growing-finishing pigs at the feed trough. Comput. Electron. Agric. 2016, 128, 9–19. [Google Scholar] [CrossRef]
- Zhu, J.; Ma, S.S.; Bi, Y.G.; Cui, H.M. Construction of digital breeding platform for breeding pig. Trans. CSAE 2010, 26, 215–219. [Google Scholar]
- Zhu, W.; Zhong, F.; Li, X. Automated Monitoring System of Pig Behavior Based on RFID and ARM-LINUX. In Proceedings of the Third International Symposium on Intelligent Information Technology and Security Informatics, Jian, China, 2–4 April 2010. [Google Scholar] [CrossRef]
- Chen, T.Y.; Lin, Y.H.; Shieh, C.S.; Lo, C.C.; Guo, S.W.; Horng, M.F. A RFID-based Diet Estimation of Grower Pigs. In Proceedings of the 2021 International Symposium on Intelligent Signal Processing and Communication Systems (ISPACS), Hualien, Taiwan, 16–19 November 2021; pp. 1–2. [Google Scholar] [CrossRef]
- He, Y.; Tiezzi, F.; Howard, J.; Maltecca, C. Predicting body weight in growing pigs from feeding behavior data using machine learning algorithms. Comput. Electron. Agric. 2021, 184, 106085. [Google Scholar] [CrossRef]
- Gorczyca, M.T.; Milan, H.F.M.; Maia, A.S.C.; Gebremedhin, K.G. Machine learning algorithms to predict core, skin, and hair-coat temperatures of piglets. Comput. Electron. Agric. 2018, 151, 286–294. [Google Scholar] [CrossRef]
- Wongsriworaphon, A.; Arnonkijpanich, B.; Pathumnakul, S. An approach based on digital image analysis to estimate the live weights of pigs in farm environments. Comput. Electron. Agric. 2015, 115, 26–33. [Google Scholar] [CrossRef]
- Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.; Fu, C.-Y.; Berg, A.C. SSD: Single Shot MultiBox Detector. In Proceedings of the European Conference on Computer Vision (ECCV), Amsterdam, The Netherlands, 8–16 October 2016; pp. 21–37. [Google Scholar] [CrossRef]
- Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 39, 1137–1149. [Google Scholar] [CrossRef]
- Win, K.D.; Kawasue, K.; Yoshida, K.; Lee, G. Automatic pig selection system based on body size using a camera: Rotating mechanics for pig selection. Artif. Life Robot. 2020, 26, 155–161. [Google Scholar] [CrossRef]
- Yan, H.W.; Liu, Z.Y.; Cui, Q.L.; Hu, Z.W. Multi-target detection based on feature pyramid attention and deep convolution network for pigs. Trans. Chin. Soc. Agric. Eng. (Trans. CSAE) 2020, 36, 193–202. [Google Scholar]
- Yan, H.W.; Liu, Z.Y.; Cui, Q.L.; Hu, Z.W.; Li, Y.W. Detection of facial gestures of group pigs based on improved Tiny-YOLO. Trans. Chin. Soc. Agric. Eng. (Trans. CSAE) 2019, 35, 169–179. [Google Scholar]
- Kim, T.; Kim, Y.; Kim, S.; Ko, J. Estimation of Number of Pigs Taking in Feed Using Posture Filtration. Sensors 2022, 23, 238. [Google Scholar] [CrossRef] [PubMed]
- Hu, Z.W.; Yang, H.; Lou, T.T. Dual attention-guided feature pyramid network for instance segmentation of group pigs. Comput. Electron. Agric. 2021, 186, 106140. [Google Scholar] [CrossRef]
- Hansen, M.F.; Smith, M.L.; Smith, L.N.; Salter, M.G.; Baxter, E.M.; Farish, M.; Grieve, B. Towards on-farm pig face recognition using convolutional neural networks. Comput. Ind. 2018, 98, 145–152. [Google Scholar] [CrossRef]
- Parkhi, O.M.; Vedaldi, A.; Zisserman, A. Deep Face Recognition. In Proceedings of the British Machine Vision Conference (BMVC), Swansea, UK, 7–10 September 2015; pp. 41.1–41.12. [Google Scholar]
- Ramprasaath, R.S.; Das, A.; Vedantam, R. Grad-CAM: Why Did You Say That? arXiv 2016, arXiv:1610.07450. [Google Scholar]
- Shi, Y.W.; Zhang, Y.Q.; Liu, K.S. Research on Security Issues Based on RFID System. Comput. Sci. 2012, 39, 214–216. [Google Scholar]
- Zhou, J.; Lu, J.Z.; Tu, Y.Z. Discussion on the Use of Intelligent Recognition Terminal to Promote the Management of Animal Ear Tags. Chin. Livest. Poult. Breed. 2018, 14, 33–34. [Google Scholar]
- Adrion, F.; Kapun, A.; Eckert, F.; Holland, E.-M.; Staiger, M.; Götz, S.; Gallmann, E. Monitoring trough visits of growing-finishing pigs with UHF-RFID. Comput. Electron. Agric. 2018, 144, 144–153. [Google Scholar] [CrossRef]
- Wang, Z.; Liu, T. Two-stage method based on triplet margin loss for pig face recognition. Comput. Electron. Agric. 2022, 194, 106737. [Google Scholar] [CrossRef]
- Basak, H.; Kundu, R.; Chakraborty, S.; Das, N. Cervical Cytology Classification Using PCA and GWO Enhanced Deep Features Selection. SN Comput. Sci. 2021, 2, 369. [Google Scholar] [CrossRef]
- Smallman, L.; Underwood, W.; Artemiou, A. Simple Poisson PCA: An algorithm for (sparse) feature extraction with simultaneous dimension determination. Comput. Stat. 2019, 35, 559–577. [Google Scholar] [CrossRef]
- Salih, A.I.; Kardouchi, M.; Belacel, N. Fast and Efficient Face Recognition System Using Random Forest and Histogram of Oriented Gradients. In Proceedings of the International Conference of the Biometrics Special Interest Group (BIOSIG), Darmstadt, Germany, 6–7 September 2012; Volume P-196, pp. 1–11. [Google Scholar]
- Witten, I.H.; Frank, E.; Hall, M.A. Data Mining: Practical Machine Learning Tools and Techniques; Morgan Kaufmann: Los Angeles, CA, USA, 2011; pp. 62–65. [Google Scholar]
- Belle, V. Detection and Recognition of Human Faces Using Random Forests for a Mobile Robot. Ph.D. Thesis, Rheinisch-Westfälische Technische Hochschule Aachen, Aachen, Germany, 2008. [Google Scholar]
- Archer, K.J.; Kimes, R.V. Empirical Characterization of Random Forest Variable Importance Measures. Comput. Stat. Data Anal. 2008, 52, 2249–2260. [Google Scholar] [CrossRef]
- Fanelli, G.; Gall, J.; Van Gool, L. Real Time Head Pose Estimation with Random Regression Forests. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Colorado Springs, CO, USA, 21–23 June 2011; pp. 617–624. [Google Scholar] [CrossRef]
- Yan, H.W.; Cui, Q.L.; Liu, Z.Y. Pig Face Identification Based on Improved Alexnet Model. INMATEH-Agric. Eng. 2020, 61, 97–104. [Google Scholar] [CrossRef]
- Hu, Z.W.; Yang, H.; Lou, T.T.; Hu, G.; Xie, Q.Q.; Huang, J.J. Extraction of pig contour based on fully convolutional networks. J. South China Agric. Univ. 2018, 39, 111–119. [Google Scholar]
- Hu, Z.W.; Yang, H.; Lou, T.T. Instance detection of group breeding pigs using a pyramid network with dual attention feature. Trans. Chin. Soc. Agric. Eng. 2021, 37, 166–174. [Google Scholar]
- Hu, Z.W.; Yan, H.W.; Lou, T.T. Parallel channel and position attention-guided feature pyramid for pig face posture detection. Int. J. Agric. Biol. Eng. 2022, 15, 222–234. [Google Scholar] [CrossRef]
- Hu, Z.W.; Yang, H.; Lou, T.T.; Yan, H.W. Concurrent channel and spatial attention in Fully Convolutional Network for individual pig image segmentation. Int. J. Agric. Biol. Eng. 2023, 16, 232–242. [Google Scholar] [CrossRef]
- Yan, H.W.; Hu, Z.W.; Cui, Q.L. Study on feature extraction of pig face based on principal component analysis. INMATEH-Agric. Eng. 2022, 68, 333–340. [Google Scholar] [CrossRef]
Abbreviation | Meaning |
---|---|
PCA | Principal Component Analysis |
RF | Random Forest |
RFID | Radio Frequency IDentification |
HFRFID | High-Frequency Radio Frequency IDentification |
UHFRFID | Ultra-High Frequency Radio Frequency IDentification |
SVM | Support Vector Machine |
KNN | K-Nearest Neighbors |
LDA | Linear Discriminant Analysis |
VGG | Visual Geometry Group |
SSD | Single Shot Detector |
F-rcnn | Faster Region-based Convolutional Neural Networks |
YOLO | You Only Look Once |
Category | Precision (%) | Recall (%) | f1-Score (%) | Count [a] |
---|---|---|---|---|
1 | 72 | 100 | 84 | 31 |
2 | 96 | 89 | 93 | 28 |
3 | 97 | 91 | 94 | 32 |
4 | 95 | 84 | 89 | 25 |
5 | 87 | 96 | 92 | 28 |
6 | 100 | 79 | 88 | 24 |
7 | 91 | 88 | 89 | 24 |
8 | 78 | 94 | 85 | 31 |
9 | 100 | 83 | 91 | 18 |
10 | 92 | 92 | 92 | 13 |
average | 90.61 | 89.76 | 89.79 | 25 |
Category | Precision (%) | Recall (%) | f1-Score (%) | Count [a] |
---|---|---|---|---|
1 | 81 | 97 | 88 | 31 |
2 | 100 | 93 | 96 | 28 |
3 | 94 | 97 | 95 | 32 |
4 | 100 | 92 | 96 | 25 |
5 | 96 | 86 | 91 | 28 |
6 | 95 | 83 | 89 | 24 |
7 | 92 | 92 | 92 | 24 |
8 | 83 | 97 | 90 | 31 |
9 | 100 | 89 | 94 | 18 |
10 | 100 | 100 | 100 | 13 |
average | 93.22 | 92.52 | 92.60 | 25 |
Model | Precision (%) | Precision Change | Test_Time (ms) | Test_New/Old (%) | Train_Time (ms) | Traintest_New/Old (%) |
---|---|---|---|---|---|---|
RF | 90.61 | 0 | 8 | 100 | 1229 | 100 |
PCA + RF | 93.22 | +2.61 | 6 | 75 | 1340 | 109 |
Model | Precision (%) | Precision Change | Test_Time (ms) | Test_New/Old (%) | Train_Time (ms) | Traintest_New/Old (%) |
---|---|---|---|---|---|---|
SVM | 83.66 | 0 | 329 | 100 | 12,823 | 100 |
KNN | 91.46 | 0 | 1306 | 100 | 187 | 100 |
RF | 90.61 | 0 | 8 | 100 | 1229 | 100 |
PCA + SVM | 88.85 | +5.19 | 69 | 20.9 | 3861 | 30.1 |
PCA + KNN | 82.82 | −8.64 | 93 | 7 | 9 | 4.8 |
PCA + RF | 93.22 | +2.61 | 6 | 75 | 1340 | 109 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Yan, H.; Cai, S.; Li, E.; Liu, J.; Hu, Z.; Li, Q.; Wang, H. Study on the Influence of PCA Pre-Treatment on Pig Face Identification with Random Forest. Animals 2023, 13, 1555. https://doi.org/10.3390/ani13091555
Yan H, Cai S, Li E, Liu J, Hu Z, Li Q, Wang H. Study on the Influence of PCA Pre-Treatment on Pig Face Identification with Random Forest. Animals. 2023; 13(9):1555. https://doi.org/10.3390/ani13091555
Chicago/Turabian StyleYan, Hongwen, Songrui Cai, Erhao Li, Jianyu Liu, Zhiwei Hu, Qiangsheng Li, and Huiting Wang. 2023. "Study on the Influence of PCA Pre-Treatment on Pig Face Identification with Random Forest" Animals 13, no. 9: 1555. https://doi.org/10.3390/ani13091555