top of page

UNDERGRADUATE DEGREE PROJECT

Outreach Farming

Design and implementation of a crop yield prediction system

The Project

Designing and developing a system employing data analysis to predict crop yield in central India

My Role

Literature review, research, diagramming, Interface design

Scope

Analysing patterns to suggest ideal crops depending on certain parameters.
Finding alternative uses for the damaged crops.

Collaborators

With three peers as teammates, this project was carried out under the guidance of a faculty mentor

Skills applied

  • Literature review

  • Research

  • Use Cases, Class diagrams, State diagrams

  • Data Analysis

  • Python

  • Software design

  • User Interface design

Tools used

  • Python

  • Pandas

  • HTML/CSS

BACKGROUND

​India is primarily an agricultural country. Farming and related occupations provide employment to almost half the population. Yet there are few technological advancements in this field. Effects of climate change and global warming have disrupted natural yield patterns. By utilising the vast potential of data science and machine learning techniques, it is possible to analyse weather patterns in order to help in predicting which crops are most suited to the expected conditions. Changing composition of soil and varying needs of fertiliser can be studied to find more suitable alternatives. Better knowledge of how to adapt to changing weather patterns braces farmers against any irregularities and reduces the losses incurred by them, thus enabling them to have a better quality of life.

There is a dire need for a tool that provides assistance to farmers in event of unprecedented disruption of the traditional cropping patterns.

PROBLEM STATEMENT

Due to climate change and unseasonal rainfall, crops are lost.

How might we employ data science in order to devise a system that minimises crop loss, suggests alternative farming techniques and ultimately improve farmers' livelihood?

Flow of the project

  • Obtaining the data set

  • Transforming the data using MinMax()

    •  We use the MinMax() function because the values in the dataset are varied. The value for the rainfall parameter is in the range (0,2) whereas the range for Yield is (0,1000000).

  • as the data is varied, it becomes difficult to plot the data in scatter plot and parallel plot, hence we transform the data. 
  • The third step is applying the Kmeans algorithm to the transformed data.

    • By using the K Means algorithm we obtain the centroid values for n no of clusters. These centroids obtained will be the centroid for each cluster. 

  • The next step is applying Euclidean distance to all the values in the dataset and the centroids so that we can find out which cluster it belongs to.

  • After this step, we get the data segregated into the N number of clusters. 

  • After segregating the data we plot the data into a scatter plot, each cluster having a particular colour. 

  • The last step is the analysis of data.

 

A parallel plot enables us to see what weather conditions are optimal for getting a good yield for a certain crop, depending on its location.

STATE DIAGRAM

Classes used

The class diagram, shown in the figure gives an idea of the system’s internal processing. The classes used are: 

​

● MinMax(): The MinMax function is used to transform features by scaling each feature to a given range. This estimator scales and translates each feature individually such that it is in the given range on the training set, e.g. between zero and one. 

​

● Database: The database contains datasets for three crops: Wheat, Rice and mustard seeds and three states: Chattisgarh, Madhya Pradesh and Orissa. 

​

● K-Means: Centroids are obtained using the K-means algorithm. These will be the centroids for each cluster. 

​

● Euclidean distance: Euclidean distance is applied to all the values in the dataset and the centroids in order to find out which cluster it belongs to. After this step, data is segregated into N clusters

​

● Parameters: Temperature, rainfall, humidity

​

● Yield: Prediction of crop yield in advance can help the farmers to plan for storage, selling, fixing minimum support price, importing /exporting etc. Comparing yields of the different crops available to sow during a particular sowing season, along with other factors, a farmer can make an informed decision about which crop to choose. 

CLASS DIAGRAM

LITERATURE REVIEW - KEY POINTS

Problems in the Indian agriculture sector 
  • Poorly maintained irrigation systems 

  • Lack of technology 

  • Droughts 

  • Poverty 

21 per cent of India’s population and 48 per cent of children are undernourished.

Intensive cultivation, in some cases, has resulted in a buildup of pests and diseases, salinity, waterlogging.

Prediction of crop yield in advance can help the farmers and Government bodies.

To plan for storage, selling, fixing minimum support price, importing /exporting.

Yield prediction needs different kinds of data gathered from different sources.

Meteorological data, agri- meteorological, soil data, remotely sensed data, agricultural statistics 

Data Mining methods can be used to tackle these problems.

 K-means clustering, K-nearest neighbor, Artificial Neural Networks(ANN), Support Vector Machines (SVM) and biclustering

The Weighted K-means clustering algorithm is an effective way to predict crop yield.

It has better accuracy, operational efficiency, significantly higher than the un-weighted clustering algorithm.

CHOOSING PARAMETERS FOR CROP YIELD ANALYSIS

Parameter
Description

Rainfall

  • Since India has a tropical climate, agriculture greatly depends on rainfall.

  • Temperatures are very uniform both over place and time, but rainfall varies greatly

  • Kharif crops are largely dependent on seasonal rainfall. (e.g. - rice)

  • The relationship between rainfall and rice production is positive in all the agro-climatic zones, highly significant in low rainfall areas. 

  • Lack of sufficient rainfall is the main limiting factor in agriculture.

Humidity

  • Humidity is dependent on temperature, and to a lesser extent, pressure. 

  • Vapour pressure deficit is the difference between the vapour pressure inside the leaf compared to that of the air.

  • High temperatures, normal humidity result in more stoma opening, letting in more CO(2) for active photosynthesis.

  • Dry air causes wilting of plants since stoma close, reducing photosynthetic activity

  • If the humidity is too high, the yield quantity will be low

  • If the humidity is too low, the quality of yield will be low.

Temperature

  • Rabi(Winter) crops are irrigated and sensitive to changes in temperature. 

  • Kharif (Summer) crops depend on rainfall.

  • The magnitude of rising seasonal average temperatures is more during winter.

  •  57.2% of the total area under paddy cultivation was influenced by rising minimum temperature.

  •  Kharif paddy yield declined by 411-859 kgs per hectare per degree rise in minimum temperature.

ANALYSIS AND DESIGN

Use Cases

  • Farmer: The concerned user, who will make use of the website to look for alternate crops. 2. Outreach Farming Database: Database containing data about 3 crops- wheat, rice and mustard seeds. 

  • Helpdesk: The official who will operate the website in case the farmer is not able to use it himself. 

  • Problem Faced: Can include low productivity, low yield of a crop, crops destroyed due to unfavourable weather conditions etc. 

  • Constraints: It includes the parameters taken into consideration, which are location, yield, rainfall, temperature and humidity. 

  • Possible Solutions: An alternate crop may provide a better yield for the farmer. 

USE CASE DIAGRAM

IMPLEMENTATION

Back-end

  • The backend system consists of 3 parts: collecting, cleaning and processing of data, data preprocessing and data analysis.

  • Data was collected from government websites, Kaggle and google datasets.

DATA CLEANING

STEP 1: Importing Libraries In Python 

STEP 2: Loading And Reading the Data Set 

STEP 3: Checking For Missing Values 

STEP 4: Removing Missing Value 

DATA PREPROCESSING 

STEP 1: Importing Libraries In Python 

STEP 2: Loading And Reading the Data Set 

STEP 3: Selecting the features required 

STEP 4: Transform the data (using MinMax() function)

DATA ANALYSIS

STEP 1: Clustering

STEP 2: Classification

STEP 3: Regression

STEP 4: Parallel Plot

User Flow

  • The website accepts input parameters namely - city, state and crop.

  • Based on these, the system suggests the most suitable crop to be grown, based on yield.

WEBSITE

Website Design

RESULTS 

Mustard yield in Orissa

Predicting the yield of mustard throughout Orissa, based on the temperature. 

Rice yield in Madhya Pradhesh

Predicting the yield of rice in various regions of Madhya Pradesh, based on rainfall data.

Mustard yield in Madhya Pradesh

Predicting the yield of mustard in Madhya Pradesh using k-means clustering, based on the humidity of the state. 

CONCLUSION

This project serves as a solution to farmers undergoing heavy losses due to the vagaries of weather and global warming. The analysis performed through various algorithms such as K- means results in an appropriate solution pertaining to the crop to be grown or other measures to be taken in order to increase the yield. Although still a work in progress, this project has the potential to ultimately mitigate the severity of the farmer suicide issue in India.

bottom of page