AI-Based Crop Recommendation System for Farmers Using Machine Learning and Full-Stack Web Technologies
Keywords:
Agricultural AI, Android, Crop recommendation, Flask, Machine learning, MySQL, Precision agriculture, Random forest, Smart farming, Soil analysisAbstract
This paper presents the design, development, and experimental evaluation of an AI-based crop recommendation system that enables farmers and agricultural users to receive accurate crop predictions based on soil nutrient composition and prevailing weather conditions. The system employs a Random Forest Classifier trained on a dataset of 2,200 records encompassing seven agronomic parameters: nitrogen (N), phosphorus (P), potassium (K), temperature, humidity, pH, and rainfall and achieves a test accuracy of 97.5%, a weighted F1-score of 0.977, and a 10-fold cross-validation accuracy of 97.2% (σ = 0.4%). The system architecture integrates a Python Flask web application, a MySQL relational database, a ReportLab-based PDF report generator, Matplotlib-based data visualization, and a multilingual Android application developed in Java. Recommendations are served through a REST API with a mean response time of 112 ms, with all 44 API test cases and 50 functional web tests passing after validation. The Android application successfully verified all 22 crop categories across English, Hindi, and Marathi language interfaces. Real-world validation in two Maharashtra districts produced crop recommendations consistent with regional agricultural practice. The system addresses the critical gap in affordable, intelligent, and accessible agricultural decision-support tools for rural Indian farmers.
References
R. Katarya, A. Raturi, A. Mehndiratta and A. Thapper, “Impact of machine learning techniques in precision agriculture,” 2020 3rd International Conference on Emerging Technologies in Computer Engineering: Machine Learning and Internet of Things (ICETCE), Jaipur, India, 2020, pp. 1–6.
M. Rahman, T. Chippy, V. Dankan Gowda, K. Prasad, H. S. Sethi and P. V. Prasanth, “Optimizing resource allocation in agriculture through IoT and AI,” 2023 7th International Conference on Electronics, Communication and Aerospace Technology (ICECA), Coimbatore, India, 2023, pp. 1573–1578.
S. Lokesh, A. Madhavan, R. P. Ramanathan and K. Anand, “Intelligent systems for data driven agriculture: Enhancing farmer productivity through automation and artificial intelligence,” 2024 International Conference on Smart Systems for Electrical, Electronics, Communication and Computer Engineering (ICSSEECC), Coimbatore, India, 2024, pp. 433–438.
K. J. Naidu et al., “Precision agriculture monitoring system,” Biosciences Biotechnology Research Asia, vol. 21, no. 4, pp. 1543–1551, Dec. 2024.
M. H. A. Afif, J. Iqbal, S. S. Borshon, R. I. Junayed and S. Ahamed, “An IoT-based smart farming solution for sustainable agriculture: integrating AI, cloud computing, and 4G communication for enhanced productivity,” IET Conference Proceedings, vol. 2024, no. 30, Feb. 2025.
M. Jagadeeswari, C. S. Manikandababu, K. S, P. R and M. S, “Artificial intelligence based crop recommendation system,” 2022 4th International Conference on Inventive Research in Computing Applications (ICIRCA), Coimbatore, India, 2022, pp. 1127–1133.
N. Bhatt and S. Varma, “An enhanced light GBM model with data analytical approach for crop recommendation,” 2023 Second International Conference on Electronics and Renewable Systems (ICEARS), Tuticorin, India, 2023, pp. 1538–1544.
N. Sneha, K. V. Sushma and S. S. Muzumdar, “Precision agriculture using data mining techniques and IoT,” 2019 1st International Conference on Advances in Information Technology (ICAIT), Chikmagalur, India, 2019, pp. 376–381.
R. Ganesh, “Crop recommendation using weather and soil content,” International Journal of Scientific Research in Engineering and Management, vol. 9, no. 5, pp. 1–9, May 2025.
S. Pudumalar, E. Ramanujam, R. H. Rajashree, C. Kavya, T. Kiruthika and J. Nisha, “Crop recommendation system for precision agriculture,” 2016 Eighth International Conference on Advanced Computing (ICoAC), Chennai, India, 2017, pp. 32–36.
B. Panigrahi, K. C. R. Kathala, and M. Sujatha, “A machine learning-based comparative approach to predict the crop yield using supervised learning with regression models,” Procedia Computer Science, vol. 218, pp. 2684–2693, 2023.
A. Mucherino, P. Papajorgji, and P. M. Pardalos, “A survey of data mining techniques applied to agriculture,” Operational Research, vol. 9, pp. 121–140, Jun. 2009.
Z. Doshi, S. Nadkarni, R. Agrawal and N. Shah, “AgroConsultant: Intelligent crop recommendation system using machine learning algorithms,” 2018 Fourth International Conference on Computing Communication Control and Automation (ICCUBEA), Pune, India, 2018, pp. 1–6.
L. Breiman, “Random forests,” Machine Learning, vol. 45, pp. 5–32, Oct. 2001.
K. G. Liakos, P. Busato, D. Moshou, S. Pearson, and D. Bochtis, “Machine learning in agriculture: A review,” Sensors, vol. 18, no. 8, Aug. 2018.