You are on page 1of 7

Volume 4, Issue 10, October – 2019 International Journal of Innovative Science and Research Technology

ISSN No:-2456-2165

Agro-Genius: Crop Prediction using Machine Learning


Thayakaran Selvanayagam1, Suganya S2, Puvipavan Palendrarajah3
Mithun Paresith Manogarathash4, Anjalie Gamage5, Dharshana Kasthurirathna6
Faculty of Computing, Sri Lanka Institute of Information Technology (SLIIT)
Malabe, Sri Lanka.

Abstract:- This paper present a way to aid farmers crops. Also, the main issue that small farmers are currently
focusing on profitable vegetable cultivation in Sri Lanka. facing is that, they sow the crops according to their own
As agriculture creates an economic future for developing experiences. But when they are cultivating and bringing them
countries, the demand of modern technologies in this to market, they face difficulties to market their product at a
sector is higher. Key technologies used for this problem reasonable price. It is because of large farms cultivating the
are Deep Learning, Machine Learning and Visualization. same. As our country is small, products are distributed all
As the product, an android mobile application is over the country in between Districts (Dambulla to Jaffna,
developed. In this application the users should input their Dambulla to Petra, etc.). Because of this, small-scale rural
location to start the prediction process. Data farmers affected economically.
preprocessing is started when the location is received to
the system. The collected dataset divided into 3 parts. 80 Nowadays weather condition is not like previous
percent for training, 10 percent for testing and 10 percent decades. Day by day it is changing because of the
for validation. After that the model is created using LSTM globalization, so farmers have faced difficulties to predict
RNN for vegetable prediction and ARIMA for price weather conditions. They may be some natural disaster which
prediction. Finally, for given location profitable crop and can also affects cultivation in a sudden. Without the weather,
predicted future price of vegetables are shown in the there are some major factors such as seasonal crop details,
application. Other than the prediction, optimizing for crop combination and suitable crop for given location which
multiple crop sowing according to the user requirements they must have knowledge of these things were gained from
and visualizing cultivation and production data on map their past experience so without experience they can’t get
and graphs are also given in the application. This paper expected revenue. By considering these factors Agro-Genius
elaborates the procedure of model development, model system is recommended as a solution, hope that it will be very
training and model testing. helpful for farmers to get expected revenue from their
cultivation.
Keywords:- Machine Learning, Android Application, Data
preprocessing, LSTM, RNN, ARIMA, Linear Programming, The main research problem is to help small medium
Visualization, Polygons. farmers to increase revenue from their cultivation without
getting affected by industrial level farmers and to reduce
I. INTRODUCTION surplus marketing. Hitherto in our country there are no
implemented techniques in usage, but agriculture department
A substantial percentage of the inhabitants of the keeps so many raw data and using few in their website for
country depend on the agriculture. The technological public access, but it is not helpful to farmers. They cultivate
advancement in agriculture plays an important role in every according to their experience. When it’s come to market,
farmer’s life to earn good profit. But nowadays percentage of industry level farmers sell their product in a wholesale to all
total GDP has been dropping. In 2005 the agriculture GDP over the country at the same time rural farmers also bring
share was 17.2% but in 2012 it has dropped to 11.1% and their product, but they can’t sell with a reasonable price. In
now it is even low [1]. Approximately 80% of the farmers are this situation industry level farmers have no huge loss, but
from rural areas so if crop production revenue goes down thus rural farmers loss their profits and even capital.
affect their lifestyle because of the industry level farms.
The principal scope of this research is; delivering a
Apparently, Farmers’ experience on the agriculture field mobile application where all type of processing is done in the
involves in the crop prediction. Farmers who were in the cloud-based system through the API calls. Which will be
rustic areas are cultivating according to their personal much helpful for the farmers and industries to select most
experience and knowledge due to absence of reliable and profitable crop and its expected price during harvesting time.
timely information. Since the modernization occupying the Further user can view the currently cultivated crop details in
agriculture field rapidly by the introduction of superior seeds locations around the country on a map and user is able to
and different varieties and large number of crops which were optimize for profitable multiple crops for a specific land. The
cultivated by agricultural industries, the farmers are forced to following data are collected from the relevant departments
adapt to this hasty change by cultivating more and more and from other third-party services.

IJISRT19OCT1880 www.ijisrt.com 243


Volume 4, Issue 10, October – 2019 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165
 Recommended crops details (location wise) Leisa et al… have proposed Agriculture decision support
 Recommended crop harvesting duration. framework for visualization and prediction of western
 Past cultivation and production of vegetables. Australian crop production system which will output
 Currently cultivated crop which are updated biweekly. visualizations of seasonal patterns of rainfall for individual
 Weather forecast data. district and show the effect of various scenarios. This system
 Combination of crops which will give more yield. consists six major components which are data input, data
 Past market prices for each crop. mining, database, statistical analysis, prediction and
visualization. Data input was done by Graphical User
For the above-mentioned problem, Agro-Genius provide Interface (GUI). Data visualization done by two methods
a solution using above listed past data. As it has more than 10 which are general trends and spatial interpolation. Data
years of data it is not possible for human to predict from those mining was done by the use of association rules which uses
huge amounts of data. So, to overcome this challenge Apriori algorithms. [6]
Machine Learning would be more suitable technology now.
In the above listed data, main data like past cultivation and There is lack of implemented systems used in other
production of vegetables, weather data and past market price countries like United State. One is Field Check app which
report are timeseries data. To handle timeseries prediction visualizes currently cultivated crop details in map, but it is
some Machine Learning and Deep Learning algorithms are visualizing some selected crops only [7]. Another one is
selected and explained in Methodology section below. Descartes Crop app which is forecasting crop yield for
selected area in United States [8]. More over DEKALB is
The research reduce problems of rural farmers and it used to optimize multiple crop combination for small farms.
suggest solution for more profitable cultivation. It helps Other than this implemented application Sri Lankan [9] and
farmers to take decisions when starting vegetable farms. Taiwan [10] agriculture departments maintain some raw data,
which are suitable crop for each land areas, past production
II. RELATED WORK for districts and historical price data. These help farmers, even
though there are no prediction technology. Farmers have to go
In past years several systems have been proposed to through the data one by one to make any decision.
implement crop prediction using machine learning techniques
in several countries. Different Machine Learning algorithms In above mentioned proposed and implemented systems,
were used for prediction. Multiple Leaner Regression (MLR) they have not considered all the factors which are affecting
has been applied to predict on past data like year, area of farmers in the real world. If they consider main factors, then it
sowing, rainfall, and yield and Data Mining methodology will be more accurate. According to our country many factors
(Density – based clustering technique) is used to analyze and affect farmers profit like weather, past cultivation and
verify the result which was obtained from MLR [2]. On the production details, market price etc. but there is no
other hand, for future forecasting was done by analyzing past implemented system to guide Sri Lankan famers, so they
historical price data, climate, location of market and planting failed to select profitable crop during seasons. In this system
area. Prediction was done for 15 market price data and 100 most of the features needed to solve the current problems are
different crops using different algorithms like ARIMA, included and help farmers to select profitable crops. The
Artificial Neural Network (ANN), Response Surface application will provide predicted results such as most
Methodology (RSM) and calculate its Mean Absolute profitable crop and it’s expected price according to the
Percentage Error (MAPE). According to the lowest error location and harvesting time. Also, users can view the
percentage, many have selected ANN and PLS as prediction cultivation details visualized in map as it will be more
algorithms [3]. effective than statistical data.

Arun Kumar et al… have proposed system to predict III. METHODOLOGY


yield of the crop by analyzing past soil dataset, rainfall
dataset, yield datasets. Prediction was done using K-Nearest This proposed system contains four main components
Neighbor and Support Vector Machine algorithm and Least such as crop prediction, price prediction, visualization and
Squares algorithms [4]. Askunuri Manjula et al… has done optimization. Each component uses different Machine
crop prediction using weather forecasting, pesticides and Learning algorithms and techniques, they are Long-Short
fertilizers to be used and past revenue as input data. Term Memory (LSTM), Auto Regressive Integrated Moving
Multilinear Principal Component Analysis (MPCA) was used Average (ARIMA), Linear Programming and Gastner-
for feature reduction. Optimal Neural Network classifier Newman Cartogram techniques to predict and visualize raw
(ONN) has been used for data prediction. Other than the datasets.
prediction they consider preprocessing and feature reduction
[5].

IJISRT19OCT1880 www.ijisrt.com 244


Volume 4, Issue 10, October – 2019 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165
A. Long-Short Term Memory – avoiding the long-term dependency and LSTM is called cell
LSTM is type of neural network which perform better state which contain different gate. [11]
result in time series prediction. Purpose of this algorithm is

Fig 1:- LSTM cell state diagram, Image downloaded from


https://commons.wikimedia.org/wiki/File:The_LSTM_cell.png#/media/File:The_LSTM_cell.png

The above diagram shows different notations are used, D. Gastner-Newman Cartogram
where Xt denote input vector, Ht-1 denote Previous cell output, It is a technique for representing data for locations.
Ct-1 denote previous cell memory in addition Ht is Current cell Cartogram is a powerful approach to map data [13]. It
output and Ct denote Current cell Memory. Following provides strong visual for numerical area also this technique
formulas are used to find the values of above-mentioned doesn’t need data to be normalized. Comparing other
notations. technique, this is easy to visualize each polygon.

Ft = σ (Xt * Uf + Ht-1 * Wf)  Used Datasets


C’ = tanh (Xt * Uc + Ht-1 * Wc) This system (Agro-Genius) is fully based on statistical
It = σ (Xt * Ui + Ht-1 * Wi) data and most of the data are from Agriculture Department of
Ot = (Xt * Uo + Ht-1 * Wo) Sri Lanka. There were data collected for more than 10 years
Ct = ft * Ct-1 + It * C’t with different seasons in Sri Lanka like Yala and Maha.
Ht = Ot * tanh (Ct) Below are the important factors that affect agricultural crop
yield. which were selected for this research.
B. Auto Regressive Integrated Moving Average (ARIMA) –
ARIMA is statistical analysis model that is used for time 1. Crop production and extent: crop cultivated area in
series data prediction. ARIMA is divided into 3 components hectares and total production in metric ton for every year
such as Autoregression (AR), Integrated (I) and Moving in each district in Sri Lanka for two main season such as
Average (MA). ARIMA model is classified as ARIMA(p,d,q) Yala and Maha.
where p denotes the number of lag observation in the model, 2. Recommended crop: each district located with different
d denotes the number of times that the raw observations are soil type therefore each district has recommended crop
differenced and q denotes the moving average window according to the soil type.
size[12]. Following formula is used to find the price 3. Crop duration: number of days that take to harvest from
forecasting where µ denote constant value. seeds for search type of crop.
4. Crop combination: crop type which can be sewed together
Ŷt = µ + Ø1 yt-1 + .. + Øp yt-p – Ɵ1 et-1 .. – Ɵq et-q in same land.
5. Current cultivation extent: biweekly updated data of
C. Linear Programming cultivation extent of crops in the present time.
It is an optimization technique, by using this can find the 6. Price reports: Crop market price in main markets in
optimum points of object function. selected districts were taken from Central Bank of Sri
Lanka.
7. Weather data: weather data for coming weeks are
received from AccuWeather.

IJISRT19OCT1880 www.ijisrt.com 245


Volume 4, Issue 10, October – 2019 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165

Fig 2:- flow of the system

The following figure shows the workflow of the system. to the map. Another view can be obtained to visualize the past
cropping pattern.
Location of user will be inputted to the system.
Otherwise user should manually input the location where i. Crop & Price Prediction
he/she wants to get the prediction. In the prediction To maximize crop profit, appropriate crop selection will
component, with the given location the existing trained model play a vital role. In this paper profitable crop selection based
will be analyzed, and it will predict suitable crops and then on statistical data like past production data, recommended
the predicted crop will be analyzed with the price prediction crop details for each district, past price data and weather
model and expected price will be listed. And then if the user forecasting data are used. To analyze these data RNN &
wants to optimize the crops that were predicted for a better LSTM technique was used. After crop selection, for those
profitable combination user can proceed to the optimization selected crops expected price in harvesting time will be
component. For more detailed explanation of current cropping predict using ARIMA technique.
around the country, the current cropping data are mapped in

IJISRT19OCT1880 www.ijisrt.com 246


Volume 4, Issue 10, October – 2019 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165
ii. Visualization B. Crop Price Prediction
Currently cultivated crop details are displayed in Sri Price data for last 10 years were used to predict expected
Lankan map with different colors using Gatogram technique price for each crop. This price differs from each district, so
& past cultivation details will be visualized using a bar chart. the location was considered as well. Price data filtered by
location and those filtered data were processed using ARIMA
iii. Multi Crop Optimization and LSTM models and Mean Absolute Percentage Error was
Optimize for profitable crop combinations using linear calculated. Since these price datasets is time series and huge
programming for the predicted crops with optimization inputs so ARIMA is the best selection for price prediction and
like suitable crop combination. accuracy also higher than LSTM. Result of each algorithm are
shown below.
IV. RESULTS & DISCUSSIONS

As mentioned, above this system contains four


component all component depends on each other because
output of the one component will be the input of another
component so the accuracy of each component will affect the
entire system, And this is fully based on dataset prediction, so
accuracy is very important, Since this system is fully based on
dataset all collected raw datasets are normalized according to
the model requirement within that normalized data 80% of the
data was taken as training data, 10% taken for validating and
10% taken for testing.

A. Crop Prediction
This prediction involves many datasets. All datasets are
preprocessed according to the user location and trained using Fig 5:- Predicted price forecasting using ARIMA model
LSTM & Random Forest Regression model. For the
comparison, the districts where the user’s market is
considered. Here past data set of production for last 10 years
for each district were used. LSTM gives more accuracy for
this time series data still current data amount is not enough for
LSTM to give higher accuracy as it has only seasonal
cultivation and production. So, Random forest is working
better for this dataset.

Fig 3:- Normalized cultivation & production data


Fig 6:- Predicted price forecasting using LSTM model

C. Visualization
Currently cultivated data were analyzed and visualized
in the Sri Lankan map using Cartogram technique. Which
locate the cultivated geographical location as per the latitude
and longitude value. Mainly 6 districts were considered in Sri
Lanka (Matale, Kandy, Nuwara Eliya, Jaffna, Kilinochchi,
Mullaitivu) Within those districts cultivated areas and it’s
details like cultivated area in hectare and harvesting time were
taken. This visualized map will be updated according to the
harvesting time.

Fig 4:- Normalized price data

IJISRT19OCT1880 www.ijisrt.com 247


Volume 4, Issue 10, October – 2019 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165
etc. Also, currently cultivated crop details are visualized in a
map with details, which will help farmers to view the nearby
district cultivation details. This system helps farmers to take
correct decision for selecting suitable crops, which will
maximize the profit.

Fig 8:- Past production details

Fig 7:- Visualized currently cultivated data

Also, past statistical results analyzed would be


visualized using bar graph that indicate previously cultivated
details in hectares according to the district for each crop.

D. Multi Crop Optimization


Linear programming model was used with input
parameters such as predicted crop list, crop suitability, area in
hectare and no of crops that user want to cultivate. Which
give 89.66% accuracy for prediction with the available data
set.
Fig 9:- Past cultivation details
V. CONCLUSION & FUTURE WORK
This system considers main features which impact the
Agriculture is the major economic force in Sri Lanka. It profit by taking data in six districts. In future the system can
has moderate climate throughout the year in most parts of the be expanded by considering more features like soil type and
country [14]. As the country is small, cultivated crops are water level and so on. Also expand to provide fertilization
distributed all over the country, because of that a reasonable calendar and guidelines which will helps farmers who have no
market price is remaining as a challenging issue for farmers. experience about crops. Also, in the system can be modified
To overcome this problem, Agro-genius application advice to to receive data from IoT devices without depending on raw
predict the most profitable crops and its expected price during data. Other than that, this system can be developed for other
harvesting time according to the location, by predicting platforms as well.
different historical raw datasets using different machine
learning algorithms like LSTM & RNN, ARIMA, Linear
Programming (LP), Gastner Newman Cartogram algorithm

IJISRT19OCT1880 www.ijisrt.com 248


Volume 4, Issue 10, October – 2019 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165
REFERENCES [13]. Arcgis.com. (2019). [online] Available at:
https://www.arcgis.com/home/item.html?id=4b8c9ce99a
[1]. Ft.lk. (2019). Sri Lanka heading for an agricultural issue 5749e298bb96366692f35d [Accessed 6 Aug. 2019].
in 2017? [Online] Available at: [14]. User, S. (2019). Ministry of Agriculture - Sri Lanka -
http://www.ft.lk/columns/sri-lanka-heading-for-an- Overview. [Online] Agrimin.gov.lk. Available at:
agriculturalissue-in-2017/4-588715 [Accessed 8 Mar. http://www.agrimin.gov.lk/web/index.php/aboutus/overv
2019]. iew123 [Accessed 8 Mar. 2019].
[2]. D Ramesh and B Vishnu Vardhan, “ANALYSIS OF
CROP YIELD PREDICTION USING DATA MINING
TECHNIQUES”, International Journal of Research in
Engineering and Technology eISSN: 2319-1163 |
pISSN: 23217308.
[3]. Yung-Hsing Peng, Chin-Shun Hsu and Po-Chuang
Huang, “Developing Crop Price Forecasting Service
Using Open Data from Taiwan Markets”, 978-1-
46739606-6/15/$3l.00 ©2015 IEEE.
[4]. Arun Kumar, Naveen Kumar and Vishal Vats ,
“EFFICIENT CROP YIELD PREDICTION USING
MACHINE LEARNING ALGORITHMS”,
International Research Journal of Engineering and
Technology (IRJET) Volume: 05 Issue: 06 | June-2018
e-ISSN: 2395-0056 |p-ISSN: 2395-0072.
[5]. Aakunuri Manjula and Dr. G.Narsimha, “Crop Yield
Prediction with Aid of Optimal Neural Network in
Spatial Data Mining: New Approaches”, International
Journal of Information & Computation Technology.
ISSN 09742239 Volume 6, Number 1 (2016), pp. 25-33.
[6]. Leisa J. Armstrong and Sreedhar A. Nallan,
“Agricultural Decision Support framework for
visualization and prediction of western Australian crop
production”, - IEEE 978-9-3805-4421-2/16 – 2016.
[7]. Play.google.com. (2019). [online] Available at:
https://play.google.com/store/apps/details?id=com.field
watch.FieldCheck&hl=en _US [Accessed 8 Mar. 2019].
[8]. Anon, (2019). [online]Available at:
https://itunes.apple.com/us/app/%20escartes-
crops/id1140422866?ls=1&mt=8 [Accessed 8 Mar.
2019].
[9]. User, S. (2019). Department Of Agriculture. [online]
Doa.gov.lk. Available at: https://www.doa.gov.lk/en/
[Accessed 8 Mar. 2019].
[10]. Amis.afa.gov.tw. (2019). Agricultural wholesale market
trading market station. [online] Available at:
http://amis.afa.gov.tw/main/About.aspx [Accessed 8
Mar. 2019].
[11]. Colah.github.io. (2019). Understanding LSTM Networks
-- colah's blog. [online] Available at:
https://colah.github.io/posts/2015-08-Understanding-
LSTMs/ [Accessed 6 Aug. 2019].
[12]. Investopedia. (2019). Autoregressive Integrated Moving
Average (ARIMA). [online] Available at:
https://www.investopedia.com/terms/a/autoregressive-
integrated-moving-average-arima.asp [Accessed 6 Aug.
2019].

IJISRT19OCT1880 www.ijisrt.com 249

You might also like