A Complete ML/DL Project

Artimule
4 min readAug 4, 2022

--

Create and deploy the Recommendation web app in python

In this article, I will be covering the following topics:

  • In India, the majority of the population is dependent on agriculture for their livelihood. Many new technologies, such as Machine Learning and Deep Learning, are being implemented into agriculture so that it is easier for farmers to grow and maximize their yield.
  • This project presents the idea that how we can use ML/DL in precision farming if developed at a large scale and with authentic and verified data.
  • Resources to learn model deployment

In this project, I present a website in which the following applications are implemented; Crop recommendation, Fertilizer recommendation, and Plant disease prediction, respectively.

  • In the crop recommendation application, the user can provide the soil data from their side and the application will predict which crop should the user grow.
  • For the fertilizer recommendation application, the user can input the soil data and the type of crop they are growing, and the application will predict what the soil lacks or has an excess of and will recommend improvements.
  • For the last application, which is the plant disease prediction application, the user can input an image of a diseased plant leaf, and the application will predict what disease it is and will also give a little background about the disease and suggestions to cure it.

DATA SOURCE 📊

How to use 💻

  • Crop Recommendation system => enter the corresponding nutrient values of your soil, state, and city. Note that, the N-P-K (Nitrogen-Phosphorous-Pottasium) values to be entered should be the ratio between them. Refer to this website for more information. Note: When you enter the city name, make sure to enter mostly common city names. Remote cities/towns may not be available in the Weather API from where humidity and temperature data are fetched.
  • Fertilizer suggestion system => Enter the nutrient contents of your soil and the crop you want to grow. The algorithm will tell which nutrient the soil has an excess of or lacks. Accordingly, it will give suggestions for buying fertilizers.
  • Disease Detection System ==> Upload an image of the leaf of your plant. The algorithm will tell the crop type and whether it is diseased or healthy. If it is diseased, it will tell you the cause of the disease and suggest how to prevent/cure the disease accordingly. Note that, for now, it only supports the following crops

Supported crops

  • Apple
  • Blueberry
  • Cherry
  • Corn
  • Grape
  • Pepper
  • Orange
  • Peach
  • Potato
  • Soybean
  • Strawberry
  • Tomato
  • Squash
  • Raspberry

DEMO:

We use Random Forest Algorithm to predict Good Accuracy.

Random forest handles both classification and regression problems. It is based on the concept of ensemble learning, which is a process of combining multiple classifiers to solve a complex problem and improve the performance of the model.

  • It takes less training time as compared to other algorithms.
  • It predicts output with high accuracy, even for a large dataset it runs efficiently.
  • It can also maintain accuracy when a large proportion of data is missing.

A classification report is a performance evaluation metric in machine learning. It is used to show the precision, recall, F1 Score, and support of your trained classification model.

Precision: Precision is defined as the ratio of true positives to the sum of true and false positives.

Recall: Recall is defined as the ratio of true positives to the sum of true positives and false negatives.

F1-score: The F1 is the weighted harmonic mean of precision and recall. The closer the value of the F1 score is to 1.0, the better the expected performance of the model is.

Support: Support is the number of actual occurrences of the class in the dataset. It doesn’t vary between models, it just diagnoses the performance evaluation process.

Source Code available here.

CONCLUSION & FUTURE WORK:

The core strategy of this project is to predict the crop based on the soil nutrient content and the location where the crop is growing. This system will help the farmers to choose the right crop for their land and to give the suitable amount of fertilizer to produce the maximum yield. The Random Forest algorithm helps to predict the crop precisely based on the pre-processed crop data. This system will also help the newcomers to choose the crop which will grow in their area and produce them a good profit. A decent amount of profit will attract more people to agriculture. The system uses supervised Machine learning algorithms like Logistic Regression, Support Vector Machine, and Random Forest Classifier and gives the best result based on error analysis. The results of these algorithms will be compared and the best among them i.e., Random Forest Classifier which gives the best and most accurate output is chosen. Therefore, We observed that the most accurate accuracy is from Random Forest Algorithm so we implement prediction using Random Forest Approach this system will help reduce the struggle faced by the farmers. Analysis of the important soil properties and based on that we are dealing with the Grading of the Soil and Prediction of Crops suitable to the land. This will act as a simple solution to equip the farmers with the necessary information required to obtain great yield and therefore maximize their surplus and therefore will reduce their difficulties.

--

--