0% found this document useful (0 votes)
15 views37 pages

Machine Learning for Smart Farming Solutions

The document is a minor project report titled 'Farming Made Easy Using Machine Learning' by Manasi Jadhav, Neha Kolambe, and Shreya Jain, focusing on developing an application to assist farmers with fertilizer recommendations, crop price predictions, and weather forecasting. The proposed system aims to enhance agricultural practices by providing a platform for farmers to share concerns, access educational materials, and purchase necessary farming products. The report outlines the project's objectives, constraints, user stories, and technical specifications, along with a literature survey on existing solutions.

Uploaded by

Keerthi Reddy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views37 pages

Machine Learning for Smart Farming Solutions

The document is a minor project report titled 'Farming Made Easy Using Machine Learning' by Manasi Jadhav, Neha Kolambe, and Shreya Jain, focusing on developing an application to assist farmers with fertilizer recommendations, crop price predictions, and weather forecasting. The proposed system aims to enhance agricultural practices by providing a platform for farmers to share concerns, access educational materials, and purchase necessary farming products. The report outlines the project's objectives, constraints, user stories, and technical specifications, along with a literature survey on existing solutions.

Uploaded by

Keerthi Reddy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

FARMING MADE EASY

USING MACHINE

LEARNING

Minor Project Report

by

Manasi Jadhav 2018140025

Neha Kolambe 2018140030

Shreya Jain 2018140027

Supervisor
Sheetal Chaudhari

Department of Information Technology


Bharatiya Vidya Bhavan’s Sardar
Patel Institute of Technology
(Autonomous Institute Affiliated to University of Mumbai)
Munshi Nagar, Andheri-West, Mumbai-400058
University of Mumbai April
2021
Minor Project Approval Certificate

This is to certify that the Minor Project entitled FARMING MADE EASY USING
MACHINE LEARNING has been completed to our satisfaction by Manasi Jadhav,
Neha Kolambe, Shreya Jain under the guidance of Sheetal Chaudhari for the
award of Degree of Bachelor of Technology in Information Technology from
University of Mumbai.

External Examiner Internal Examiner

(signature) (signature)

Name: Name:

Date: Date:

Seal of the Institute


Acknowledgments

It is really a pleasure to acknowledge the help and support that has gone to in
making this thesis. We express our sincere gratitude to my guide Sheetal Chaudhari
for her invaluable guidance. Without her encouragement this work would not be a
reality. With the freedom she provided, we really enjoyed working under her.
We thank the HOD and staff of the Information Technology Department for
giving us all the facilities required to carry out this research work. We would like to
thank all our family members and well-wishers for their constant encouragement
for all these years, without which we could not have completed this work.
MP REPORT

1. Introduction
1.1. Problem Statement

To build an application that recommends the best fertilizer suited for their
crop given the soil, location, and crop details to the user (i.e. farmer). A
system that provides a platform where farmers can voice/share their
concerns/opinions/problems and help each other in solving the same. A
portal to the farmers who can buy the recommended/desired fertilizers and
equipment. System that also gives farmer-friendly material (i.e. videos) to
help farmers who are new to the agricultural sector in gaining basic
knowledge.

1.2. Solution Adequacy


Existing systems consider potato, aus rice, boro rice, wheat, aman rice
and jute. Our system will manage 20 types of crops (roughly).
The paper talks about crop yield prediction. Our system will merge the
concept with the market data to predict the price of crops, as well as to
provide fertilizers consumption based on different crops. It can be
deployed in weather forecasting also. Our system will combine together
these concepts to make a full - length website which will help farmers.
Existing framework provides a price prediction module which can help
farmers to make certain decisions based on the harvested area or current
trends in the market. Our system will provide a graphical visualization of
predicted prices for better understanding.

1.3. Suggested Solution


The goal is to apply more nutrients than the crop removes so that the
nutrient level in the soil is not limiting the yield. The fertilizer
recommendations are made to apply enough fertilizers to both meet the
nutrient requirements of the crop and to build up the nutrient level in the
soil to a critical soil test level over a planned time frame. One of the best
benefits of the Shopping Portal is the absence of middlemen that reduces
the cost price to a greater degree. Moreover, the online portal is
computerized and automated saving a crucial amount of money.
Through a chat portal, multiple users i.e., farmers can connect to discuss
their queries.
The farmer will be able to choose the category in which section he wants
to browse and watch videos related to that category.
1.4. Constraints & Assumptions
● Data Collection: Collecting relevant data that covers a large number of
agricultural parameters beneficial for fertilizer recommendation.
● Clustering: Making groups (Cluster) of alike research areas so that users
can access all of them much more efficiently. For instance, if algorithms is
a research area, then all the subparts of algorithms can be clustered
together.
● Recommendation searches: One of the important challenges that one
may encounter is to show recommended articles to a user based on his
previous searches.
● Finding grants or funding institutes: It is a big challenge to find where
the research projects generate the funds for their functioning.
● Establishing a connection between research companies and
students: We need to establish connections such that if a research
project is started by any firm/professor, then students must be notified
about the same. Thus a healthy relationship must be established.

1.5. Objective & Scope


● Exact data about the history of harvest yield is significant for settling on
choices identified with rural hazard and the executives and future
expectations. In the status quo, the farmers and the consumers find it
difficult in the real world to determine the accurate prices of crops without
having prior knowledge of the fluctuating trend prices or weather
conditions.
● The proposed framework targets foreseeing the crops price by learning
the previous information of the prices and weather conditions.
● Since the interaction of the farmers is a challenge due to the long
distance this system will help them in connecting together. It aims at
reducing the cost incurred by the farmer to the end user.
● It will forecast weather using the weather API. This will be a user-friendly
project which provides the information guide in regional language
● The system comes with a model to be precise and accurate in predicting
crop price and deliver the end-user with proper recommendations about
the required fertilizer ratio based on atmospheric and soil parameters of
the land which enhances farmer revenue.
● We are also providing a shopbot to buy the recommended fertilizers and
the necessary cultivating related items.
● There will be a chatbot where farmers can communicate to tackle their
queries. It also aims at reducing the cost incurred by the farmer to the
end-user.
● We are providing some informative videos for proper understanding.
2. Literature Survey
The following papers focussed on predicting crop price using Machine
Learning and providing results. In April 2019, the exploration targets foreseeing
both the cost and benefit of the given harvest before [Link] preparing
datasets so acquired give enough bits of knowledge to foresee the suitable cost
and request in the business sectors[1]. The authors have predicted the most
profitable crops and its expected price during harvesting time according to the
location, by predicting different historical raw datasets using different machine
learning algorithms. The work demonstrated by Nishiba [2] is the potential use of
data mining techniques in predicting the crop yield based on the input
parameters average rainfall and area of field. The user-friendly web page
developed for predicting crop yield can be used by any user by providing average
rainfall and area of that place. Different Data Mining techniques are applied to
different datasets. This paper can also include certain modules [11] which can
help farmers to make certain decisions based on the harvested area or current
trends in the market. The system can be extended by visualizing the crop details
in a map with details, which will help farmers to view the nearby district cultivation
details. Proposed system can be enhanced by providing a graphical visualization
of predicted prices for better understanding.
This system is proposed to provide help to the farmers for expecting the
best amount for their crops and for predicting the best price for the crops. This
also helps the farmers to check previous prices of different commodities. The
system can predict crops using [9] Random forest, Polynomial Regression and
Decision Tree algorithms .The best crop and its required fertilizers make the
farmer more confident about the crop and its yield and also our system will do
marketing work [4] by estimating total value of the crop based on current market
price. The idea of the system can be extended by adding some extra features to
the system like providing a nearby shop location portal for purchasing seeds and
fertilizers.
These papers aim at predicting the price and forecast through web
application and it runs on efficient machine learning algorithms like using an
Autoregressive Integrated Moving Average (ARIMA) model,Traditional ARIMA
[6], Support Vector Regression Algorithm[8], and technologies having an overall
user-friendly interface to the [Link] training datasets [7] obtained provide
enough insights for predicting the appropriate price [10] and demand in the
markets. The results are displayed as web applications in order that poor farmers
can access easily. Models can be improved by integrating this with other
departments like horticulture, sericulture, and others towards the agricultural
development of our country. Different agriculture departments have various
problems in the current time. Incorporating them will not only increase the scope
but also help the farmers new to this part of the spectrum. This research work
can be enhanced to the high level by building a recommender system of
agriculture production and distribution for farmers. By which farmers can make
their own decision like which season which crop should sow so that they can get
better profit. We can try applying a data independent system. Irrespective of the
format, our system should work with the same accuracy. Further, can be
enhanced by making an android application for the same.

3. Analysis

3.1. User Stories & Priorities


● As a new farmer, I want to learn about current trends used in farming so
that I have prior knowledge about basic things.
Acceptance Criteria: At the time of usage, the user will know the top 3
and bottom 3 crops according to their previous and predicted prices.
Priority: 1
● As a farmer, I want to know the price of my crop beforehand so that I can
have effective farm management.
Acceptance Criteria: For price prediction users will provide crop name
and accordingly prediction for the next 6 months will be displayed.
Priority: 2
● As a farmer, I want to know about the weather beforehand, so that I can
make decisions accordingly.
Acceptance Criteria: At the time of usage, the user’s location will be
stored, and accordingly the weather will be predicted.
Priority: 3
● As a farmer, I want to know the best fertilizer available for my crop so that
I can buy them at a reasonable price
Acceptance Criteria: At the time of recommendation for fertilizers, the
user will provide crop name, location, and soil type.
Priority: 4
● As a farmer, I want to find products that I need, in one place so that I don't
move around a lot for a great deal
Acceptance Criteria: At the time of purchasing fertilizers or seeds, the
user will provide the city and accordingly the nearby shop's name along
with the address will be displayed on the map.
Priority: 5
● As a farmer, I want to talk to my fellow mates so that I hear about
problems faced by them while I share mine.
Acceptance Criteria: At the time of registration, the name of the farmer
will be stored.
Priority: 6
● As a new farmer, I want to know about the best suited crop for my land so
that I can produce maximum yield and profit.
Acceptance Criteria: At the time of usage, the user will know the list of
crops provided by the system along with their details.
Priority: 7

3.2. Sequence Diagrams


Crop Price Prediction

Weather Forecast
Fertilizer Recommender

Fertilizer Shopping Portal


Crop Recommender

Chat Application
4. Design
4.1. Flow Diagram

4.2. Technical Specification for User Stories

ID User Stories Technical Stories

1 As a farmer, I want to know the best fertilizer Create a Recommendation model based on
available for my crop so that I can buy them at crop name, soil type, and current location.
a reasonable price

2 As a farmer, I want to know the price of my Creating a Prediction model considering


crop beforehand so that I can have effective parameters like a month, year, rainfall, and
farm management. wholesale price index and accordingly
prediction for the next 6 months will be
displayed.

3 As a farmer, I want to talk to my fellow mates Create a chat portal for interaction between
so that I hear about problems faced by them farmers. At the time of registration, the name
while I share mine. of the farmer will be stored and then he will
be directed to a chat room.
4 As a farmer, I want to find products that I Create a shopping portal where farmers can
need, in one place so that I don't move around shop farming -related products like fertilizers,
a lot for a great deal various seeds, etc.

5 As a new farmer, I want to know about the Create a Crop recommender where farmers
best suited crop for my land so that I can can get the best suited crop for their land.
produce maximum yield and profit.

6 As a farmer, I want to know about the weather Create a weather prediction portal using the
beforehand, so that I can make decisions weather API
accordingly

7 As a new farmer, I want to learn about current Providing a section that forecasts the varying
trends used in farming so that I have prior trends in the price of the crops.
knowledge about basic things.

4.3. Technology Stack


1. Crop Price Prediction
● Python (3.0 or above)
● Scikit-learn
● HTML
● CSS
● JavaScript
2. Weather forecasting
● API for weather = [Link]
3. Crop Recommender
● Python (3.0 or above)
● HTML, CSS
● JS
● Flask
4. Fertilizer Recommendation
● Python (3.0 or above)
● HTML, CSS
● JS
● Flask
5. Shopping Portal
● HTML
● CSS
● Bootstrap
● JS
● Flask
6. Chat Application:
● Flask
● Socket Programming
● Python (3.0 or above)
7. Information Guide
● Bilingual guide book =
[Link]

5. Implementation
5.1. Code
Crop Price Prediction
class Commodity:
def __init__(self, csv_name):
[Link] = csv_name
dataset = pd.read_csv(csv_name)
self.X = [Link][:, :-1].values #extracting rows using pandas
self.Y = [Link][:, 3].values
# Fitting decision tree regression to dataset
from [Link] import DecisionTreeRegressor
depth = [Link](7,18) #returns a random depth of the tree
from the specified range
[Link] = DecisionTreeRegressor(max_depth=depth)
[Link](self.X, self.Y) #fit() method takes the training data as
arguments

def getPredictedValue(self, value):


if value[1]>=2019:
fsa = [Link](value).reshape(1, 3)
#Convert the following 1-D array into a 2-D array.
#The outermost dimension will have 1 array, each with 3 elements.
return [Link](fsa)[0]
else:
c=self.X[:,0:2]
x=[]
for i in c:
[Link]([Link]())
fsa = [value[0], value[1]]
ind = 0
for i in range(0,len(x)):
if x[i]==fsa:
ind=i
break
return self.Y[i]

def getCropName(self):
a = [Link]('.')
return a[0]

Weather Prediction
@[Link]('/weather',methods=['GET'])
def weather():
cityname = [Link]('city')
context = {
"weatherdesc": weatherf(cityname)
}
return render_template('[Link]',context = context)

def weatherf(cityname):
import socket
import requests
try:
send =[]
socket.create_connection( ("[Link]",80) )
city = cityname
if(cityname == None):
pass
else:
a1 =
"[Link]
a2 = "&q=" + city
a3 = "&appid=c6e315d09197cec231495138183954bd"
api_address = a1 + a2 + a3
res1=[Link](api_address)
data = [Link]()
list1 = data['list']
res = [sub['main'] for sub in list1]
temp = [t['temp'] for t in res]
hum = [t['humidity'] for t in res]
mini = [t['temp_min'] for t in res]
maxim = [t['temp_max'] for t in res]
time = [sub['dt_txt'] for sub in list1]
degree_sign = u"\N{DEGREE SIGN}" + "C"
weather = [sub['weather'] for sub in list1]
weatherm,weatherd,icon = [],[],[]
for i in range(len(temp)):
for sub in weather[i]:
[Link](sub['main'])
[Link](sub['description'])
[Link]([time,temp,mini,maxim,hum,weatherm,weatherd])
except KeyError as k:
print("City Not Found")
except OSError as e:
print("check network ",e)
return send

Chat Application
@[Link]('/chat')
def sessions():
return render_template('[Link]')
@[Link]('my event')
def handle_my_custom_event(json, methods=['GET', 'POST']):
print('received my event: ' + str(json))
[Link]('my response', json, callback=messageReceived)
Crop Recommendation
@[Link]('/croprecomd')
def crop_recommend():
return render_template('[Link]')

@[Link]('/predict',methods=['POST'])
def predict():
'''
For rendering results on HTML GUI
'''
feature = []
for x in [Link]():
[Link](x)

pickle_out = open("[Link]","wb")
[Link](feature, pickle_out)
pickle_out.close()

#final_features = [[Link](int_features)]
#prediction = [Link](final_features)

[Link]()
pickle_in = open("model_output.pickle","rb")
output = [Link](pickle_in)
avail = str(output[0])
high = str(output[1])
rec = str(output[2])
low = str(output[3])
day = str(output[4])
month = int(output[5])
if(month == 1):
month = "January."
elif(month==2):
month = "February."
elif(month==3):
month = "March."
elif(month==4):
month = "April."
elif(month==5):
month = "May."
elif(month==6):
month = "June."
elif(month==7):
month = "July."
elif(month==8):
month = "August."
elif(month==9):
month = "September."
elif(month==10):
month = "October."
elif(month==11):
month = "November."
else:
month = "December."

day = day + ', '+ month


loc = str(output[6])
avail = [Link]({ord(i): None for i in "{}''"})
high = [Link]({ord(i): None for i in "[]''"})
rec = [Link]({ord(i): None for i in "[]''"})
low = [Link]({ord(i): None for i in "[]''"})

#return render_template('[Link]', Avail='AC: {}'.format(output[0]),


High ='H: {}'.format(output[1]), avg ='A: {}'.format(output[2], low ='N:
{}'.format(output[3])))
return render_template('[Link]', Avail=avail, Low=low,
High=high, Rec=rec,Day = day,Loc = loc)
Fertilizer Shop
@[Link]('/shop',methods=['POST','GET'])
def shop():
if [Link] == 'POST':
city = [Link]['city']
print(city)

return render_template('fertilizer_shop.html',city=city,data=True)

return render_template('fertilizer_shop.html')

Fertilizer Recommender
@[Link]('/fertilizer_info',methods=['POST','GET'])
def fertilizer_info():
data = pd.read_csv('static/final_fertilizer.csv')
crops = data['Crop'].unique()

if [Link] == 'GET':
crop_se = [Link]('manager')
query = data[data['Crop']==crop_se]
query = query['query'].unique()
queryArr = []
if len(query):
for query_name in query:
queryObj = {}
queryObj['name'] = query_name
print(query_name)
[Link](queryObj)
return
jsonify({'data':render_template('[Link]',crops=crops,crop_len=len(cr
ops)),'query':queryArr})

if [Link] == 'POST':
crop_name = [Link]['crop']
query_type = [Link]['query']
query = data[data['Crop']==crop_name]
answer = query[query['query']== query_type]
answer = answer['KCCAns'].unique()
protection = []
for index in answer:
[Link](index)

return
render_template('[Link]',protection=protection,protection_len=len(pr
otection),display=True,crops=crops,crop_len=len(crops))

return
render_template('[Link]',crops=crops,crop_len=len(crops),query_le
n=0)

Current Trends
@[Link]('/')
def index():
return render_template('[Link]')

@[Link]('/trends')
def trends():
context = {
"top3": TopThreeWinners(),
"bottom3": TopThreeLosers(),
"sixmonths": SixMonthsForecast()
}
return render_template('[Link]', context=context)

Information Guide
@[Link]('/guide')
def guide():
return render_template('[Link]')
5.2. Test cases
1. In Fertilizer Information Page, if result if found it shows the result, otherwise it
shows Result found 0
2. In the Fertilizer Information Page, if result is not found, it shows Result found 0.

3. Enter City name to get nearby fertilizers and seed shop


4. If the entered city name is wrong, it will search the city whose name is
approximately similar to the entered city name.

Here I entered Mumbai which is similar to Mumbai so the shops in Mumbai are
displayed.
5. Here, I am entering the city name which is not at all valid then it shows some
values rather than displaying nothing on the map.

5.3. Continuous Integration Testing


Home Page:
If we select the language in which we want to view the website. Here, Selected language
is Hindi

Explore crops page to see price prediction by clicking on crop


Selecting Wheat to check its price prediction

Wheat Commodity page


Current Trends

Weather Forecast page. Enter city name to gets its weather prediction for 5 days with 3
hours delay
Fertilizer Recommender Page. Enter Crop Type and Query that the selected crop is
suffering from.

After selecting the crop name and its query, We get the solution on that about what to do
with the crop to make it disease free.
Fertilizer shop page to find out fertilizer and seeds shops near our city.

Entering city name (Mumbai), we get the map with marker as fertilizer and seeds shop
after clicking on the marker we get the address of the same.

Crop Recommender Page. Enter Date of cultivation, Month, and Location and we get the
crop recommendation of when to grow, what to grow and what not to.
Chat Application page to contact with farmers.
Guide Page for farmers who are new in this field
Handbooks with all information related to farming are present in this. Also, books are in
state languages.

Irrigated-Unirrigated Area Land Map for information about irrigated and unirrigated land
are present in the state. Hover on the state to look for information about the particular
state
Agricultural Land Area Land Map for information about agriculture land are present in the
state. Hover on the state to look for information about the particular state
6. References
[1] Rachana, Rashmi, Shravani, Shruthi, Seema Kousar, Crop Price Forecasting
System Using Supervised Machine Learning Algorithms, International Research Journal
of Engineering and Technology (IRJET), Apr 2019
[2] Nishiba Kabeer, [Link].D, Cowsalya.T, Prediction of Crop Yield Using Data
Mining, International Journal of Computer Science and Network, June 2019
[3] J. Vijayalakshmi, K. PandiMeena, Agriculture TalkBot Using AI, International Journal
of Recent Technology and Engineering (IJRTE), July 2019
[4] Gamage, A., & Kasthurirathna, D. Agro-Genius: Crop Prediction Using Machine
Learning, International Journal of Innovative Science and Research Technology, Volume
4, Issue 10, October – 2019
[5] Vohra Aman, Nitin Pandey, and S. K. Khatri. "Decision Making Support System for
Prediction of Prices in Agricultural Commodity." 2019 Amity
International Conference on Artificial Intelligence (AICAI). IEEE, 2019.
[6] Nguyen, Huy Vuong, et al. "A smart system for short-term price prediction using time
series models." Computers & Electrical Engineering 76 (2019)
[7] Sangeeta, Shruthi G, Design And Implementation Of Crop Yield Prediction Model In
Agriculture, International Journal Of Scientific & Technology Research Volume 8, Issue
01, January 2020
[8] Rohith R, Vishnu R, Kishore A, Deeban Chakkarawarthi, Crop Price Prediction and
Forecasting System using Supervised Machine Learning Algorithms, International
Journal of Advanced Research in Computer and Communication Engineering, March
2020
[9] Naveen Kumar P R, Manikanta K B, Venkatesh B Y, Naveen Kumar R, Amith Mali
Patil, Journal of Xi'an University of Architecture & Technology, 2020.
[10] Kumar, Y. Jeevan Nagendra, et al. "Supervised Machine learning Approach for
Crop Yield Prediction in the Agriculture Sector." 2020 5th International Conference on
Communication and Electronics Systems (ICCES). IEEE, 2020.
[11] Pandit Samuel, [Link] , [Link] , [Link] , [Link] Kumar, Crop Price
Prediction System using Machine learning Algorithms, Quest Journals Journal of
Software Engineering and Simulation, 2020
[12] Rubhi gupta, Review on weather prediction using machine learning, International
Journal of Engineering Development and Research, 2020

7. Paper
7.1. Conference/journal details
2nd INCET 2021 is organized by
JAIN COLLEGE OF ENGINEERING & TECHNOLOGY, Belgaum
Karnataka, INDIA. This conference is Technically Sponsored by IEEE
Bangalore Section. Landmark – Goa ,India

7.2. Paper status – Submitted


7.3. Certificate

You might also like