Implementation of Transfer Learning to Classify Pictures of Some Weeds
Subject Areas : Sustainable production technologiesIman Ahmadi 1 , Fateme Tavassoli 2
1 - Assistant professor, Department of Genetics and Plant Production Engineering, Institute of Agriculture, Water, Food and Nutraceuticals, Isf. C., Islamic Azad University, Isfahan, Iran.
2 - Msc of Applied Mathematics, University of Yazd, Yazd, Iran.
Keywords: Classification, EfficientNet Model, Test Accuracy, Transfer Learning, Weed,
Abstract :
Objective: Computer vision is a branch of artificial intelligence that deals with object recognition in images or image classification. In this article, transfer learning was used to classify weed images into eighteen categories. With the help of transfer learning models, image processing using deep learning algorithms can be implemented on computers with standard hardware capabilities. The trade-off is reduced model accuracy compared to using deep learning from scratch.
Material and methods: First, images from each of the eighteen weed categories were collected. These were split into a training set (695 images) and a test set (260 images). The training dataset was then augmented using computer-based image enhancement, increasing its size tenfold to 6,950 images. These images served as the raw input data for building the computer vision model. Image preprocessing was carried out using functions available in the PyTorch library. Then, a transfer learning model was developed using the training images and evaluated using the test images. The main evaluation metric in this study was the confusion matrix, through which other metrics—sensitivity, specificity, precision, F1-score, and accuracy—were calculated and presented.
Results: According to the results, the values of sensitivity, specificity, precision, F1-score, and accuracy were 84%, 99%, 83%, 84%, and 84%, respectively.
Conclusion: These results indicate that the classifier performed acceptably well despite being trained without a GPU-equipped computer.
Chen, J., Zhang, D., Sun, Y., & Nanehkaran, Y. A. (2020). Using deep transfer learning for image-based plant disease identification. Computers and Electronics in Agriculture, 173, 105393. Available from https://doi.org/10.1016/j. compag.2020.105393.
Gopalakrishnan, K., Sivaraj, R., & Vijayakumar, M. (2025). Automated weed and crop recognition and classification model using deep transfer learning with optimization algorithm. Scientific Reports, 15, Article 15275. https://www.nature.com/articles/s41598-025-15275-3
Hasan, A. S. M. M., Laga, H., Jones, M. G. K., & Sohel, F. (2022). Weed recognition using deep learning techniques on class-imbalanced imagery. Crop and Pasture Science, 74(6), 628–644. https://www.publish.csiro.au/CP/pdf/CP21626
Huang, Z., Su, L., Wu, J., Chen, Y. (2023). Rock Image Classification Based on EfficientNet and Triplet Attention Mechanism. Appl. Sci. 2023, 13, 3180. https://doi.org/10.3390/app13053180
Li, X., & Chen, Z. (2025). Research on weed identification based on deep learning. Proceedings of the 2025 ACM International Conference on Artificial Intelligence and Agriculture, 3728820. https://dl.acm.org/doi/epdf/10.1145/3728725.3728820
Ouhami, M., Es-Saady, Y., Hajji, M. E., Hafiane, A., Canals, R., & Yassa, M. E. (2020). Deep transfer learning models for tomato disease detection. In: ICISP 2020. LNCS (Vol. 12119, pp. 65_73).
Pai, D. G., Kamat, R., & Balachandra, M. (2024). Deep learning techniques for weed detection in agricultural environments: A comprehensive review. IEEE Access, 12, 113193–113214. https://doi.org/10.1109/ACCESS.2024.3418454
Thenmozhi, K., & Srinivasulu Reddy, U. (2019). Crop pest classification based on deep convolutional neural network and transfer learning. Computers and Electronics in Agriculture, 164, 104906. Available from https://doi.org/10.1016/j. compag.2019.104906.
Vidyarthi, S. K., Singh, S. K., Xiao, H. W., & Tiwari, R. (2021). Deep learnt grading of almond kernels. Journal of Food Process Engineering, 44(4), p.e13662.