Fruit and Vegetable Image Recognition Based on Multiple Tree Models: Applications of Random Forest, XGBoost and Decision Tree

Authors

  • Zihao Wang

DOI:

https://doi.org/10.61173/fvzhe382

Keywords:

Machine Learning Algorithms, Image Recognition, Ensemble Learning

Abstract

The primary objective of this study is to evaluate and compare the performance of three machine learning models— Random Forest, XGBoost, and Decision Tree—in the context of fruit and vegetable image classification. This research aims to identify which model best handles the challenges associated with imbalanced datasets and complex data structures. The ultimate goal is to contribute to the development of more efficient and accurate automated systems for agricultural applications, thereby improving productivity and reducing operational costs in the industry. This study utilized a dataset of 3,825 images covering 36 fruit and vegetable classes. Images were resized, normalized, and augmented to enhance diversity. Three models—Random Forest, XGBoost, and Decision Tree—were trained on this dataset. Performance was evaluated using accuracy, precision, recall, and F1-score to assess classification effectiveness and handling of class imbalances. The evaluation revealed that XGBoost outperformed Random Forest and Decision Tree in fruit and vegetable image classification, achieving the highest accuracy of 96.66%. XGBoost demonstrated superior handling of class imbalances and complex data structures, reflected in its precision and recall scores across various classes. Random Forest also performed well, closely following XGBoost, while Decision Tree exhibited more variability in results, indicating potential overfitting in certain classes. In conclusion, this study highlights the effectiveness of ensemble methods, particularly XGBoost, in agricultural image classification tasks. These findings suggest that XGBoost is a robust model for similar applications, offering improved accuracy and reliability

References

[1] Quinlan JR. Induction of decision trees. Machine learning. 1986 Mar;1:81-106.

[2] Breiman L. Random forests. Machine learning. 2001 Oct;45:5-32.

[3] Friedman JH. Greedy function approximation: a gradient boosting machine. Annals of statistics. 2001 Oct 1:1189-232.

[4] Chen T, Guestrin C. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining 2016 Aug 13 (pp. 785-794).

[5] Çakmak M. Classification of Apple Quality Using XGBoost Machine Learning Model. InKonya: 4th International Conference on Innovative Academic Studies 2024 Mar (pp. 607- 615).

[6] Rocha A, Hauagge DC, Wainer J, Goldenstein S. Automatic fruit and vegetable classification from images. Computers and Electronics in Agriculture. 2010 Jan 1;70(1):96-104.

[7] Yang M, Kumar P, Bhola J, Shabaz M. Development of image recognition software based on artificial intelligence algorithm for the efficient sorting of apple fruit. International Journal of System Assurance Engineering and Management. 2022 Mar;13(Suppl 1):322-30.

[8] Seth K. Fruits and Vegetables Image Recognition Dataset. Kaggle; 2020. Available from: https://www.kaggle.com/ kritikseth/fruit-and-vegetable-image-recognition.

[9] Ying X. An overview of overfitting and its solutions. In Journal of physics: Conference series 2019 Feb (Vol. 1168, p. 022022). IOP Publishing.

[10] Wang H, Lei Z, Zhang X, Zhou B, Peng J. Machine learning basics. Deep learning. 2016:98-164.

Downloads

Published

2024-10-29