[go: up one dir, main page]

0% found this document useful (0 votes)
149 views97 pages

Report

Uploaded by

Prateek Ingole
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)
149 views97 pages

Report

Uploaded by

Prateek Ingole
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
You are on page 1/ 97

A

Project Report
On
“Smart Crop And Fertilizer Prediction System”

Submitted by

Student name Roll no

Ganesh Mundalik 39

Kajal Patil 45

Pradnya Avhad 03

Akshada Gaikwad 16

Under the Guidanceof

Prof.GeetaMakhija
(ME , CS IT)
In partial fulfillment of
SavitribaiPhule, Pune University
Department of Information Technology
At

PARVATIBAI GENBA MOZE COLLEGE OF ENGINEERING,


WAGHOLI, PUNE-412207
2021-2022
Parvatibai GenbaMoze College Of Engineering
Pune
Department of Information Technology

CERTIFICATE

This is to certify that the project entitled “Smart Crop And Fertilizer Prediction

System”, submitted by Ganesh Mundalik, KajalPatil, PradnyaAvhad,

Akshada Gaikwad is a record of bonafide work carried out by him/her, in the partial

fulfillment of the requirement for the award of Engineering in Information Technology at

Parvatibai Genba Moze College, Wagholi under the Savitribai Phule Pune University .This

work is done during year 2021-2022, under our guidance.

Project Coordinator Project Guide HOD IT


[Prof.Supriya More] [Prof.GeetaMakhija] [Prof.Abidali Shaikh]

Examiner Principal
(External) (PGMCOE)

Date: Place: Wagholi


Acknowledgement

I am profoundly grateful to Prof.Geeta Makhija her expert guidance and continuous

encouragement throughout to see that this project rights its target since its commencement to

its completion.

I would like to express my deepest appreciation towards Prof. M.G.JadhavPrincipal,

Parvatibai Genba Moze College, Prof. Abidali Shaikh, HOD Information Technology

Department whose invaluable guidance supported me in completing this project.

Student name Roll no

Ganesh Mundalik 39

Kajal Patil 45

Pradnya Avhad 03

Akshada Gaikwad 16

Date:
Place: Wagholi

Engineering in Information Technology


Abstract

Agricultural industry plays a major role in the process of economic development as well as
the Gross Domestic Product of India. Agricultural informatization is an important driving
force for the development of agricultural modernization. With the further improvement
ofagricultural informatization infrastructure construction, the use of modern information
technology to achieve personalized agricultural information resource recommendation
services and provide users with timely and effective information has become an effective
solution. This article aims to provide a comprehensive review of recent research efforts on
application of agricultural information based on intelligent recommender systems. Firstly, the
method of content analysis used in this article to sort out the papers is introduced. Secondly,
the background concepts of recommender systems and the key technologies are presented.
Thirdly, the applications of recommender systems/technologies for agricultural information
are described in detail. the applications of recommender systems/technologies for agricultural
information are described in detail. Finally, a summary and outlook on the application of
recommender systems for agricultural information are provided.The lack of scientific
approaches to soil fertility has become a major challenge for the industry. Since most of the
farmers are not familiar with the concepts of soil nutrients, they tend to start their cultivations
by assuming myths and assumptions. The project aims at suggesting the best crop based on
the soil fertility and also recommends a fertilizer plan to minimize the amount of fertilizers
that are needed. The project developed a cross- platform web application to suggest the best
crops according to available soil fertility. Further, a fertilizer plan will be suggested on the
basis of the contents of NPK Nitrogen (N), Phosphorus (P) and Potassium (K) values to
optimize fertilizer usage in order to increase profitability and avoid soil degradation.

Keywords: Crop Recommendation, Fertilizer Recommendation, Machine Learning,


Agriculture
List of Tables

Contents Page No.

Literature Review 18

Crop Prediction 22
Fertilizer Prediction 23
Performance Evaluation Table 23
Risk Management 47
Risk Probability Definition 48
RMMM Plan 60

HTTP Methods 82
Action Plan 89
List of Diagrams

Contents Page No.

Life Cycle Project 19

System Architecture 27

Work Flow Diagram 28

DFD Diagram (Level 1) 29

DFD Diagram (Level 2) 29

Use case Diagram 30


Sequence Diagram 31
Activity Diagram 32
Waterfall model 33
Collaboration Diagram 35
Decision Tree 37
Gaussion Naïve Bayes 38
Logistic Regression 39
Random Forest 60
XGBoost Model 42
Task Network 75
INDEX

CONTENTS PAGE NO

ACKNOWLEDGEMENT
List of Tables
List of Diagram
ABSTRACT
1. INTRODUCTION……………………………………………………... 1
1.1 Introduction 1
1.2 Need Of Project 1
1.3 Basic Concept 2
1.4 Project Scope 2
1.5 Overview 4
1.6 Motivation 6
1.7 Background 6
1.8 Application 7
2. LITERATURE REVIEW……………………………………………… 9
3. REQUIREMENT SPECIFICATION ………………………………… 11
3.1 Problem Statement 12
3.2 Project Scope 14
3.3 Life Cycle Of Project 14
3.4 System Study 15
3.4.1 Feasibility Study 15
3.5 Objective 16
3.6 Project Goal 17
3.7 Project Purpose 17
3.8 Dataset 17
3.8.1 Crop Prediction Dataset 18
3.8.2 Fertilizer Prediction Dataset 19
3.9 Performance Evaluation Table 19
4. Research Methodology …………………………………………………….. 20
4.1. InterPret input for the Project 20
5. PROJECT DESIGN ………………………………… 21
5.1 System requirements Specification 21
5.1.1 Hardware Tools 21
5.1.2 Software Tools 21
5.2 UML Diagrams 21
5.2.1 System Architecture 23
5.2.2 Work Flow diagram 24
5.2.3 DFD Diagram(Level 1) 25
5.2.3 DFD Diagram(Level 2 ) 26
5.2.4 Use Case Diagram 26
5.2.5 Sequence Diagram 27
5.2.6 Activity Diagram 28
5.2.7 Waterfall Model 29
5.2.8 Collaboration Diagram 29
5.2.9 Sequence Diagram 30
6. IMPLEMENTATION…………………………………………………… 31
6.1.1 Decision Tree: 31
6.1.2 Gaussian Naive Bayes 32
6.1.3 Logistic Regression 33
6.1.4 Random Forest 34
6.1.5 XG Boost 35
6.2 Modules 38
6.3 Modules Description 38
6.3.1 Data Collection 38
6.3.2 Data Preparation 38
6.3.3 Model Selection 38
6.3.4 Linear Regression 39
6.3.5 Support Vector Machine 39
6.3.6 Mean square error 39
6.3.7 Naïve Bayes Algorithm 40
6.3.8 Saving the trained model 40
6.4 Requirement Specification Analysis 41
6.4.1 Problem Definition 41
6.4.2 Risk Management 41
6.4.3 Risk Mitigation, Monitoring, Managememt 42
6.4.4 The RMMM Plan 43
6.4.5 Risk Identification 44
6.4.6 Risk Analysis 44
6.5 System Testing 44
6.6 Types of Tests 44
6.6.1 Unit Testing 44
6.6.2 Integration Testing 46
6.6.3 Function Test 47
6.6.4 System Test 47
6.6.5 White Box Testing 47
6.6.6 Black Box Testing 48
6.6.7 Test Strategy And Approach 48
6.6.8 Test Objectives 48
6.6.9 Features to be Tested 48
6.6.10 Integration Testing 49
6.6.11 Acceptance Testing 49
6.6.12 Advantages 49
6.6.13 Disadvantages 49
6.14 Code 50
6.15 Screenshot 61
7. SCHEDULE OF WORK…………………………………………………. 62
7.1 Project Schedule 69
7 .2 System Engineering 69
7.2.1 Task Network 70
7.2 Project Requirement 71
7.3.1 Functional requirements 71
7.3.2 Non-Functional requirements 71
7.3.3 Hardware requirements 72
7.3.4 Software requirements 72
7.3.5 Software Environment 72
7.3.6 Action Plan 73
8. CONCLUSION ………………………...………………………………. 74
9. REFERENCES ……………………………………………………………….. 75
Smart Crop And Fertilizer Prediction System

1. INTRODUCTION

Agriculture sector is backbone of our country and it contributes about 18% of Gross Domestic
Product (GDP) as per annual report 2018-2019 from Department of Agriculture, Co-operation
and Farmer Welfare. Agriculture is the most important sector of the Indian economy that
provides employment to almost half the population of the country’s workforce. But still farmers
are not getting profitable margin for their products in the market. Even though India is being a
second-largest producer of fruits and vegetables in the world as per annual report 2018-2019
from Department of Agriculture, Co-operation and Farmer Welfare, farmers are financially
distressed due to crop loss. The most important cause for this is due to the fact of inappropriate
crops selection or additionally sometimes they didn't get precise price for his or her crop due to
surplus production of the crop. By analysing the soil and environmental factor at particular
region the best crop is predicted in order to have more crop yield. This prediction will help the
farmers to choose appropriate crops for their land according to the soil type, temperature,
humidity, water level, soil fertility. The objective of the project is to provide a system that helps
farmers to select a suitable crop based on soil nature and environmental factors such as
temperature, soil moisture, humidity and market demand using the technological advancement
such as Data analysis, Cloud storage and Internet of Things.

1.2 Need Of Project

Crop yield prediction is an essential task for the decision-makers at national and regional levels
(e.g., the EU level) for rapid decision-making. An accurate crop yield prediction model can help
farmers to decide on what to grow and when to grow. There are different approaches to crop
yield prediction
Fertilizers replace the nutrients that crops remove from the soil. Without the addition of
fertilizers, crop yields and agricultural productivity would be significantly reduced. That's why
mineral fertilizers are used to supplement the soil's nutrient stocks with minerals that can be
quickly absorbed and used by crops.
Detection of plant disease through some automatic technique is beneficial as it reduces a large
work of monitoring in big farms of crops, and at very early stage itself it detects the symptoms of
diseases i.e. when they appear on plant leaves.

1I
Information Technology, PGMCOE,Wagholi. 1
Smart Crop And Fertilizer Prediction System

1.3 Basic Concepts

Agriculture plays an essential part in an economy’s life. They are the backbone of our country’s
economy system. One of the key problems confronting farmers is selecting the right crop for
cultivation. Selection of crops is determined by several factors such as temperature,
soilcomposition, market prices etc. Machine Learning is a technique that uses complex
algorithms and a collection of predefined rules to operate intelligently. It uses past data to read
the patterns and then perform the intended task according to the defined rules and algorithms
based on the analysis it produces. Machine Learning is an imminent field of informatics that can
be applied quite efficiently to the agricultural sector. Machine Learning is everywhere
throughout the entire growing and harvesting cycle The major factors affecting crop yield are the
soil type, land type and the macro-nutrients present in the soil. The purpose of this work is to
categorize the soil samples according to the macro nutrients found therein and to predict the
crops which can be grown in the soil. The crop recommendation system which is developed
incorporates incorporates the agricultural dataset. The Nitrogen (N), Phosphorus (P) and
Potassium (K), Soil type, Soil texture, Land type, pH and Electrical conductivity of the soil are
taken as input to recommend the crops. The system for crop yield prediction, forecasting and
fertilizer recommendation are all separate and distinct in the existing system. The proposed
system constructs a collaborative system of crop yield prediction and forecasting, crop rotation
and fertilizer recommendation. In this project a system is developed in which Voting Based
Ensemble Classifier is applied to recommend the appropriate crops This system also proposes
the required fertilizer to boost the nutrients contained in the soil and thus enhance the yield of the
crop. Thus there arises a need for suggesting suitable crops and fertilizers using machine learning
algorithm.

1.4 Project Scope

The scope of the project is to determine the crop yield of an area by considering dataset with
some features which are important or related to crop production such as temperature, moisture,
rainfall, and production of the crop in previous years. To predict a continuous value, regression
models are used. It is a supervised technique.

2II
Information Technology, PGMCOE,Wagholi. 2
Smart Crop And Fertilizer Prediction System

The coefficients are preprocessed and fit into the trained data during training and construction
the regression model. The main focus here is to reduce the cost function by finding the best fit-
line. The output function facilitates in error measurement. During training period, error between
the predicted and actual values is reduced in order to minimize error function. A modern
software farm tool is grouped according to the scope of tasks it fulfills. To even classify the tool
as agriculture software development, it needs to perform the following functions: Enables
tracking and analysis of day-to-day operations and activities on a farm.Have features that
improve a farm's production efficiency and profitability (e.g. irrigation software), Crop
management is available, Allows for tracking and managing workers. progress and streamlines
the communication and collaboration between them, Creates connected agriculture software with
other tools. Agricultural software should be a comprehensive tool that handles the most critical
tasks involved in farming. Thus, it should result in the improved flow of information, increasing
the farm's productivity.Thanks to crop production history analysis, agricultural software is
transforming the way farmers do their jobs in a big way, allowing them to make better decisions
and use less water, fertilizer, or pesticide. As a result of big data, farmers can obtain timely
information about pests and weed outbreaks, allowing them to apply pesticides only once instead
of multiple times during the growing season. Crop management software impacts all aspects of
agriculture. It spans the entire spectrum of farm yield optimization, food safety management,
supply chain visibility, and global trade policy analysis; to animal welfare policy. It has all been
accomplished using machine learning algorithms to identify at-risk animals early enough to
monitor their health, based on predictive models mapping out potential sources of infection on
cattle farms in Europe. The use of agricultural software by farmers is aimed at increasing yield.
Big data is a term used to describe large datasets that are gathered from different sources,
including satellites, sensors on tractors, and livestock tags. These datasets provide a great deal of
information about agricultural production without requiring extensive manual labor. The
coefficients are preprocessed and fit into the trained data during training and construction the
regression model. The main focus here is to reduce the cost function by finding the best fit-line.
The output function facilitates in error measurement. During training period, error between the
predicted and actual values is reduced in order to minimize error function.

3III
Information Technology, PGMCOE,Wagholi. 3
Smart Crop And Fertilizer Prediction System

1.5 Overview

Farming is one of the major sectors that influences a country’s economic growth. In countries
like 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. In this project, I
present a website in which the following applications are implemented; Crop recommendation
and Fertilizer recommendation 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 excess
of and will recommend improvements .Agriculture is very important because it produces food
and feed which is a necessity to animals and human beings. It fulfills the basic needs of billions
of people. It is one of the major contributors to the country’s GDP and economic growth. Hence,
it is widely practiced in India. Agriculture sector requires more workforce than any other sectors,
nowadays there is a huge decrease in the agricultural workforce . So, we need to fill that huge
gap by making advances in agriculture with the help of technology. Thus, agricultural
advancement results in gaining more profit by the farmers. Big data analytics techniques are used
to analyze data sets of temperature, humidity, rainfall and soil which are collected from the
meteorological department. This type of required analysis is performed by using specific
software tools, many of them available as open source. By using these tools and techniques the
system will have information, by this processed information the system will make better
decisions. Thus, ensuring better results. Today the farmers develop crops dependent on the
experience picked up from the past age .Since the customary technique for cultivating is polished
there exists an overabundance or shortage of yields without gathering the real necessity. The
farmers don't know about the interest that happens in the current horticultural economy. This
results in the misfortune to the Farmers. The communicated thought processes arranged by
significance in the back of Farmer suicides have been condition, low produce costs, weight and
hover of relative's obligations, poor water system, and blast inside the cost of development

4IV
Information Technology, PGMCOE,Wagholi. 4
Smart Crop And Fertilizer Prediction System

A system that automatically detects leaf disease with the help of image processing is being
developed. This in turn helps the farmers in the identifying the diseases at an early stage and
provide useful information to control it. This system does few image pre-processing techniques
like image acquisition, image segmentation, feature extraction and classification. Modern
agricultural practices assure great development of cultivation. We have many smart agriculture
developing models used as a real time monitoring systems to monitor the temperature, humidity,
moisture content in the soil using various sensors. We have many systems that do work
automatically but there are very few systems that detect problems and provide suggestions to
those problems. One such automatic a disease detection system is developed with the help of
image processing. Image processing is applied in such a way that even a spot in the leaf is
detected. The system detects almost all possible diseases and also addresses the severity levels of
the disease. Mostly plant leafs are infected due to pathogens, fungi, bacteria and viruses. In
recent years, most of the disease detection systems were developed based on image processing.
These systems input should be the set of affected plant images that are saved in the database. In
this paper we are taking the images of the leaf that are already captured. The images are given to
the system after that using image processing techniques the image is enhanced to increase the
accuracy in finding the disease. The techniques we are using are clustering, classification, feature
extraction and segmentation. The Diseases will vary based on the size, color, shape and the virus
affected. System takes lots of infected parts from the images and those images are put into image
processing techniques. As there are various systems that detect leaf diseases, accuracy matters
the most. The accuracy of the system is improved by using the best algorithmic pair. Normally,
farmers can guess the final yield by their experience of growing a particular crop again and
again. Farmers yield prediction accuracy is low and not cost effective. To meet the food
requirements of the entire population of the country and for the export of some agricultural
products to other countries, it is important to practice modern methods of farming by using
technology instead of practicing traditional farming methods. Modern methods allow the farmers
to cultivate the crops in small areas with a minimum amount of water ,fertilizers and pesticides
,which finally produces good yield and profit to the farmers.

5V
Information Technology, PGMCOE,Wagholi. 5
Smart Crop And Fertilizer Prediction System

1.6 Motivation

India is a nation in which agriculture plays a prime role. The prosperity of the farmers prospers
the nation. Thus our system would help farmers in sowing the right seeds based on soil
requirements to increase productivity and acquire profit. As a result, farmers can plant the right
crop that will increase the yield and also increase the overall productivity of the nation.
Agricultural productivity mainly depends upon the soil condition which in turn depends upon
nutrients present in the soil. Based on soil analysis, crops should be recommended to the farmers
to increase crop productivity and in turn, increase the financial status of the farmers. Also,
farmers face huge losses due to wrong fertilizer uses, we are also building fertilizer
recommendation systems which will help farmers choose the right fertilizer.

1.7 Background
In recent years, India has been shaken by economic and social forces related to higher suicide
rates amongst small and marginal farmers. Our aim is to offer assistance and tools to help
such farmers and communities and address these issues. Generally, they face challenges
accessing and trusting educational outreach and training to better understand how to increase
crop yields and improve financial standing. Because of the serious nature of the issues at
stake and general hesitance to trust help from outside the community, any service or product
meant to help must be carefully designed and tested in order to ensure positive outcomes and
successful adoption.
There is no existing software solution which recommends crops based on multiple factors
such as type of the soil and weather components which include temperature and rainfall. And
the systems that already exist are hardware based which makes them expensive and difficult
to maintain. The proposed system suggests a Mobile based application, which can precisely
predict the most profitable crop to the farmer by predicting the yield. The user location is
identified with the help of GPS and the Area & soil type are taken as user input. According to
user location, the crop yield in the respective location is identified from the soil and weather
database. After the processing is done at the server side, the result is sent to the user‘s
application. The previous production of the crops is also taken into account which in turn
leads to precise crop yield results. Depending on the numerous scenarios and additional
filters according to the user requirement, the most producible crop is suggested based on the

6VI
Information Technology, PGMCOE,Wagholi. 6
Smart Crop And Fertilizer Prediction System

yield. While there are many ways to contribute to improvements in the lives of our target
audience, our task was to leverage data to predict a valuable result so that farmers and aid
workers would be able to make informed planning decisions. Ultimately, the focus of the
work during this project was to both conduct audience research that would direct the design
of the product and design a data model that would produce the desired results.

The most common diseases of cultivated plants are bacterial wilt, chestnut blight, potato late
blight, rice blast, coffee rust, stem rust, downy mildew, ergot, root knot, and tobacco mosaic.
This is a small list of the more than 50,000 diseases that attack plants. Diseases can be
categorized as annihilating, devastating, limiting, or debilitating. As the term suggests,
annihilating diseases can totally wipe out a crop, whereas a devastating plant disease may be
severe for a time and then subside. Debilitating diseases weaken crops when they attack them
successively over time and limiting diseases reduce the viability of growing the target crop,
thereby reducing its economic value. Plant diseases are identified by both common and
scientific names. The scientific name identifies both the genus and the species of the disease-
causing agent.
For the past 50 years, the ability to combat plant diseases through the use of modern farm
management methods, fertilization of crops, irrigation techniques, and pest control have made it
possible for the United States to produce enough food to feed its population and to have
surpluses for export. However, the use of pesticides, fungicides, herbicides, fertilizers and other
chemicals to control plant diseases and increase crop yields also poses significant environmental
risks. Air, water, and soil can become saturated with chemicals that can be harmful to human and

1.7 Application

Agricultural Applications means applications relating to (i) cultivating, characterizing or


modifying soil
(ii) producing, growing, improving, protecting, treating or modifying crops or forest products;
(iii) raising, harvesting, improving, protecting, treating or modifying livestock, poultry, fish or
shellfish
(iv) the preparation, marketing or treatment of products resulting from the activities described in
(i)-(iii) above.

7VII
Information Technology, PGMCOE,Wagholi. 7
Smart Crop And Fertilizer Prediction System

Agricultural Applications shall include applications involving the improvement or modification


of soil, crops, livestock, poultry, fish or shellfish and their resulting products as they relate to
human health, as well as foods from plants and animals designed or modified to enhance their
health attributes, in each case for nutraceutical applications but not therapeutic applications in
humans. Agricultural Applications shall also include agricultural applications relating to bacteria,
fungi, and viruses, as well as pest organisms with respect to, and only to the extent of, such
Crop yield prediction is an essential task for the decision-makers at national and regional levels
(e.g., the EU level) for rapid decision-making. An accurate crop yield prediction model can help
farmers to decide on what to grow and when to grow. There are different approaches to crop
yield prediction. Detection of plant disease through some automatic technique is beneficial as it
reduces a large work of monitoring in big farms of crops, and at very early stage itself it detects
the symptoms of diseases i.e. when they appear on plant leaves.
proposed model is to develop a tool which is meant to deliver prediction based on the crop of the
individual. The product version being developed focuses on the prediction, but eventually it can
be added as more data is available and included as features in the data model. The proposed
model provides farmers with the detailed recommendation set to optimize their crop selection
based on individual factors such as location, farm size, temperature, rainfall, and various crop
dataset.All data used in this study are publicly available. Agriculture is a key economic driver. It
is a key to healthy biosphere. People depend on a wide range of agricultural products in almost
all aspects of life. Farmers need to cope with climate change, and meet rising demands for more
food of higher food quality. In order to escalate the yield and growth of crops, the farmer needs
to be aware of the climatic conditions, hence aiding its decision of growing the suitable crop,
under those factors. IoT based Smart Farming improves the entire Agriculture system by
monitoring the field in real-time. It keeps various factors like humidity, temperature, soil etc.
under check and gives a crystal- clear real-time observation. Machine learning in agriculture is
used to improve the productivity and quality of the crops in the agriculture sector. Use of
appropriate algorithms on the sensed data can help in recommendation of suitable crop.

8VIII
Information Technology, PGMCOE,Wagholi. 8
Smart Crop And Fertilizer Prediction System

2. LITERATURE SURVEY

Sr. No. Title & year Author Description Advantage

In this paper, we
have proposed a
model that can
Soil Classification Sk Al Zaminur predict soil series
using Machine Rahman, with land type and
Easy to use and
Learning Methods and Kaushik according to
Time consuming.
1. Crop Suggestion Chandra Mitra, prediction it can
Based on Soil Series S.M. Mohidul suggest suitable
(2018) Islam crops. Using
Machine learning
Algorithms.

By using an
automated system
implementing
Automated Soil machine vision,
Classification and M van Rooyen, more accurate
Easy to use and
Identification Using N Luwes, results can be
2. Time consuming.
Machine Vision E Theron achieved and test
( 2017 ) durations can be
decreased dramati-
cally.

9IX
Information Technology, PGMCOE,Wagholi. 9
Smart Crop And Fertilizer Prediction System
In Rajasthan there
are various types of
soil available: sandy,
saline, alkaline,
Soil Classification &
calcareous soil are
Characterization Hemant Kumar
also present, we can Easy to use and
3. Using Image Sharma,
classify the soil by Time consuming.
Processing Shiv Kumar
image processing
(2018)
method in which we
can see the color,
energy, HSV etc.
.
This paper explains
support vector
machine based
classification of the
Performance of SVM
soil types. Soil
Classifier For Image
Sunitha.k , classification Easy to use and
4. Based Soil
Dr.S.Padmavati includes steps like Time consuming.
Classification
image acquisition,
(2016)
image
preprocessing,
feature extraction
and classification

10X
Information Technology, PGMCOE,Wagholi. 10
Smart Crop And Fertilizer Prediction System

3. PROPOSED WORK

The aim of the proposed system is to help farmers to cultivate crops for better yield. The crops
selected in this work are based on important crops from selected locations.
The selected crops are Rice, Jowar, Wheat, Soyabean, and Sunflower, Cotton, Sugarcane,
Tobacco, Onion, Dry Chili etc.
Crop yield prediction is an essential task for the decision-makers at national and regional levels
(e.g., the EU level) for rapid decision-making. An accurate crop yield prediction model can help
farmers to decide on what to grow and when to grow. There are different approaches to crop
yield prediction.
The proposed methodology contains two phases: Training Phase and Test Phase. In the training
phase the data was collected and preprocessed. The pre-processed data was clustered using k-
means clustering algorithm. The association rule mining process will apply on clustered data to
find the rules. The training phase ends with number of generated rules. In the testing phase, the
yield value is predicted based on the generated rules. The work starts with preprocessing step. In
this step the collected data was pre-processed. In the preprocessing, some data was removed
from the data set. Some of the area was not suitable for crop production. So that data will be
removed.

There are 2 process in proposed work:

Crop Yield Prediction:Crop Yield Prediction can be done using crop yield data, nutrients and
location data. These inputs are passed to Random Forest and Support Vector Machine
algorithms. These algorithms will predict crops based on present inputs.

Fertilizer Recommendation:Fertilizer Recommendation can be done using fertilizer data, crop


and location data. In this part suitable crops and required fertilizer for each crop is
recommended.

Plant Diseases Detection: Plant diseases and pests detection is a very important research content
in the field of machine vision. It is a technology that uses machine vision equipment to acquire
images

11XI
Information Technology, PGMCOE,Wagholi. 11
Smart Crop And Fertilizer Prediction System

3. Project Statement

Farming is one of the major sectors that influences a country’s economic growth. In countries
like 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. In this project, I
present a website in which the following applications are implemented; Crop recommendation
and Fertilizer recommendation 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 excess
of and will recommend improvements.
To maximize the crop yield, selection of the appropriate crop that will be sown plays a vital role.
It depends on various factors like the type of soil and its composition, climate, geography of the
region, crop yield, market prices etc. Techniques like Artificial neural networks, K-nearest
neighbors and Decision Trees have carved a niche for themselves in the context of crop selection
which is based on various factors. Crop selection based on the effect of natural calamities like
famines has been done based on machine learning

12XII
Information Technology, PGMCOE,Wagholi. 12
Smart Crop And Fertilizer Prediction System

3.2 Project Scope

crop production history analysis, agricultural software is transforming the way farmers do their
jobs in a big way, allowing them to make better decisions and use less water, fertilizer, or
pesticide. As a result of big data, farmers can obtain timely information about pests and weed
outbreaks, allowing them to apply pesticides only once instead of multiple times during the
growing season. Crop management software impacts all aspects of agriculture. It spans the entire
spectrum of farm yield optimization, food safety management, supply chain visibility, and global
trade policy analysis; to animal welfare policy. It has all been accomplished using machine
learning algorithms to identify at-risk animals early enough to monitor their health, based on
predictive models mapping out potential sources of infection on cattle farms in Europe. The use
of agricultural software by farmers is aimed at increasing yield. Big data is a term used to
describe large datasets that are gathered from different sources, including satellites, sensors on
tractors, and livestock tags. These datasets provide a great deal of information about agricultural
production without requiring extensive manual labor.

3.3 Life cycle of project

Waterfall model is sequential approach, where each fundamental activity of a process


represented as a separate phase, arranged in linear order. In a waterfall model, you must plan and
schedule of all the activities before starting, working on them. The waterfall model is a
sequential design process, used in a software development process on which progress is seen as
flowing steadily downwards through the phases of Conception, Initiation, Analysis, Design,
Construction, Testing, Production/Implementation and Maintenance. The waterfall development
model originates in the manufacturing and construction industries: highly structures physical
environments in which after-the-fact changes are prohibitively costly, if not impossible. Since no
formal software development methodologies existed at the time, this hardware-oriented model
was simply adapted for software development.

13XIII Technology, PGMCOE,Wagholi.


Information 13
Smart Crop And Fertilizer Prediction System

Diagram:

Analysis

Design

Impleme
ntation

Testing

Deploy
ment

Mainten
ance

3.4 System Study

3.4.1 Feasibility Study

The feasibility of the project is analyzed in this phase and business proposal is put
forth with a very general plan for the project and some cost estimates. During system analysis
the feasibility study of the proposed system is to be carried out. This is to ensure that the
proposed system is not a burden to the company. For feasibility analysis, some
understanding of the major requirements for the system is essential.

Three key considerations involved in the feasibility analysis are

3.4.1 Economical Feasibility


3.4.2 Technical Feasibility
3.4.3 Social Feasibility

14XIV Technology, PGMCOE,Wagholi.


Information 14
Smart Crop And Fertilizer Prediction System

3.4.1 Economical Feasibility


This study is carried out to check the economic impact that the system will have on the
organization. The amount of fund that the company can pour into the research and development
of the system is limited. The expenditures must be justified. Thus the developed system as well
within the budget and this was achieved because most of the technologies used are freely
available. Only the customized products had to be purchased.

3.4.2 Technical Feasibility

This study is carried out to check the technical feasibility, that is, the technical requirements of
the system. Any system developed must not have a high demand on the available technical
resources. This will lead to high demands on the available technical resources. This will lead to
high demands being placed on the client. The developed system must have a modest
requirement, as only minimal or null changes are required for implementing this system.

3.4.3 Social Feasibility

The aspect of study is to check the level of acceptance of the system by the user. This includes
the process of training the user to use the system efficiently. The user must not feel threatened by
the system, instead must accept it as a necessity. The level of acceptance by the users solely
depends on the methods that are employed to educate the user about the system and to make him
familiar with it. His level of confidence must be raised so that he is also able to make some
constructive criticism, which is welcomed, as he is the final user of the system.

3.5 Objectives

Agriculture is a business with risk and reliable crop yield prediction is vital for decisions related
to agriculture risk management.
The vision of meeting the world's food demands for the increasing population throughout the
world is becoming more important in these recent years.
Eventually, it helps in achieving ZERO hunger.
Predictions could be used by crop managers to minimize losses when unfavorable conditions
may occur.

15XV
Information Technology, PGMCOE,Wagholi. 15
Smart Crop And Fertilizer Prediction System

3.6 Project Goal

The project goal is the highest ultimate objective toward which the project is expected to
contribute. The project goal is the broad overall strategic orientation to which the project will
contribute and should be consistent with the strategic plans of the organization. It provides the
strategic rationale behind the project and describes the long-term impact of the project, e.g.,
increased shareholder value.
Many distinct projects can have the same goal. It is desirable that only one goal is stated or the
project will risk being unfocused.

3.7 Project Purpose

The purpose is the primary reason for undertaking the project. This is the critical objective,
because it involves consideration of the project's degree of influence. The purpose is the intended
near term outcome—effect or impact—as a result of utilizing the project's outputs and is often
described in terms of a beneficial change. Consequently, it is frequently a soft objective, i.e.,
cannot be felt or touched. The project purpose provides the means toward the project goal and
determines the required project outputs. The successful achievement of the project's purpose can
be measured in terms of how well the project's product satisfies users' needs. A project should
ideally have only one purpose, otherwise efforts become diffused and one purpose is easier for
determining the project outputs.

3.8 Dataset :

This data set will contribute toward development and deployment of machine learning–based
automated plant disease classification algorithms to ultimately realize fast and accurate disease
detection. We will continue to add images to the pilot data set for a larger, more comprehensive
expert-annotated data set for future Kaggle competitions and to explore more advanced methods
for disease classification and quantification.
We have manually captured 3651 high-quality, real-life symptom images of multiple apple foliar
diseases, with variable illumination, angles, surfaces, and noise. A subset of images, expert-
annotated to create a pilot data set for apple scab, cedar apple rust, and healthy leaves, was made
available to the Kaggle community .

16XVI Technology, PGMCOE,Wagholi.


Information 16
Smart Crop And Fertilizer Prediction System

learning model to classify disease categories and develop an algorithm for disease severity
quantification. The top three area under the ROC curve (AUC) values submitted to the private
leaderboard were 0.98445, 0.98182, and 0.98089. We also trained an off-the-shelf convolutional
neural network on this data for disease classification and achieved 97% accuracy on a held-out
test set.

3.8.1 Crop Prediction Dataset


To Predict the particular crop to be grown , we use input parameters like N,P,K temperature,
humidity and rainfall. Crop prediction process being with the loading the external crop datasets.
Once the dataset read then+ pre-processing will be done by various stages as discussed in Data
Pre-processing section. After the data pre-processing, train the models using KNN, Random
Forest classifier into training dataset. . For a prediction of the crop, we consider a various factor
such as temperature, humidity, soil PH and predicted rainfall. Those are the input parameter for a
system that can be entered by manually or taken from the sensors. Predicted rainfall and input
parameter values will be appended in a list.
A Summarized Crop prediction model along with its input parameters are tabularized as follows:
This dataset was built by augmenting datasets of rainfall, climate and fertilizer data available for
India.
Data fields -
1. N - ratio of Nitrogen content in soil
2. P - ratio of Phosphorus content in soil
3. K - ratio of Potassium content in soil
4. temperature - temperature in degree Celsius
5. humidity - relative humidity in %
6. ph - ph value of the soil
7. rainfall - rainfall in mm

N P K Temparature Humidity Rainfall Crop


90 42 43 20.87 82.00 202 rice
85 58 41 21.77 80.31 226 rice
60 55 44 23.00 82.32 263 rice

74 35 40 26.49 80.15 242 rice

17XVII Technology, PGMCOE,Wagholi.


Information 17
Smart Crop And Fertilizer Prediction System

3.8.2 Fertilizer Prediction Dataset:


Fertilizer Recommendation can be done using fertilizer data, crop and location data. In this part
suitable crops and required fertilizer for each crop is recommended. Third Party applications are
used to display Weather information, Temperature information as well as Humidity,
Atmospheric Pressure and overall description.

N P K Temparature Humidity Rainfall Crop

90 42 43 20.87 82.00 202 rice

85 58 41 21.77 80.31 226 rice

60 55 44 23.00 82.32 263 rice

74 35 40 26.49 80.15 242 rice

3.9 Performance Evaluation Table

Performance Evaluation Table

Nitrogen Phosphorus Potassium CropName Accuracy


86 6.30 210 Sunflower 92.02%
82 4.78 303 Onion 93.54%
79 0.10 317 Guava 89.06%
60 5.60 155 Sugarcane 93.89%
76 3.70 456 Grapes 91.31%
93 4.50 204 Banana 94.38%
71 4.30 235 Cholam 94.52%
42 4.90 240 Greengram 91.17%
79 4.00 322 Mango 92.69%
65 4.20 190 Kidney beans 88.78%
71 6.30 225 Gingelly 93.07%
79 4.00 266 Ragi 92.33%
75 6.80 227 Cotton 94.90%
76 4.00 357 Bajra 92.16%
78 3.60 345 Tomato 93.14%
58 4.20 154 Groundnut 90.16%

18XVIII Technology, PGMCOE,Wagholi.


Information 18
Smart Crop And Fertilizer Prediction System

4. RESEARCH METHODOLOGY

4.1 Interpret inputs for the Projects

The input design is the link between the information system and the user. It comprises the
developing specification and procedures for data preparation and those steps are necessary to put
transaction data in to a usable form for processing can be achieved by inspecting the computer to
read data from a written or printed document or it can occur by having people keying the data
directly into the system. The design of input focuses on controlling the amount of input required,
controlling the errors, avoiding delay, avoiding extra steps and keeping the process simple. The
input is designed in such a way so that it provides security and ease of use with retaining the
privacy. Input Design considered the following things:

What data should be given as input?


How the data should be arranged or coded?
The dialog to guide the operating personnel in providing input.
Methods for preparing input validations and steps to follow when error occur.

1. Input Design is the process of converting a user-oriented description of the input into a
computer-based system. This design is important to avoid errors in the data input process and
show the correct direction to the management for getting correct information from the
computerized system.
2. It is achieved by creating user-friendly screens for the data entry to handle large volume of
data. The goal of designing input is to make data entry easier and to be free from errors. The data
entry screen is designed in such a way that all the data manipulates can be performed. It also
provides record viewing facilities.
3. When the data is entered it will check for its validity. Data can be entered with the help of
screens. Appropriate messages are provided as when needed so that the user will not be in maize
of instant. Thus the objective of input design is to create an input layout that is easy to follow

19XIX Technology, PGMCOE,Wagholi.


Information 19
Smart Crop And Fertilizer Prediction System

1. PROJECT DESIGN

5.1 System Requirement Specification

5.1.1 Hardware Tools

Basic required storage capacity on the device, RAM usage (min 8 GB), and bandwidth are
enough. No other special hardwares is required for this project.

5.1.2 Software Tools

Operating System: Linux.


Internet Browser: Chrome(preferable), Mozilla Firefox, Internet Explorer.
Front-end: HTML 5, CSS, JavaScript, ReactJS.
IDE: Visual Studio CODE.
Backend: NodeJS ,Ganache, Truffle, ExpressJS, Redis

5.2 UML Diagrams

UML stands for Unified Modeling Language. UML is a standardized general-purpose modeling
language in the field of object-oriented software engineering. The standard is managed, and was
created by, the Object Management Group. The goal is for UML to become a common language
for creating models of object oriented computer software. In its current form UML is comprised
of two major components: a Meta-model and a notation. In the future, some form of method or
process may also be added to; or associated with, UML. The Unified Modeling Language is a
standard language for specifying, Visualization, Constructing and documenting the artifacts of
software system, as well as for business modeling and other non-software systems. The UML
represents a collection of best engineering practices that have proven successful in the modeling
of large and complex systems. The UML is a very important part of developing objects oriented
software and the software development process. The UML uses mostly graphical notations to
express the design of software projects.

20XX
Information Technology, PGMCOE,Wagholi. 20
Smart Crop And Fertilizer Prediction System

Simplifies complex software design, can also implement OOPs like a concept that is widely
used. It reduces thousands of words of explanation in a few graphical diagrams that may reduce
time consumption to understand.
It makes communication more clear and more real.
It helps to acquire the entire system in a view.
It becomes very much easy for the software programmer to implement the actual demand once
they have a clear picture of the problem.
Types of UML: The UML diagrams are divided into two parts:
Structural UML diagrams and Behavioral UML diagrams .

The Unified Modeling Language is a standard language for specifying, Visualization,


Constructing and documenting the artifacts of software system, as well as for business modeling
and other non-software systems. The UML represents a collection of best engineering practices
that have proven successful in the modeling of large and complex systems.

Goals:
1. The Primary goals in the design of the UML are as follows:
2. Provide users a ready-to-use, expressive visual modeling Language so that they can
develop and exchange meaningful models.
3. Provide extendibility and specialization mechanisms to extend the core concepts.
4. Be independent of particular programming languages and development process.
5. Provide a formal basis for understanding the modeling language.
6. Encourage the growth of OO tools market.
7. Support higher level development concepts such as collaborations, frameworks, patterns
and components.
8. Integrate best practices.

21XXI Technology, PGMCOE,Wagholi.


Information 21
Smart Crop And Fertilizer Prediction System

5.2.1 System Architecture

A system architecture is the conceptual model that defines the structure, behavior, and
more views of a system. An architecture description is a formal description and representation of
a system, organized in a way that supports reasoning about the structures and behaviors of the
system.
A system architecture can consist of system components and the sub-systems developed, that
will work together to implement the overall system. There have been efforts to formalize
languages to describe system architecture, collectively these are called architecture description
languages (ADLs).

22XXII Technology, PGMCOE,Wagholi.


Information 22
Smart Crop And Fertilizer Prediction System

5.2.2 Work-flow diagram

A workflow diagram (also known as a workflow) provides a graphic overview of the business
process. Using standardized symbols and shapes, the workflow shows step by step how your
work is completed from start to finish. It also shows who is responsible for work at what point in
the process. Designing a workflow involves first conducting a thorough workflow analysis,
which can expose potential weaknesses. A workflow analysis can help you define,
standardize and identify critical areas of your process.

Workflows are also useful to help employees understand their roles and the order in which work
is completed, and to create more unity within different departments. Originating from the
manufacturing industry, workflows are now used by a variety of industries—from government to
fi nance to commerce—and are easier than ever to create.

Fig. 5.2.1 : Work-flow diagram

23XXIII Technology, PGMCOE,Wagholi.


Information 23
Smart Crop And Fertilizer Prediction System

5.2.3 Data Flow diagram (Level 1)

The DFD is also called as bubble chart. It is a simple graphical formalism that can be used to
represent a system in terms of input data to the system, various processing carried out on this
data, and the output data is generated by this system.
The data flow diagram (DFD) is one of the most important modeling tools. It is used to model
the system components. These components are the system process, the data used by the process,
an external entity that interacts with the system and the information flows in the system.
DFD shows how the information moves through the system and how it is modified by a series of
transformations. It is a graphical technique that depicts information flow and the transformations
that are applied as data moves from input to output.
DFD is also known as bubble chart. A DFD may be used to represent a system at any level of
abstraction. DFD may be partitioned into levels that represent increasing information flow and
functional detail.

Fig. 5.2.2 : Data Flow diagram (Level 1)

5.2.3 Data Flow diagram (Level 2)

Fig. 5.2.2 : Data Flow diagram (Level 2)

24XXIV Technology, PGMCOE,Wagholi.


Information 24
Smart Crop And Fertilizer Prediction System

5.2.4 Use Case diagram


A use case diagram in the Unified Modeling Language (UML) is a type of behavioral diagram
defined by and created from a Use-case analysis. Its purpose is to present a graphical overview
of the functionality provided by a system in terms of actors, their goals (represented as use
cases), and any dependencies between those use cases. The main purpose of a use case diagram
is to show what system functions are performed for which actor. Roles of the actors in the system
can be depicted.
Firstly open the website ,we already prepare data set . User has select the option between crop
prediction ,fertilizer or Plant disease detection, after selecting choice

Crop Prediction-: user must have to put K,P,N and location value , in server side Grouping and
Labelling on Data set , Our training model construct best suitable result for that soil
Fertilizer Recommendation -: user must have to put K,P,N and crop value , in server side
Grouping and Labelling on Data set , Our training model construct best suitable Fertilizer
Plant Disease Detection -:User must have to put Image of crop after server will the disease info

Fig. 5.2.4 : Use Case Diagram

25XXV Technology, PGMCOE,Wagholi.


Information 25
Smart Crop And Fertilizer Prediction System

5.2.5 Sequence diagram

A sequence diagram in Unified Modeling Language (UML) is a kind of interaction


diagram that shows how processes operate with one another and in what order. It is a
construct of a Message Sequence Chart. Sequence diagrams are sometimes called event
diagrams, event scenarios, and timing diagrams. A sequence diagram is a type of
interaction diagram because it describes how—and in what order—a group of objects
works together. These diagrams are used by software developers and business
professionals to understand requirements for a new system or to document an existing
process.

Fig. 5.2.5 : Sequence diagram

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

5.2.6 Activity diagram

The basic purposes of activity diagrams is similar to other four diagrams. It captures the
dynamic behavior of the system. Other four diagrams are used to show the message flow
from one object to another but activity diagram is used to show message flow from one
activity to another. Activity is a particular operation of the system. Activity diagrams are
not only used for visualizing the dynamic nature of a system, but they are also used to
construct the executable system by using forward and reverse engineering techniques.
The only missing thing in the activity diagram is the message part.

It does not show any message flow from one activity to another. Activity diagram is
sometimes considered as the flowchart. Although the diagrams look like a flowchart, they
are not. It shows different flows such as parallel, branched, concurrent, and single. The
purpose of an activity diagram can be described as −

Draw the activity flow of a system.

Describe the sequence from one activity to another.

Describe the parallel, branched and concurrent flow of the system.

Activity diagrams are mainly used as a flowchart that consists of activities performed by
the system. Activity diagrams are not exactly flowcharts as they have some additional
capabilities.

Fig. 5.2.6 :Activity diagram

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

5.2.7 Waterfall Model

The Waterfall Model was the first Process Model to be introduced. It is also referred to as
a linear-sequential life cycle model. It is very simple to understand and use. In a waterfall
model, each phase must be completed before the next phase can begin and there is no
overlapping in the phases. The waterfall Model illustrates the software development
process in a linear sequential flow. This means that any phase in the development process
begins only if the previous phase is complete. In this waterfall model, the phases do not
overlap. Waterfall approach was first SDLC Model to be used widely in Software
Engineering to ensure success of the project. In "The Waterfall" approach, the whole
process of software development is divided into separate phases. In this Waterfall model,
typically, the outcome of one phase acts as the input for the next phase sequentially. The
Waterfall Model was the first Process Model to be introduced. It is also referred to as
a linear-sequential life cycle model. It is very simple to understand and use. In a waterfall
model, each phase must be completed before the next phase can begin and there is no
overlapping in the phases. The Waterfall model is the earliest SDLC approach that was
used for software development. The advantages of waterfall development are that it
allows for departmentalization and control. A schedule can be set with deadlines for each
stage of development and a product can proceed through the development process model
phases one by one. Development moves from concept, through design, implementation,
testing, installation, troubleshooting, and ends up at operation and maintenance. Each
phase of development proceeds in strict order.

The disadvantage of waterfall development is that it does not allow much reflection or
revision. Once an application is in the testing stage, it is very difficult to go back and
change something that was not well-documented or thought upon in the concept stage.

Fig. 5.2.7 :Waterfall Model diagram

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Requirement Gathering and analysis − All possible requirements of the system to be


developed are captured in this phase and documented in a requirement specification
document.

System Design − The requirement specifications from first phase are studied in this phase
and the system design is prepared. This system design helps in specifying hardware and
system requirements and helps in defining the overall system architecture.

Implementation − With inputs from the system design, the system is first developed in
small programs called units, which are integrated in the next phase. Each unit is
developed and tested for its functionality, which is referred to as Unit Testing.

Integration and Testing − All the units developed in the implementation phase are
integrated into a system after testing of each unit. Post integration the entire system is
tested for any faults and failures.

Deployment of system − Once the functional and non-functional testing is done; the
product is deployed in the customer environment or released into the market.

Maintenance − There are some issues which come up in the client environment. To fix
those issues, patches are released. Also to enhance the product some better versions are
released. Maintenance is done to deliver these changes in the customer environment

5.2.8 Collaboration diagram


The collaboration diagram is used to show the relationship between the objects in a
system. Both the sequence and the collaboration diagrams represent the same information
but differently. Instead of showing the flow of messages, it depicts the architecture of the
object residing in the system as it is based on object-oriented programming. An object
consists of several features. Multiple objects present in the system are connected to each
other. The collaboration diagram, which is also known as a communication diagram, is
used to portray the object's architecture in the system.

A collaboration diagram, also known as a communication diagram, is an illustration of the


relationships and interactions among software objects in the Unified Modeling Language
(UML). These diagrams can be used to portray the dynamic behavior of a particular use
case and define the role of each object.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Notations of a Collaboration Diagram

Following are the components of a component diagram that are enlisted below:

Objects: The representation of an object is done by an object symbol with its name and
class underlined separated by a colon.

Actors: In the collaboration diagram, the actor plays the main role as it invokes the
interaction. Each actor has its respective role and name. In this, one actor initiates the use
case.

Links: The link is an instance of association, which associates the objects and actors. It
portrays a relationship between the objects through which the messages are sent. It is
represented by a solid line. The link helps an object to connect with or navigate to another
object, such that the message flows are attached to links.

Messages: It is a communication between objects which carries information and includes


a sequence number, so that the activity may take place. It is represented by a labeled
arrow, which is placed near a link. The messages are sent from the sender to the receiver,
and the direction must be navigable in that particular direction. The receiver must
understand the message.

Fig. 5.9 : Collaboration diagram

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

5.2.9 Sequence Diagram

A sequence diagram is the most commused interaction diagram. Interaction diagram –


An interaction diagram is used to show the interactive behavior of a system. Since
visualizing the interactions in a system can be a cumbersome task, we use different types
of interaction diagrams to capture various features and aspects of interaction in a
system. Sequence Diagrams – A sequence diagram simply depicts interaction between
objects in a sequential order i.e. the order in which these interactions take place. We can
also use the terms event diagrams or event scenarios to refer to a sequence diagram.
Sequence diagrams describe how and in what order the objects in a system function. These
diagrams are widely used by businessmen and software developers to document and
understand requirements for new and existing systems.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.IMPLEMENTATION

6.1.1 Decision Tree:

The Decision Tree algorithm belongs to the family of supervised learning algorithms. The
goal of using a Decision Tree is to create a training model that can be used to predict the
class or value of the target variable by learning simple decision rules inferred from prior
data(training data). Decision Tree is a Supervised learning technique that can be used for
both classification and Regression problems, but mostly it is preferred for solving
Classification problems. It is a tree-structured classifier, where internal nodes represent the
features of a dataset, branches represent the decision rules and each leaf node represents
the outcome. In a Decision tree, there are two nodes, which are the Decision
Node and Leaf Node. Decision nodes are used to make any decision and have multiple
branches, whereas Leaf nodes are the output of those decisions and do not contain any
further branches.

The decisions or the test are performed on the basis of features of the given dataset.It is a
graphical representation for getting all the possible solutions to a problem/decision based
on given conditions. It is called a decision tree because, similar to a tree, it starts with the
root node, which expands on further branches and constructs a tree-like structure. In order
to build a tree, we use the CART algorithm, which stands for Classification and
Regression Tree algorithm. A decision tree simply asks a question, and based on the
answer (Yes/No), it further split the tree into subtrees.

Accuracy is 90.0 %

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.1.2 Gaussian Naive Bayes :

Gaussian Naive Bayes is a variant of Naive Bayes that follows Gaussian normal
distribution and supports continuous data.
Naive Bayes are a group of supervised machine learning classification algorithms based on
the Bayes theorem.
When working with continuous data, an assumption often taken is that the continuous
values associated with each class are distributed according to a normal (or Gaussian)
distribution. The likelihood of the features is assumed to be-
Sometimes assume variance
is independent of Y (i.e., σi),
or independent of Xi (i.e., σk)
or both (i.e., σ)
Gaussian Naive Bayes supports continuous valued features and models each as
conforming to a Gaussian (normal) distribution.
An approach to create a simple model is to assume that the data is described by a Gaussian
distribution with no co-variance (independent dimensions) between dimensions. This
model can be fit by simply finding the mean and standard deviation of the points within
each label, which is all what is needed to define such a distribution.
Accuracy is 99.09 %

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.1.3 Logistic Regression:

Logistic regression is basically a supervised classification algorithm. In a classification


problem, the target variable(or output), y, can take only discrete values for a given set of
features(or inputs), X.
Logistic regression is one of the most popular Machine Learning algorithms, which comes
under the Supervised Learning technique. It is used for predicting the categorical
dependent variable using a given set of independent variables.
Logistic regression predicts the output of a categorical dependent variable. Therefore the
outcome must be a categorical or discrete value. It can be either Yes or No, 0 or 1, true or
False,
etc. but instead of giving the exact value as 0 and 1, it gives the probabilistic values which
lie between 0 and 1.
Logistic Regression is much similar to the Linear Regression except that how they are
used. Linear Regression is used for solving Regression problems, whereas Logistic
regression is used for solving the classification problems.
In Logistic regression, instead of fitting a regression line, we fit an "S" shaped logistic
function, which predicts two maximum values (0 or 1).

Accuracy is 95.22 %

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.1.4 Random Forest

Random forest is a supervised learning algorithm. The "forest" it builds is an ensemble of


decision trees, usually trained with the “bagging” method. The general idea of the bagging
method is that a combination of learning models increases the overall result.
Fertilizer Recommendation can be done using fertilizer data, crop and location data. In this
part suitable crops and required fertilizer for each crop is recommended. Third Party
applications are
used to display Weather information, Temperature information as well as Humidity,
Atmospheric Pressure and overall description.
Random forest is a classifier that evolves from decision trees. It actually consists of many
decision trees. To classify a new instance, each decision tree provides a classification for
input data; random forest collects the classifications and chooses the most voted prediction
as the result. The input of each tree is sampled data from the original dataset. In addition, a
subset of features is randomly selected from the optional features to grow the tree at each
node

Accuracy is 99.09 %

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.1.5 XG Boost

Ever since its introduction in 2014, XGBoost has been lauded as the holy grail of machine
learning hackathons and competitions. From predicting ad click-through rates to
classifying high energy physics events, XGBoost has proved its mettle in terms of
performance – and speed.
I always turn to XGBoost as my first algorithm of choice in any ML hackathon. The
accuracy it consistently gives, and the time it saves, demonstrates how useful it is. But
how does it actually work? What kind of mathematics power XGBoost? We’ll figure out
the answers to these questions soon

The Power of XGBoost


The beauty of this powerful algorithm lies in its scalability, which drives fast learning
through parallel and distributed computing and offers efficient memory usage.

It’s no wonder then that CERN recognized it as the best approach to classify signals from
the Large Hadron Collider. This particular challenge posed by CERN required a solution
that would be scalable to process data being generated at the rate of 3 petabytes per year
and effectively distinguish an extremely rare signal from background noises in a complex
physical process. XGBoost emerged as the most useful, straightforward and robust
solution.

Now, let’s deep dive into the inner workings of XGBoost.

Why ensemble learning?


XGBoost is an ensemble learning method. Sometimes, it may not be sufficient to rely
upon the results of just one machine learning model. Ensemble learning offers a systematic
solution to combine the predictive power of multiple learners.
The models that form the ensemble, also known as base learners, could be either from the
same learning algorithm or different learning algorithms. Bagging and boosting are two
widely used ensemble learners. Though these two techniques can be used with several
statistical models, the most predominant usage has been with decision trees.]
Let’s briefly discuss bagging before taking a more detailed look at the concept of boosting.
XGBoost is a decision-tree-based ensemble Machine Learning algorithm that uses a
gradient boosting framework.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Accuracy is 99.31 %

Tree boosting is a highly effective and widely used machine learning method. In this
paper, we describe a scalable end to-end tree boosting system called XGBoost, which is
used widely by data scientists to achieve state-of-the-art results on many machine learning
challenges. We propose a novel sparsity-aware algorithm for sparse data and weighted
quantile sketch for approximate tree learning. More importantly, we provide insights on
cache access patterns, data
compression and sharding to build a scalable tree boosting system. By Combining these
insights, XGBoost scales beyond billions of examples using far fewer resources than
existing systems.
A scalable tree boosting system that is widely used by data scientists and provides state-of-
the-art results on many problems. We proposed a novel sparsity aware algorithm for
handling sparse data and a theoretically justified weighted quantile sketch for approximate
learning. Our experience shows that cache access patterns, data compression and sharding
are essential elements for building a scalable end-to-end system for tree boosting. These
lessons can be applied to other machine learning systems as well. By combining these
insights, XGBoost is able to solve real world scale problems using a minimal amount of
resources.
System Implementation
We implemented XGBoost as an open source package. The package is portable and
reusable. It supports various weighted classification and rank objective functions, as well

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

as user defined objective function. It is available in popular languages such as python, R,


Julia and integrates naturally with language native data science pipelines such as scikit
learn. The distributed version is built on top of the rabit library7 for all reduce. The
portability of XGBoost
makes it available in many ecosystems, instead of only being tied to a specific platform.
The distributed XGBoost runs natively on Hadoop, MPI Sun Grid engine. Recently, we
also enabled distributed XGBoost on jvm big data stacks such as Flink and Spark. The
distributed version has also been integrated into cloud platform Tianchi8 of Alibaba. We
believe that there will be more integrations in the future.

Why Does XGBoost Win “Every” Machine Learning Competition?

The number of terminal nodes and the depth of the tree can be seen as the complexity
measurement of tree models. In order to generalize the model, we can easily apply either a
complexity constraints on the complexity measurement or a penalization on the number of
terminal nodes or penalization of the leaf weights (used by XGBoost).
As learning the structure of the tree is NP-complete, the learning algorithms tend to
compute an approximate solution. There are many different learning algorithms, such as
CART (Classification And Regression Trees), C4.5 and CHAID. In the thesis, the author
describes the CART because MART uses CART, XGBoost also implements a Tree model
related to CART. CART grows the tree in a top-down fashion. By considering every split
parallel to the coordinate axes, CART chooses the split that minimizes the objective. In the
second step, CART consider
every split parallel within each regions. At the end of the iteration, the best split is chosen.
And CART will repeat all the steps till the stopping criterion.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.2 Modules
❖ Data Collection
❖ Dataset
❖ Data Preparation
❖ Model Selection
❖ Analyze and Prediction
❖ Accuracy on test set
❖ Saving the Trained Model

6.3 Modules Description:

6.3.1 Data Collection:


This is the first real step towards the real development of a machine learning model,
collecting data. This is a critical step that will cascade in how good the model will be, the
more and better data that we get, the better our model will perform.
There are several techniques to collect the data, like web scraping, manual interventions
and etc.

6.3.2 Data Preparation:


we will transform the data. By getting rid of missing data and removing some columns.
First we will create a list of column names that we want to keep or retain.Next we drop or
remove all columns except for the columns that we want to retain. Finally we drop or
remove the rows that have missing values from the data set.

6.3.3 Model Selection:


While creating a machine learning model, we need two dataset, one for training and other
for testing. But now we have only one. So let’s split this in two with a ratio of 80:20. We
will also divide the data frame into feature column and label column. Here we imported
train_test_split function of sklearn. Then use it to split the dataset. Also, test_size = 0.2, it
makes the split with 80% as train dataset and 20% as test dataset.
The random_state parameter seeds random number generator that helps to split the dataset.
The function returns four datasets. Labelled them as train_x, train_y, test_x, test_y. If we
see shape of this datasets we can see the split of dataset.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.3.4 Linear Regression:

In regression modeling, a target class is predicated on the independent features. This


method can be thus used to find out the relationship between independent and dependent
variables and also for forecasting. Linear regression a type of regression modeling is the
most usable statistical technique for predictive analysis in machine learning. Each
observation in linear regression depends on two values, one is the dependent variable and
the second is the independent variable. Linear regression determines a linear relationship
between these dependent and independent variables. There are two factors (x, y) that are
involved in linear regression analysis. The equation below shows how y is related to x
known as regression

6.3.5 Support Vector Machine

A support vector machine (SVM) is a type of supervised ML algorithm used for both
regression and classification. SVM regression being a non-parametric technique depends
on a set of mathematical functions. The set of functions called kernel transforms the data
inputs into the desired form. SVM solves the regression problems using a linear function,
so while dealing with problems of non-linear regression, it maps the input vector(x) to n-
dimensional space called a feature space (z). This mapping is done by non-linear mapping
techniques after that linear regression is applied to space. Putting the concept in ML
context with a multivariate training dataset (xn) with N number of observations with yn as
a set of observed responses. The linear function can be depicted as:

6.3.6 Mean Square Error:

Mean square error is another way to measure the performance of regression models [22].
MSE takes the distance of data points from the regression line and squaring them.
Squaring is necessary because it removes the negative sign from the value and gives more
weight to larger differences. The smaller mean squared error shows the closer you are to
finding the line of best fit.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.3.7 Naive BAYES algorithms:

Naïve Bayes model is used to resolve classification problems by using probability


techniques. The Naïve Bayes algorithm for this article can be denoted as equation
If ‘Class’ = Spam, the equation could be rewritten to find the spam email from the given
words, and this can be further simplified as equation
There are three types of Naïve Bayes algorithms: Multinomial, Gaussian and Bernoulli.
Multinomial Naïve Bayes algorithm has been selected to perform the spam email
identification because it is text related and outperforms Gaussian and Bernoulli.
Multinomial Naïve Bayes (MNB) classifier uses Multinomial Distribution for each given
feature, focusing on term frequency. The Multinomial Naïve Bayes can be denoted as
equation. In the equations, P(tk |p) is identified as the conditional probability for MNB.
The tk is the spam term occurrence within an email and P(p) is classed as the prior
probability. 1 and |V| are identified as the smoothing constant for the algorithm.
To test this algorithm, MNB module was loaded from the Scikit-learn library. The
parameters for this model are optional. If none is specified, the default values are: Alpha
value set to ‘1.0’, Fit Prior is set to ‘True’ and Class Prior is set to ‘None’ .
The algorithm-1 shows the pseudocode for Multinomial Naïve Bayes with spam
classification where ‘‘Tr’’ is Training and ‘‘Te’’ is Testing. The P(ˆ tk |p) is the
estimating/predicting variable, also known as the conditional probability.
For future prediction we used Random Forest regression Random Forest is one of the most
powerful methods that is used in machine learning for regression problems. The random
forest comes in the category of the supervised regressor algorithm. This algorithm is
carried out in two different stages the first one deals with the creation of the forest of the
given dataset, and the other one deals with the prediction from the regressor.

6.3.8 Saving the Trained Model


Once you’re confident enough to take your trained and tested model into the production-
ready environment, the first step is to save it into a .pkl file using a library like pickle .
Make sure you have pickle installed in your environment.
Next, let’s import the module and dump the model into . pkl file

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.4 Requirement Specification and Analysis

6.4.1 Problem Definition


Currently there is no such a system to find out crops and their disease so farmers get lost in
farming and there is not a proper gaudiness to farmer to take which crop in that weather.
Our system will easily find out the crop by using image processing concepts and machine
learning concepts. We are collecting soil data sets to find crops.

6.4.2 Risk Management

The risks for the Project can be analysed within the constraints of time and quality

Impact

ID Risk Description Probability


Schedule Quality Overall

1 Domain knowledge Low Low High High


Technology will not Meet
2 Expectations Low High High High
Lack of Development
3 Experience Medium High High High
Poor Quality
4 Documentation Low Low Low Low
Deviation from Software
5 Engineering Standards High Low High High
6 Poor Comments in Code Low Low Medium Medium

7 Changes in Requirements Medium High High High

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Probability Value Description

High Probability of occurrence is > 75%

Medium Probability of occurrence is 26 -75%


Low Probability of occurrence is < 25%

Table: Risk Probability definitions

Impact Value Description

Very high > 10% Schedule impact or Unacceptable quality

High 5 -10% Schedule impact or Some parts of the project have low
Quality

Schedule impact or barely noticeable degradation in


quality Low Impact on schedule or Quality can be
Medium < 5% incorporated

Table: Risk Impact definitions

6.4.3 Risk Mitigation, Monitoring, Management

A risk management strategy can be defined as a software project plan or the risk
management steps. It can be organized into a separate Risk Mitigation, Monitoring and
Management Plan. The RMMM plan documents all work performed as part of risk
analysis and is used by the project manager as part of the overall project plan.

Teams do not develop a formal RMMM document. Rather, each risk is documented
individually using a risk information sheet. In most cases, the RIS is maintained using a
database system, so that creation and information entry, priority ordering, searches, and
other analysis may be accomplished easily.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Once RMMM has been documented and the project has begun, risk mitigation and
monitoring steps commence. As we have already discussed, risk mitigation is a problem
avoidance activity. Risk monitoring is a project tracking activity with three primary
objectives:

(1) to assess whether predicted risks occur.

(2) to ensure that risk aversion steps defined for the risk are being properly applied; and

(3) to collect information that can be used for future risk analysis.

Effective strategy must consider three issues:

risk avoidance

risk monitoring

risk management and contingency planning. Proactive approach to risk – avoidance


strategy. Develop risk mitigation plan. Develop a strategy to mitigate this risk for reducing
turnover. Meet with current staff to determine causes for turnover. Mitigate those causes
that are under our control before the project starts.

Organize project teams so that information about each development activity is widely
dispersed. Define documentation standards and establish mechanisms to be sure that
documents are developed in a timely manner. Project manager monitors for likelihood of
risk, Project manager should monitor the effectiveness of risk mitigation steps. Risk
management and contingency planning assumes that mitigation efforts have failed and that
the risk has become a reality. RMMM steps incur additional project cost.

6.4.4 THE RMMM PLAN

Risk Mitigation, Monitoring and Management Plan (RMMM) – documents all work
performed as part of risk analysis and is used by the project manager as part of the overall
project plan.RIS is maintained using a database system, so that creation and information
entry, priority ordering, searches, and other analysis may be accomplished easily. Risk
monitoring is a project tracking activity

Three primary objectives:

• assess whether predicted risks do, in fact, occur

• ensure that risk aversion steps defined for the risk are being properly applied

• collect information that can be used for future risk analysis.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Following are the details for each risk.

Risk Category Probability Impact RMMM


plan
(Solution
)
Computer Crash Technical Issue 59% High S2
Late Delivery Business issue 38 % Medium S6
Technology will not Meet Technology risk 25 % Low S1, S5
Expectations
End Users Resist System Business issue 30 % Low S2, S4
Changes in Requirements Product size risk 40 % Medium S6
Lack of Development Technical Issue 20 % Low S1
Experience
Lack of Database Stability Technical Issue 60 % High S5, S1
Poor Quality Documentation Business issue 35 % Medium S5
Deviation from Software Process risk 12 % Low S3
Engineering Standards

Table: Overview of Risk Mitigation, Monitoring, Management

6.4.5 Risk Identification

Risk identification is the process of determining risks that could potentially prevent thepro
gram, enterprise, or investment from achieving its objectives. It includes documenting
and communicating the concern. The risk identification function should not be left
to chance but should be explicitly covered in a number of project documents:

• Statement of work (SOW)

• Work breakdown structure (WBS)

• Budget

• Schedule

• Acquisition plan, and

• Execution plan

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.4.6 Risk Analysis

Risk analysis is the process of defining and analysing the dangers to individuals, business
and government agencies posed by potential natural and human-caused averments events.
In IT, a risk analysis report can be used to align technology-related objectives with a
company’s business objection. Risk Analysis is a process that helps you identify and
manage potential problems that could undermine key business initiatives or projects.

To carry out a Risk Analysis, you must first identify the possible threats that you face, and
then estimate the likelihood that these threats will materialize.

Risk Analysis can be complex, as you’ll need to draw on detailed information such as
project plans, financial data, security protocols, marketing forecasts, and other relevant
information. However, it’s an essential planning tool, and one that could save time,
money, and reputations. To carry out a risk analysis, follow these steps:

1. Identify Threats

2. Estimate Risk

6.5 System Testing

The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub assemblies, assemblies and/or a finished product It is the
process of exercising software with the intent of ensuring that the
Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a specific
testing requirement.

6.6 Types Of Tests

6.6.1Unit testing
Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program inputs produce valid outputs. All decision branches

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

and internal code flow should be validated. It is the testing of individual software units of
the application .it is done after the completion of an individual unit before integration. This
is a structural testing, that relies on knowledge of its construction and is invasive. Unit
tests perform basic tests at component level and test a specific business process,
application, and/or system configuration. Unit tests ensure that each unique path of a
business process performs accurately to the documented specifications and contains
clearly defined inputs and expected results.

How we used it?


1. First, it initializes a small piece of an application it wants to test (also known as the system
under test, or SUT), then it applies some stimulus to the system under test (usually by
calling a method on it), and finally, it observes the resulting behavior.

6.6.2 Integration testing


Integration tests are designed to test integrated software components to determine if they
actually run as one program. Testing is event driven and is more concerned with the basic
outcome of screens or fields. Integration testsdemonstrate that although the components
were individually satisfaction, as shown by successfully unit testing, the combination of
components is correct and consistent. Integration testing is specifically aimed at exposing
the problems that arise from the combination ofcomponents.

How we used it?


2. Write a test plan.
3. Create test cases and use cases.
4. Run tests after unit integration.
5. Detect errors.
6. Retest the functionality after bug fixing.
7. Repeat the testing cycle until all bugs are fixed.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.6.3 Functional test


Functional tests provide systematic demonstrations that functions tested are available as
specified by the business and technical requirements, system documentation, and user
manuals.
Functional testing is centered on the following items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be exercised.
Systems/Procedures: interfacing systems or procedures must be invoked.

How we used it?


Organization and preparation of functional tests is focused on requirements, key functions, or
special test cases. In addition, systematic coverage pertaining to identify Business process
flows; data fields, predefined processes, and successive processes must be considered for
testing. Before functional testing is complete, additional tests are identified and the effective
value of current tests is determined.

6.6.4 System Test


System testing ensures that the entire integrated software system meets requirements. It tests
a configuration to ensure known and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based on process descriptions
and flows, emphasizing pre-driven process links and integration points.

6.6.5 White Box Testing


White Box Testing is a testing in which in which the software tester has knowledge of the
inner workings, structure and language of the software, or at least its purpose. It is purpose. It
is used to test areas that cannot be reached from a black box level.

How we used it?


Step 1: Identify the feature, component, program to be tested. ...
Step 2: Plot all possible paths in a flowgraph. ...

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Step 3: Identify all possible paths from the flowgraph. ...


Step 4: Write Test Cases to cover every single path on the flowgraph. ...
Step 5: Execute, rinse, repeat.

6.6.6 Black Box Testing


Black Box Testing is testing the software without any knowledge of the inner workings,
structure or language of the module being tested. Black box tests, as most other kinds of tests,
must be written from a definitive source document, such as specification or requirements
document, such as specification or requirements document. It is a testing in which the
software under test is treated, as a black box .you cannot “see” into it.
The test provides inputs and responds to outputs without considering how the software
works.

How we used it?


1. Examine and understand the requirements and specifications of the software application.
2. Identify valid and invalid inputs with expected outputs in order to check that the system
detects them properly.
3. Create test cases with different test scenarios and inputs.

6.6.7 Test strategy and approach


Field testing will be performed manually and functional tests will be written in detail.

6.6.8 Test objectives


All field entries must work properly.
Pages must be activated from the identified link.
The entry screen, messages and responses must not be delayed.

6.6.9 Features to be tested


Verify that the entries are of the correct format
No duplicate entries should be allowed
All links should take the user to the correct page.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.10 Integration Testing

Software integration testing is the incremental integration testing of two or more integrated
software components on a single platform to produce failures caused by interface defects.
The task of the integration test is to check that components or software applications, e.g.
components in a software system or – one step up – software applications at the company
level – interact without error.
Test Results: All the test cases mentioned above passed successfully. No defects
encountered.

6.11 Acceptance Testing


User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional
requirements.
Acceptance Testing is a method of software testing where a system is tested for acceptability.
The major aim of this test is to evaluate the compliance of the system with the business
requirements and assess whether it is acceptable for delivery or not.

Test Results: All the test cases mentioned above passed successfully. No defects
encountered

6.12 Advantages

Achieving the maximum crop at minimum yield is the ultimate Aim of the project.
Early detection of problems and management of those problems can help the farmers for
better crop yield.For the better understanding of the crop yield.

6.13 Disadvantage

The obtained result for the crop yield prediction using gives less accuracy when
compared to Gaussian naïve Bayes, Random Forest and Decision tree.
Previously yield was predicted on the basis of the farmers prior experience but now
weather conditions may change drastically so they cannot guess the yield.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.14 Code:

# Importing essential libraries and modules

from flask import Flask, render_template, request, Markup

import numpy as np

import os

import pandas as pd

from utils.disease import disease_dic

from utils.fertilizer import fertilizer_dic

import requests

import config

import pickle

import io

import torch

from torchvision import transforms

from PIL import Image

from utils.model import ResNet9

#
==================================================================
============================

# LOADING THE TRAINED MODELS

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

# Loading plant disease classification model

disease_classes = ['Apple Apple_scab',

'Apple Black_rot',

'Apple Cedar_apple_rust',

'Apple healthy',

'Blueberry healthy',

'Cherry_(including_sour) Powdery_mildew',

'Cherry_(including_sour) healthy',

'Corn_(maize) Cercospora_leaf_spot Gray_leaf_spot',

'Corn_(maize) Common_rust_',

'Corn_(maize) Northern_Leaf_Blight',

'Corn_(maize) healthy',

'Grape Black_rot',

'Grape Esca_(Black_Measles)',

'Grape Leaf_blight_(Isariopsis_Leaf_Spot)',

'Grape healthy',

'Orange Haunglongbing_(Citrus_greening)',

'Peach Bacterial_spot',

'Peach healthy',

'Pepper,_bell Bacterial_spot',

'Pepper,_bell healthy',

'Potato Early_blight',

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

'Potato Late_blight',

'Potato healthy',

'Raspberry healthy',

'Soybean healthy',

'Squash Powdery_mildew',

'Strawberry Leaf_scorch',

'Strawberry healthy',

'Tomato Bacterial_spot',

'Tomato Early_blight',

'Tomato Late_blight',

'Tomato Leaf_Mold',

'Tomato Septoria_leaf_spot',

'Tomato Spider_mites Two-spotted_spider_mite',

'Tomato Target_Spot',

'Tomato Tomato_Yellow_Leaf_Curl_Virus',

'Tomato Tomato_mosaic_virus',

'Tomato healthy']

disease_model_path = 'models/plant_disease_model.pth'

disease_model = ResNet9(3, len(disease_classes))

disease_model.load_state_dict(torch.load(

disease_model_path, map_location=torch.device('cpu')))

disease_model.eval()

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

# Loading crop recommendation model

crop_recommendation_model_path = 'models/RandomForest.pkl'

crop_recommendation_model = pickle.load(

open(crop_recommendation_model_path, 'rb'))

#
==================================================================
=======================

# Custom functions for calculations

def weather_fetch(city_name):

"""

Fetch and returns the temperature and humidity of a city

:params: city_name

:return: temperature, humidity

"""

api_key = config.weather_api_key

base_url = "http://api.openweathermap.org/data/2.5/weather?"

complete_url = base_url + "appid=" + api_key + "&q=" + city_name

response = requests.get(complete_url)

x = response.json()

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

if x["cod"] != "404":

y = x["main"]

temperature = round((y["temp"] - 273.15), 2)

humidity = y["humidity"]

return temperature, humidity

else:

return None

def predict_image(img, model=disease_model):

"""

Transforms image to tensor and predicts disease label

:params: image

:return: prediction (string)

"""

transform = transforms.Compose([

transforms.Resize(256),

transforms.ToTensor(),

])

image = Image.open(io.BytesIO(img))

img_t = transform(image)

img_u = torch.unsqueeze(img_t, 0)

# Get predictions from model

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

yb = model(img_u)

# Pick index with highest probability

_, preds = torch.max(yb, dim=1)

prediction = disease_classes[preds[0].item()]

# Retrieve the class label

return prediction

#
==================================================================
=============================

# FLASK APP

app = Flask( name )

# render home page

@ app.route('/')

def home():

title = 'Agri-Tools'

return render_template('index.html', title=title)

# render crop recommendation form page

@ app.route('/crop-recommend')

def crop_recommend():

title = 'Agri-Tools - Crop Recommendation'

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

return render_template('crop.html', title=title)

# render fertilizer recommendation form page

@ app.route('/fertilizer')

def fertilizer_recommendation():

title = 'Agri-Tools - Fertilizer Suggestion'

return render_template('fertilizer.html', title=title)

# render disease prediction input pag

#
==================================================================
=============================

# RENDER PREDICTION PAGES

# render crop recommendation result page

@ app.route('/crop-predict', methods=['POST'])

def crop_prediction():

title = 'Agri-Tools - Crop Recommendation'

if request.method == 'POST':

N = int(request.form['nitrogen'])

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

P = int(request.form['phosphorous'])

K = int(request.form['potassium'])

ph = float(request.form['ph'])

rainfall = float(request.form['rainfall'])

# state = request.form.get("stt")

city = request.form.get("city")

if weather_fetch(city) != None:

temperature, humidity = weather_fetch(city)

print(temperature, humidity)

data = np.array([[N, P, K, temperature, humidity, ph, rainfall]])

my_prediction = crop_recommendation_model.predict(data)

final_prediction = my_prediction[0]

return render_template('crop-result.html', prediction=final_prediction, title=title)

else:

return render_template('try_again.html', title=title)

# render fertilizer recommendation result page

@ app.route('/fertilizer-predict', methods=['POST'])

def fertilizer_recommend():

title = 'Agri-Tools - Fertilizer Suggestion'

crop_name = str(request.form['cropname'])

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

N = int(request.form['nitrogen'])

P = int(request.form['phosphorous'])

K = int(request.form['potassium'])

# ph = float(request.form['ph'])

df = pd.read_csv('data/fertilizer.csv')

nr = df[df['Crop'] == crop_name]['N'].iloc[0]

pr = df[df['Crop'] == crop_name]['P'].iloc[0]

kr = df[df['Crop'] == crop_name]['K'].iloc[0]

n = nr - N

p = pr - P

k = kr - K

temp = {abs(n): "N", abs(p): "P", abs(k): "K"}

max_value = temp[max(temp.keys())]

if max_value == "N":

if n < 0:

key = 'NHigh'

else:

key = "Nlow"

elif max_value == "P":

if p < 0:

key = 'PHigh'

else:

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

key = "Plow"

else:

if k < 0:

key = 'KHigh'

else:

key = "Klow"

response = Markup(str(fertilizer_dic[key]))

return render_template('fertilizer-result.html', recommendation=response, title=title)

# render disease prediction result page

@app.route('/disease-predict', methods=['GET', 'POST'])

def disease_prediction():

title = 'Agri-Tools - Disease Detection'

if request.method == 'POST':

if 'file' not in request.files:

return redirect(request.url)

file = request.files.get('file')

if not file:

return render_template('disease.html', title=title)

try:

img = file.read()

prediction = predict_image(img)

prediction = Markup(str(disease_dic[prediction]))

return render_template('disease-result.html', prediction=prediction, title=title)

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

except:

pass

return render_template('disease.html', title=title)

#
==================================================================
=============================

if name == ' main ':

port = int(os.environ.get('PORT', 5000))

app.run(debug=True, host='0.0.0.0', port=port)

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

6.15 .Screeshots:

Screenshot 1:

This is user interface (UI) is there human users interact with a computer, website or
application menu driven interface get information about farming services. This is user
interface (UI) is there human users interact with a computer, website or application menu
driven interface get information about farming services.There are 3 option in our UI. Options
are Crop, Fertilizer, Disease. We can navigate to any of the options from here. We have
added some questions here to make our website more informative.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Screenshot 2:

Menu-Driven user can choose option from this list Crop,Fertilizer,Crop Disease.
Menu driven user can choose option from crop, fertilizer, disease. When we scroll down we
get second preview of UI where we have added our service. Here we have provided glimpse
of prediction by this 3 options

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Screenshot 3:

In this field user need to put data primary nutrients/soil nutrients that is NPK.Then we can
find out easily most suitable crop to grow in our farm.In this field user need to put data
primary nutrients/soil nutrients that is NPK.Then we can find out easily most suitable crop to
grow in our farm. When we click to crop, we get one form where we have to fill Nitrogen ,
Pottasium , Phosphorus, ph level, rainfall, state. Through this our project can make
prediction which crop should be suitable for that area.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Screenshot 4:

This is output chickpea crop user need to sowing in our farm from the soil nutrients.
In this Screenshot we are getting result/prediction after entering data in that form. Here we
have get result that we should grow chickpea. We have provided training dataset based on
that we are gettinh this prediction

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Screenshot 5:

In this field user need to fill up data(NPK) and which crop you want to grow in farm.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Screenshot 6:

This is output of fertilizer prediction suggestions to user how much soil nutrients (NPK) use
in your farm.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Screenshot 7:
User can find out which disease occurs has been from the plant image. User can find out
disease by image. We have to insert image and by that image it will predict about disease.
We have provided training dataset based on that this disease prediction will occur

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Screenshot 8:
In this screenshot after inserting image we are getting prediction. And also we are getting
suggestion which fertilizer we have to use to cure this disease. We are getting 3-4 lines
suggestion to cure disease and name of disease.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

7. SCHEDULE OF WORK

7.1 Project Schedule:

Project task set in the system following main tasks are considered:
1. Task 1(T1): Proposal of the system defining system flow and gathering of all information
related to it.

2. Task 2(T2): Gathering information about similar approaches

3. Task 3(T3): Mathematical model design for proposed system Mathematical model design
for verification of database transaction using set theory

4. Task 4(T4): UML diagrams formation, such as class dig., sequence dig., etc.

5. Task 5(T5): Installing all required software All required software will be installed and
classes will be defined

6. Task 6(T6): Preparation of input file Different inputs required are stored

7. Task 7(T7): Designing User Interface Task

8. Task 8(T8): Implementation of system

9. Task 9(T9): Analysis of the user interface and system

10. Task 10(T10): Corrective actions to be made in system.

7.2 System Engineering:

As this project is implemented by a group of 4-person, sequential designing method is used.


Waterfall model for software development is used.

Common methods for the diagnosis and detection of plant diseases include visual plant
disease estimation by human raters, microscopic evaluation of morphology features to
identify pathogens, as well as molecular, serological, and microbiological diagnostic
techniques

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

7.2.1 Task network:

Crop Prediction
and fertilizer
recommendation

T1. T3. Risk


T2. Planning T4. Modelling
Communication Managesment

T1.2
T1.1 Project T2.2. Project
Requirement T2.1. Estimating T4.1 Analysis T4.2 Desgin
Startup Gathering
Gathering

Here are the project tasks and their dependencies in this diagrammatic form.

T1: Communication

Software development process starts with the communication between customer and
developer. According to need of project, we gathered the requirements related to
project.Project requirements are collected in this activity. This framework activity is the main
focus of the project managers and stakeholders. This framework activity includes
communication and coordination with the clients.

T2: Planning

This framework action incorporates data about the technical work to be planned, risks to be
faced, resources needed for task completion, the decision of the milestone deadline to release
the product in production.

T3: Risk Management

It includes identifying the risks during project development and managing the risks which are
affecting the project development. Risk management means risk containment and mitigation.
First, you’ve got to identify and plan. Then be ready to act when a risk arises, drawing upon
the experience and knowledge of the entire team to minimize the impact to the project.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

T4: Designing

It Includes designing the modules and internal, external interfaces of the entire system.
Software design is the process of envisioning and defining software solutions to one or more
sets of problems. One of the main components of software design is
the software requirements analysis (SRA).

T5: Modelling

It includes detailed requirement analysis and project design. Modelling is the process of
developing abstract models of a system, with each model presenting a different view or
perspective of that system.

T6: Coding

It includes actual coding of the entire project. In this framework activity, the actual
development of the product begins with code construction and then testing to fix errors and
issues.

T7: Testing

Here all the modules are tested and bugs are discovered. The bugs are then corrected and
entire system is tested thoroughly. Testing is an investigation conducted to provide
stakeholders with information about the quality of the software product or service under test.

7.3 Project Requirements

7.3.1 Functional requirements


1. Stable internet connection.
2. Enough storage space to store and display information

7.3.2 Non-functional requirements


3. Usability
4. Legal or regulatory requirements

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

5. Reliability
6. Performance

7.3.3 Hardware requirements


Basic required storage capacity on the device, RAM usage (min 8 GB), and
bandwidth are enough. No other special hardwares is required for this project.

7.3.4 Software requirements


1. Operating System: Linux.
2. Internet Browser: Chrome(preferable), Mozilla Firefox, Internet Explorer.
3. Front-end: HTML 5, CSS, JavaScript, ReactJS.
4. IDE: Visual Studio CODE.
5. Backend: NodeJS ,Ganache, Truffle, ExpressJS, Redis

7.3.5 Software Environment

Python:
Python is a high-level, interpreted, interactive and object-oriented scripting language. Python
is designed to be highly readable. It uses English keywords frequently where as other
languages use punctuation, and it has fewer syntactical constructions than other languages.

Python is Interpreted − Python is processed at runtime by the interpreter. You do not need
to compile your program before executing it. This is similar to PERL and PHP.

Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.

Python is Object-Oriented − Python supports Object-Oriented style or technique of


programming that encapsulates code within objects.

Python is a Beginner's Language − Python is a great language for the beginner-level


programmers and supports the development of a wide range of applications from simple text
processing to WWW browsers to games.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

History of Python
Python was developed by Guido van Rossum in the late eighties and early nineties at the
National Research Institute for Mathematics and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68,
SmallTalk, and Unix shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under the GNU
General Public License (GPL).
Python is now maintained by a core development team at the institute, although Guido van
Rossum still holds a vital role in directing its progress.

Python Features
Python's features include −
Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax.
This allows the student to pick up the language quickly.

Easy-to-read − Python code is more clearly defined and visible to the eyes.

Easy-to-maintain − Python's source code is fairly easy-to-maintain.

A broad standard library − Python's bulk of the library is very portable and cross-platform
compatible on UNIX, Windows, and Macintosh.

Interactive Mode − Python has support for an interactive mode which allows interactive
testing and debugging of snippets of code.

Portable − Python can run on a wide variety of hardware platforms and has the same
interface on all platforms.

Extendable − You can add low-level modules to the Python interpreter. These modules
enable programmers to add to or customize their tools to be more efficient.

Databases − Python provides interfaces to all major commercial databases.

GUI Programming − Python supports GUI applications that can be created and ported to
many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and
the X Window system of Unix.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Scalable − Python provides a better structure and support for large programs than shell
scripting.

Apart from the above-mentioned features, Python has a big list of good features, few are
listed below −
It supports functional and structured programming methods as well as OOP.

It can be used as a scripting language or can be compiled to byte-code for building large
applications.

It provides very high-level dynamic data types and supports dynamic type checking.

It supports automatic garbage collection.

It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

Python is available on a wide variety of platforms including Linux and Mac OS X. Let's
understand how to set up our Python environment.
Getting Python
The most up-to-date and current source code, binaries, documentation, news, etc., is available
on the official website of Python https://www.python.org.
Windows Installation
Here are the steps to install Python on Windows machine.

Open a Web browser and go to https://www.python.org/downloads/.

Follow the link for the Windows installer python-XYZ.msifile where XYZ is the version you
need to install.

To use this installer python-XYZ.msi, the Windows system must support Microsoft Installer
2.0. Save the installer file to your local machine and then run it to find out if your machine
supports MSI.

Run the downloaded file. This brings up the Python install wizard, which is really easy to
use. Just accept the default settings, wait until the install is finished, and you are done.

The Python language has many similarities to Perl, C, and Java. However, there are some
definite differences between the languages.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

First Python Program


Let us execute programs in different modes of programming.
Interactive Mode Programming
Invoking the interpreter without passing a script file as a parameter brings up the following
prompt −

$ python

Python2.4.3(#1,Nov112010,13:34:43)

[GCC 4.1.220080704(RedHat4.1.2-48)] on linux2

Type"help","copyright","credits"or"license"for more information.

>>>

Type the following text at the Python prompt and press the Enter −

>>>print"Hello, Python!"

If you are running new version of Python, then you would need to use print statement with
parenthesis as in print ("Hello, Python!");. However in Python version 2.4.3, this produces
the following result −

Hello, Python!

Script Mode Programming


Invoking the interpreter with a script parameter begins execution of the script and continues
until the script is finished. When the script is finished, the interpreter is no longer active.
Let us write a simple Python program in a script. Python files have extension .py. Type the
following source code in a test.py file −

print"Hello, Python!"

We assume that you have Python interpreter set in PATH variable. Now, try to run this
program as follows −

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

$ python test.py

This produces the following result −

Hello, Python!

Flask Framework:
Flask is a web application framework written in Python. Armin Ronacher, who leads an
international group of Python enthusiasts named Pocco, develops it. Flask is based on
Werkzeug WSGI toolkit and Jinja2 template engine. Both are Pocco projects.
Http protocol is the foundation of data communication in world wide web. Different
methods of data retrieval from specified URL are defined in this protocol.

The following table summarizes different http methods −

Sr.No Methods & Description

1 GET

Sends data in unencrypted form to the server. Most common method.

2 HEAD

Same as GET, but without response body

3 POST

Used to send HTML form data to server. Data received by POST method is not
cached by server.

4 PUT

Replaces all current representations of the target resource with the uploaded
content.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

5 DELETE

Removes all current representations of the target resource given by a URL

By default, the Flask route responds to the GET requests. However, this preference can be
altered by providing methods argument to route() decorator.

In order to demonstrate the use of POST method in URL routing, first let us create an
HTML form and use the POST method to send form data to a URL.

Save the following script as login.html

<html>

<body>

<formaction="http://localhost:5000/login"method="post">

<p>Enter Name:</p>

<p><inputtype="text"name="nm"/></p>

<p><inputtype="submit"value="submit"/></p>

</form>

</body>

</html>

Now enter the following script in Python shell.

from flask importFlask, redirect,url_for, request

app=Flask( name )

@app.route('/success/<name>')

def success(name):

return'welcome %s'% name

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

@app.route('/login',methods=['POST','GET'])

def login():

ifrequest.method=='POST':

user=request.form['nm']

return redirect(url_for('success',name= user))

else:

user=request.args.get('nm')

return redirect(url_for('success',name= user))

if name ==' main ':

app.run(debug =True)

After the development server starts running, open login.html in the browser, enter name in
the text field and click Submit.

Form data is POSTed to the URL in action clause of form tag.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

http://localhost/login is mapped to the login() function. Since the server has received data
by POST method, value of ‘nm’ parameter obtained from the form data is obtained by −

user = request.form['nm']
It is passed to ‘/success’ URL as variable part. The browser displays a welcome message in
the window.

Change the method parameter to ‘GET’ in login.html and open it again in the browser. The
data received on server is by the GET method. The value of ‘nm’ parameter is now obtained
by −

User = request.args.get(‘nm’)
Here, args is dictionary object containing a list of pairs of form parameter and its
corresponding value. The value corresponding to ‘nm’ parameter is passed on to ‘/success’
URL as before.

What is Python?
Python is a popular programming language. It was created in 1991 by Guido van Rossum.
It is used for:
web development (server-side),
software development,
mathematics,

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

system scripting.
What can Python do?
Python can be used on a server to create web applications.
Python can be used alongside software to create workflows.
Python can connect to database systems. It can also read and modify files.
Python can be used to handle big data and perform complex mathematics.
Python can be used for rapid prototyping, or for production-ready software development.
Why Python?
Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs with fewer lines than some other
programming languages.
Python runs on an interpreter system, meaning that code can be executed as soon as it is
written. This means that prototyping can be very quick.

Python can be treated in a procedural way, an object-orientated way or a functional way.


The most recent major version of Python is Python 3, which we shall be using in this tutorial.
However, Python 2, although not being updated with anything other than security updates, is
still quite popular.
In this tutorial Python will be written in a text editor. It is possible to write Python in an
Integrated Development Environment, such as Thonny, Pycharm, Netbeans or Eclipse which
are particularly useful when managing larger collections of Python files.Python Syntax
compared to other programming languages
Python was designed to for readability, and has some similarities to the English language
with influence from mathematics.
Python uses new lines to complete a command, as opposed to other programming languages
which often use semicolons or parentheses.
Python relies on indentation, using whitespace, to define scope; such as the scope of loops,
functions and classes. Other programming languages often use curly-brackets for this
purpose.

Python Install
Many PCs and Macs will have python already installed.

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

To check if you have python installed on a Windows PC, search in the start bar for Python or
run the following on the Command Line (cmd.exe):
C:\Users\Your Name>python --version
To check if you have python installed on a Linux or Mac, then on linux open the command
line or on Mac open the Terminal and type:
python --version
If you find that you do not have python installed on your computer, then you can download it
for free from the following website: https://www.python.org/

Python Quickstart
Python is an interpreted programming language, this means that as a developer you write
Python (.py) files in a text editor and then put those files into the python interpreter to be
executed.
The way to run a python file is like this on the command line:
C:\Users\Your Name>python helloworld.py
Where "helloworld.py" is the name of your python file.
Let's write our first Python file, called helloworld.py, which can be done in any text editor.
helloworld.py
print("Hello, World!")
Simple as that. Save your file. Open your command line, navigate to the directory where you
saved your file, and run:
C:\Users\Your Name>python helloworld.py
The output should read:
Hello, World!
Congratulations, you have written and executed your first Python program.
The Python Command Line
To test a short amount of code in python sometimes it is quickest and easiest not to write the
code in a file. This is made possible because Python can be run as a command line itself.
Type the following on the Windows, Mac or Linux command line:
C:\Users\Your Name>python
From there you can write any python, including our hello world example from earlier in the
tutorial:
C:\Users\Your Name>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Type "help", "copyright", "credits" or "license" for more information.


>>> print("Hello, World!")
Which will write "Hello, World!" in the command line:
C:\Users\Your Name>python
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello, World!")
Hello, World!
Whenever you are done in the python command line, you can simply type the following to
quit the python command line interface:
exit()
Execute Python Syntax
As we learned in the previous page, Python syntax can be executed by writing directly in the
Command Line:
>>>print("Hello,World!")
Hello, World!
Or by creating a python file on the server, using the .py file extension, and running it in the
Command Line:
C:\Users\Your Name>python myfile.py

Python Indentations
Where in other programming languages the indentation in code is for readability only, in
Python the indentation is very important.
Python uses indentation to indicate a block of code.
Example
if 5 > 2:
print("Five is greater than two!")
Python will give you an error if you skip the indentation:
Example
if 5 > 2:
print("Five is greater than two!")
Comments
Python has commenting capability for the purpose of in-code documentation.
Comments start with a #, and Python will render the rest of the line as a comment:

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

Example
Comments in Python:
#This is a comment.
print("Hello, World!")
Docstrings
Python also has extended documentation capability, called docstrings.
Docstrings can be one line, or multiline.
Python uses triple quotes at the beginning and end of the docstring:
Example
Docstrings are also comments:
"""Thisis a multilinedocstring."""print("Hello, World!")

7.3.6 Action Plan:

Work Task Description Duration


Literature Search Related work done for conceptual data similarity 6 weeks

System analysis Critical analysis and comparison of technologies 4 weeks


studied and results achieved in research
Design and Planning Modeling and design and dataset searching or creation 8 weeks

Implementation Divided into phases


Phase A Implementation module 1 2 weeks
Phase B Implementation module 2 2 weeks
Phase C Implementation module 3 3 weeks
Phase D Implementation module 4 4 weeks

System Testing Test system quality, fix errors if any and 3 weeks
improve if needed. Test system for different datasets
Initial Report Prepare and upload Initial Report 2 weeks

Final Report Prepare and upload Initial Report 2 weeks

Information Technology, PGMCOE,Wagholi


Smart Crop And Fertilizer Prediction System

8. CONCLUSION

This project highlighted the limitations of current systems and their practical usage on yield
prediction. The web application includes multiple features that users can leverage for the
selection of a crop. The inbuilt predictor system helps the farmers to predict the yield of a given
crop. The inbuilt recommender system allows a user exploration of the possible crops and their
yield to make more educated decisions. XGBoost were implemented and tested on the given
datasets. Results indicate that XGBoost gives the best result.

9. REFERENCES

Information Technology, PGMCOE,Wagholi.


Smart Crop And Fertilizer Prediction System

1. S. M. PANDE, P. K. RAMESH, A. ANMOL, B. R. AISHWARYA, K. ROHILLA and


K. SHAURYA, "Crop Recommender System Using Machine Learning Approach," 2021
2. S. Bhanumathi, M. Vineeth and N. Rohit, "Crop Yield Prediction and Efficient use of
Fertilizers," 2020
3. C. P. Wickramasinghe, P. L. N. Lakshitha, H. P. H. S. Hemapriya, A. Jayakody and P. G.
N. S. Ranasinghe, "Smart Crop and Fertilizer Prediction System," 2019
4. Arun Kumar, Naveen Kumar, Vishal Vats, “Efficient Crop Yield Prediction Using
Machine Learning Algorithms”, International Research Journal of Engineering and
Technology (IRJET)- e-ISSN: 2395-0056, pISSN:2395-0072, Volume: 05 Issue: 06 |
June-2018
5. Nithin Singh & saurabh chaturvedi, “Weather Forecasting Using Machine Learning”,
2019 International Conference on Signal Processing and Communication (ICSC)
Volume: 05 | DEC-2019.
6. Aakash Parmar & Mithila Sompura, "Rainfall Prediction using Machine Learning", 2017
International Conference on (ICIIECS) at Coimbatore Volume: 3 | March 2017.
7. Sachee Nene & Priya, R “Prediction of Crop yield using Machine Learning”,
International Research Journal of Engineering and Technology (IRJET) Volume: 05
Issue: 02 | Feb-2018.
8. Ramesh Medar & Anand M. Ambekar, “Sugarcane Crop prediction Using Supervised
Machine Learning" published in International Journal of Intelligent Systems and
Applications Volume: 3 | August 2019.
9. Z. Ding, Y. Jia, and B. Zhou, ‘‘A review of microblog data mining research,’’ J. Comput.
Res. Develop., vol. 51, no. 4, pp. 691–706, 2014.
10. B. Wang, W. An, Y. Ma, and H. Xu, ‘‘Tag-based and pagerank-based recommendation
algorithms for important microblog users,’’ Comput. Sci., vol. 45, no. 2, pp. 276–279,
2018.
11. Y. Li, ‘‘Design and implementation of a product recommendation system based on
Taobao’s user reviews,’’ Ph.D. dissertation, School Comput. Sci. Technol., Jilin Univ.,
Changchun, China, 2015.

Information Technology, PGMCOE,Wagholi.


Smart Crop And Fertilizer Prediction System

12. Y. Song, ‘‘Algorithmic recommendation in the era of mobile internet– headlines as an


example,’’ Silicon Valley, vol. 5, no. 5, pp. 26–27, 2019
13. ‘‘Wide & deep learning for recommender systems,’’ in Proc. 1st Workshop Deep Learn.
Recommender Syst., Sep. 2016, pp. 7–10.

14. P. Covington, J. Adams, and E. Sargin, ‘‘Deep neural networks for YouTube
recommendations,’’ in Proc. 10th ACM Conf. Recommender Syst., Sep. 2016, pp. 191–
198.
15. J. Davidson, B. Livingston, D. Sampath, B. Liebald, J. Liu, P. Nandy, T. Van Vleet, U.
Gargi, S. Gupta, Y. He, and M. Lambert, ‘‘The YouTube video recommendation
system,’’ in Proc. 4th ACM Conf. Recommender Syst. (RecSys), 2010, pp. 293–296.

16. C. A. Gomez-Uribe and N. Hunt, ‘‘The Netflix recommender system,’’ ACM Trans.
Manage. Inf. Syst., vol. 6, no. 4, pp. 1–19, Jan. 2015.
17. S. Okura, Y. Tagami, S. Ono, and A. Tajima, ‘‘Embedding-based news recommendation
for millions of users,’’ in Proc. 23rd ACM SIGKDD Int. Conf. Knowl. Discovery Data
Mining, Aug. 2017, pp. 1933–1942.
18. S. Reddy, S. Nalluri, S. Kunisetti, S. Ashok, and B. Venkatesh, ‘‘Content based movie
recommendation system using genre correlation,’’ in Smart Intelligent Computing and
Applications. Singapore: Springer, 2019, pp. 391–397.

Information Technology, PGMCOE,Wagholi.

You might also like