Skip to content

Repository files navigation

🌱 Crop Recommendation System

A Machine Learning-based Crop Recommendation Web Application that recommends the most suitable crop based on soil and environmental conditions.

The system uses machine learning to analyze parameters such as Nitrogen, Phosphorus, Potassium, temperature, humidity, pH, and rainfall and recommends a suitable crop for cultivation.

🚀 Features

  • 🌱 Crop recommendation using Machine Learning
  • 🧪 Soil parameter analysis
  • 🌡️ Temperature-based recommendation
  • 💧 Humidity and rainfall analysis
  • ⚗️ Soil pH analysis
  • 📊 User-friendly web interface
  • 🤖 Pre-trained machine learning model
  • 🔤 Label encoding for crop classes
  • 🌐 Flask-based web application

🛠️ Technologies Used

Programming Language

  • Python

Machine Learning

  • Scikit-learn
  • Pandas
  • NumPy
  • Machine Learning Classification

Backend

  • Flask

Frontend

  • HTML
  • CSS
  • JavaScript

📁 Project Structure

Crop-Reccomendation-System/
│
├── app.py
├── train_model.py
│
├── crop_model.pkl
├── model.pkl
├── label_encoder.pkl
│
├── Crop_recommendation.csv
│
├── static/
│   ├── style.css
│   ├── script.js
│   └── images/
│
├── templates/
│   ├── index.html
│   ├── predict.html
│   └── about.html
│
└── .gitignore

⚙️ How It Works

  1. The user enters soil and environmental parameters.
  2. The application receives the input through the web interface.
  3. The input data is processed by the Flask backend.
  4. The trained machine learning model analyzes the parameters.
  5. The model predicts the most suitable crop.
  6. The recommended crop is displayed to the user.

🌾 Input Parameters

The system considers important agricultural parameters such as:

  • Nitrogen (N)
  • Phosphorus (P)
  • Potassium (K)
  • Temperature
  • Humidity
  • pH
  • Rainfall

🧠 Machine Learning Model

The trained machine learning model is stored in:

crop_model.pkl

Additional model files include:

model.pkl
label_encoder.pkl

The label encoder converts crop names into numerical labels during model training and prediction.

📊 Dataset

The project uses:

Crop_recommendation.csv

The dataset contains soil and environmental parameters along with the corresponding recommended crop.

💻 Installation

Clone the repository:

git clone https://github.com/nischithapoojary11-ctrl/Crop-Reccomendation-System.git

Navigate to the project directory:

cd Crop-Reccomendation-System

Install the required Python packages:

pip install flask pandas numpy scikit-learn

▶️ Run the Application

Start the Flask application:

python app.py

Open the local URL displayed in the terminal in your web browser.

🔄 Train the Model

To retrain the machine learning model using the dataset:

python train_model.py

This will generate/update the required model files.

🎯 Applications

  • Smart agriculture
  • Crop selection
  • Precision farming
  • Agricultural decision support
  • Soil-based crop recommendation
  • Machine learning education
  • Data science projects

🔮 Future Enhancements

  • Add real-time weather data
  • Add location-based crop recommendations
  • Add fertilizer recommendations
  • Add crop disease prediction
  • Add yield prediction
  • Add multilingual support
  • Deploy the application online
  • Add farmer login and personalized recommendations

👩‍💻 Author

Nischitha Poojary

Computer Science and Engineering Student

⭐ Project

If you find this project useful, consider giving the repository a ⭐ on GitHub.

About

Machine Learning based Crop Recommendation System using Python, Flask, and soil and environmental parameters to recommend suitable crops.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages