
Smart Agriculture with AI for Crop Recommendation using Weather and Soil Content
Smart Agriculture with AI for Crop Recommendation using Weather and Soil Content
IEEE BASE PAPER TITLE:
A Federated Explainable AI Framework for Smart Agriculture: Enhancing Transparency, Efficiency, and Sustainability
IEEE BASE PAPER ABSTRACT:
This paper presents a comprehensive framework for integrating Explainable Artificial Intelligence (XAI) into smart agriculture to address challenges in transparency, interpretability, and trust associated with AI-driven decision-making. Leveraging techniques such as SHAP, LIME, and Grad-CAM, the framework provides actionable insights into predictive maintenance, crop health monitoring, and resource optimization. A hybrid methodology combines IoT-based data acquisition, Federated Learning (FL), and multimodal feature analysis to ensure scalability and privacy preservation. Additionally, the study introduces a multi-context agricultural dataset and a novel interpretability-accuracy metric to evaluate XAI models’ adaptability across diverse agricultural settings. Experimental results demonstrate the proposed framework’s superiority in achieving an optimal balance between accuracy and interpretability, resource efficiency, and robust decision-making in precision agriculture. This approach fosters sustainable practices while addressing ethical and practical challenges in democratizing AI in agriculture.
PROJECT OUTPUT VIDEO:
ALGORITHM / MODEL USED:
MobileNetV2 Architecture, Ensemble Model (Voting Classifier).
OUR PROPOSED PROJECT ABSTRACT:
Smart agriculture leverages artificial intelligence to enhance decision-making in farming by integrating data-driven insights with environmental and soil conditions. With increasing challenges such as climate variability, soil degradation, and the need for sustainable food production, intelligent systems that assist farmers in selecting suitable crops have become essential. Accurate soil assessment and scientifically guided crop recommendations can significantly improve yield quality, optimize resource utilization, and reduce economic risks faced by farmers.
This project addresses the need for a unified, intelligent agricultural support system by proposing “Smart Agriculture with AI for Crop Recommendation using Weather and Soil Content.” The system is developed using Python for backend processing, HTML, CSS, and JavaScript for the user interface, and Flask as the web framework to integrate machine learning models with a web-based platform. The objective is to provide reliable crop suggestions by analyzing soil characteristics and key environmental parameters through two complementary operational modes.
The first mode, Soil Analysis, focuses on image-based soil classification. Users upload a soil image, which is processed using a deep learning model based on the MobileNetV2 architecture. The model is trained on a dataset of 1,222 soil images covering four soil types: Alluvial soil, Black soil, Clay soil, and Red soil. The trained model achieves a training accuracy of 97.34% and a validation accuracy of 99.21%. Based on the predicted soil type, the system recommends crops that are most suitable for cultivation in that soil, assisting farmers in making informed decisions at the preliminary stage of farming.
The second mode, Crop Recommendation, is data-driven and parameter-based. Users input essential agricultural and environmental features, including Nitrogen (N), Phosphorus (P), Potassium (P), Temperature (°C), Humidity (%), pH level, and Rainfall (mm). The system utilizes a dataset containing 2,200 records with 22 different crop types such as rice, maize, pulses, fruits, fiber crops, and commercial crops. An ensemble learning approach using a Voting Classifier is employed, combining Random Forest Classifier, Logistic Regression, and Gradient Boosting Classifier to enhance prediction robustness. This ensemble model achieves a training accuracy of 98.00% and a testing accuracy of 98.00%, demonstrating high reliability in predicting the optimal crop for given conditions.
To ensure transparency and model evaluation, the system presents performance analysis metrics including accuracy, precision, recall, F1-score, confusion matrix, and static visualization graphs. Overall, the proposed system provides a comprehensive AI-based solution for smart agriculture by integrating soil image analysis and environmental parameter-based crop recommendation, thereby supporting sustainable and efficient farming practices.
SYSTEM REQUIREMENTS:
HARDWARE REQUIREMENTS:
- System : Pentium i3 Processor.
- Hard Disk : 20 GB.
- Monitor : 15’’ LED.
- Input Devices : Keyboard, Mouse.
- Ram : 8 GB.
SOFTWARE REQUIREMENTS:
- Operating System : Windows 10 / 11.
- Coding Language : Python 3.11.6.
- Web Framework : Flask.
- Frontend : HTML, CSS, JavaScript.
REFERENCE:
HASSAM AHMED TAHIR, WALAA ALAYED, WAQAR UL HASSAN, “A Federated Explainable AI Framework for Smart Agriculture: Enhancing Transparency, Efficiency, and Sustainability”, IEEE Access, Volume: 13, 2025.
👉CLICK HERE TO BUY THIS PROJECT “Smart Agriculture with AI for Crop Recommendation using Weather and Soil Content” SOURCE CODE👈
Frequently Asked Questions (FAQ’s) and Answers
The purpose of this project is to assist farmers and agricultural stakeholders in selecting suitable crops by analyzing soil characteristics and environmental conditions using artificial intelligence. The system provides intelligent crop recommendations through soil image analysis and parameter-based prediction.
The project is developed using Python for backend and machine learning implementation, HTML, CSS, and JavaScript for the frontend, and Flask as the web framework. Machine learning and deep learning models are implemented using libraries such as Scikit-learn and TensorFlow/Keras.
In the soil analysis module, users upload an image of the soil. The system processes the image using a deep learning model based on the MobileNetV2 architecture, which classifies the soil into predefined soil types. Based on the predicted soil type, suitable crops are displayed.
The system currently supports four soil types: Alluvial soil, Black soil, Clay soil, and Red soil. Each soil type is mapped to crops that are commonly suitable for cultivation in that soil.
The crop recommendation module requires users to enter soil nutrient values and environmental parameters such as Nitrogen (N), Phosphorus (P), Potassium (K), temperature, humidity, pH level, and rainfall. These inputs are analyzed using an ensemble-based machine learning model to predict the most suitable crop.
The system is trained to recommend 22 different crop types, including cereals, pulses, fruits, fiber crops, and commercial crops such as rice, maize, cotton, banana, coffee, and others.
For soil classification, the system uses the MobileNetV2 deep learning architecture. For crop recommendation, an ensemble Voting Classifier is used, which combines Random Forest Classifier, Logistic Regression, and Gradient Boosting Classifier.
Yes, the system achieves high accuracy in both modules. The soil analysis model achieves high training and validation accuracy, while the crop recommendation model achieves strong training and testing accuracy, ensuring reliable predictions.
Yes, the system is designed with a user-friendly web interface that allows farmers to upload soil images or enter parameters easily. No technical or programming knowledge is required to use the application.
Yes, the project is suitable for academic learning, research, and real-world agricultural applications. It demonstrates practical implementation of AI and machine learning techniques in smart agriculture.
The system does not store any personal user data. Input values and images are used only for prediction purposes, ensuring data privacy and ethical usage.
The system provides data-driven, objective crop recommendations based on soil and environmental conditions, reducing guesswork and reliance on manual experience. This supports informed decision-making in agriculture.
Farmers, agricultural students, researchers, agronomists, and institutions involved in smart farming and precision agriculture can benefit from this project. 1. What is the purpose of this project?
2. What technologies are used in this project?
3. How does the soil analysis module work?
4. What soil types are supported in the system?
5. How does the crop recommendation module function?
6. How many crop types can the system recommend?
7. What machine learning models are used for prediction?
8. Is the system accurate and reliable?
9. Can this system be used by farmers without technical knowledge?
10. Is the project suitable for academic and real-world use?
11. Does the system store user data?
12. What are the benefits of using this system compared to traditional methods?
13. Who can benefit from this project?



