Project Overview
The Smart Agriculture Recommendation API is an AI-powered backend system designed to assist farmers and agricultural analysts in making data-driven agricultural decisions. The project integrates machine learning and deep learning models into a unified REST API that provides intelligent recommendations related to crop selection, fertilizer usage, crop yield estimation, and plant disease detection.
The system leverages multiple datasets and machine learning techniques to analyze soil nutrients, environmental conditions, and crop characteristics. Based on these inputs, the API predicts the most suitable crop, estimates potential agricultural yield, and recommends appropriate fertilizers. Additionally, the project includes a deep learning model capable of detecting plant diseases from leaf images.
The project was built with a modular backend architecture using FastAPI, allowing machine learning models to be exposed as scalable API endpoints. It demonstrates the practical integration of data science, computer vision, and backend engineering to build a real-world AI system for agricultural decision support.
Key Features
- Crop recommendation based on soil nutrients and environmental conditions
- Crop yield prediction using machine learning regression models
- Fertilizer recommendation based on soil nutrient composition
- Plant disease detection from leaf images using a convolutional neural network
- RESTful API architecture built with FastAPI
- Modular backend design with separate routes, services, and schemas
- Automatic API documentation using Swagger UI
- Machine learning models trained using Scikit-learn
Technical Approach
The project follows a modular machine learning pipeline where each agricultural task is implemented as an independent model integrated into a centralized API system. Structured datasets containing soil nutrients, rainfall, temperature, and crop information were used to train machine learning models for crop recommendation and yield prediction.
For tabular prediction tasks, traditional machine learning algorithms such as Random Forest and gradient boosting models were used due to their strong performance on structured agricultural datasets. These models were trained using Scikit-learn and optimized to predict crop suitability and agricultural yield based on environmental conditions.
For plant disease detection, a convolutional neural network was developed using PyTorch to classify plant diseases from leaf images. The model processes input images through multiple convolutional layers to extract visual patterns associated with plant diseases. The trained model achieved strong validation performance and was integrated into the API to provide real-time image-based disease detection.