File size: 4,157 Bytes
5b80137
8ec049e
 
 
 
 
 
 
 
 
 
5b80137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153

---
title: "Crop Recommendation System"
emoji: 🌾
colorFrom: green
colorTo: yellow
sdk: docker
app_file: app.py
pinned: false
license: mit
---
# 🌾 Smart Farming: Crop Recommendation System for Popular Indian Crops

> πŸ”¬ A Machine Learning-based Web Application to Recommend Suitable Crops Based on Environmental Conditions  
> πŸ‘¨β€πŸŒΎ Built by [Saksham Pathak](https://github.com/parthmax2) | IIIT Lucknow | 94.3% Accuracy | Deployed using Flask

---

## πŸ“Œ Overview

**Smart Farming** is a crop recommendation system that leverages machine learning to assist Indian farmers in selecting the most suitable crop for cultivation based on key environmental parameters. The system uses a **Random Forest Classifier** trained on soil and climatic data to suggest the best crop from a set of **22 popular Indian crops**.

🌱 This project empowers sustainable agriculture, efficient resource utilization, and smarter farming decisions through AI.

---

## 🧠 Key Features

- βœ… **ML-Powered Predictions** (94.3% Accuracy)
- πŸ§ͺ Inputs: Nitrogen, Phosphorus, Potassium, Temperature, Humidity, pH, Rainfall
- 🌾 Outputs: Rice, Maize, Banana, Cotton, Sugarcane, etc.
- πŸ“Š Model Used: **Random Forest Classifier**
- 🌐 **Flask-based Web App** with real-time crop suggestions
- 🎨 Clean and responsive UI (HTML + CSS + JS)

---

## πŸš€ Live Demo

[![Watch Demo](https://img.shields.io/badge/Click%20Here-Live%20App-green?style=for-the-badge&logo=github)](https://your-deployment-link.com)  
*πŸ”’ Link coming soon or hosted locally*

---

## πŸ–₯️ Tech Stack

| Component     | Technology                |
|---------------|---------------------------|
| πŸ‘¨β€πŸ’» Language      | Python, HTML, CSS, JS       |
| πŸ” ML Model     | Random Forest Classifier |
| βš™οΈ Backend      | Flask (Python)           |
| πŸ–Ό Frontend     | HTML + CSS + JavaScript  |
| πŸ“¦ Deployment   | Pickle Model Serialization |

---

## πŸ“‚ Project Structure

```

πŸ“ crop-recommendation
β”œβ”€β”€ πŸ“ static/
β”‚   └── images
β”œβ”€β”€ πŸ“ templates/
β”‚   └── index.html
β”œβ”€β”€ πŸ“„ app.py             # Flask backend
β”œβ”€β”€ πŸ“„ crop\minmaxscaler.pkl,standscaler.pkl    # Trained ML model
β”œβ”€β”€ πŸ“„ requirements.txt
β”œβ”€β”€ πŸ“„ Dockerfile
└── πŸ“„ README.md
````

---

## πŸ“Š Model Performance

| Model             | Accuracy | Precision | Recall | F1-Score |
|------------------|----------|-----------|--------|----------|
| 🌟 Random Forest     | 94.3%    | 92.7%     | 91.5%  | 92.1%    |
| Gradient Boosting | 92.1%    | 90.5%     | 89.3%  | 89.9%    |
| XGBoost           | 91.4%    | 88.9%     | 87.5%  | 88.2%    |
| SVM               | 85.7%    | 83.2%     | 81.6%  | 82.4%    |

πŸ“Œ **Key Factors Influencing Prediction:**
- Rainfall
- Soil pH
- Temperature
- NPK (Nitrogen, Phosphorus, Potassium)

---

## πŸ“₯ How to Run Locally

### 1️⃣ Clone the Repository
```bash
git clone https://github.com/parthmax2/crop-recommendation-system.git
cd crop-recommendation-system
````

### 2️⃣ Install Dependencies

```bash
pip install -r requirements.txt
```

### 3️⃣ Run the Flask App

```bash
python app.py
```

### 4️⃣ Open in Browser

Visit `http://localhost:5000/` to use the web app.

---

## πŸ“ˆ Future Enhancements

* [ ] 🌀 Real-time Weather API Integration
* [ ] πŸ“‘ IoT-based Soil Sensor Integration
* [ ] πŸ› Pest & Disease Prediction Module
* [ ] 🌍 Satellite/GIS data for advanced insights
* [ ] 🌐 Multilingual and Offline Support

---

## ✍️ Author

**Saksham Pathak**
M.Sc. AI & ML, IIIT Lucknow
πŸ”— [GitHub](https://github.com/parthmax2) | [LinkedIn](https://linkedin.com/in/sakshampathak)

---

## πŸ“„ License

This project is licensed under the **MIT License** – see the [LICENSE](LICENSE) file for details.

---

## πŸ“š References

* [IEEE Paper 1](https://ieeexplore.ieee.org/document/10575152)
* [Crop Dataset - Kaggle](https://www.kaggle.com/datasets/atharvaingle/crop-recommendation-dataset)
* Full list of academic references is included in the `paper.pdf`.

---

> 🌱 *"Empowering farmers through AI-driven decisions for a greener tomorrow."*

```