Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore BLACKBOOK PART2

BLACKBOOK PART2

Published by Pratiksha Nikhare, 2020-12-15 18:26:37

Description: BLACKBOOK PART2

Search

Read the Text Version

Fig. 8 Use Case Diagram

Department of Information Technology, DJSCE Page 26 Crop Suitability Predictor 5.4 Sequence Diagram Sequence diagram, depicting the interaction between the user, application and admin is shown in Fig. 9.

Fig. 9 Sequence Diagram

Department of Information Technology, DJSCE Page 27 Crop Suitability Predictor 5.5 Interface Design On accessing the system first, the user is taken to the home page. The user is then asked to log in into the portal if already has an account or create a new account if he is visiting for the first time. After logging in, the farmer is taken to his dashboard, which is shown in Fig 10. Fig 11 represents farmer’s account, where he can input his location and his farmer’s soil attributes in order to get suitability predictions. Fig 12 represents admin’s account.

Fig. 10 Farmer’s Dashboard Department of Information Technology, DJSCE Page 28 Crop Suitability Predictor



Fig. 12 Admin’s account Fig. 11 Farmer’s account Crop Suitability Predictor Chapter 6 Implementation and Results Chapter 6 includes the snippets of the algorithms used to implement the various modules of the system. In addition to this, it also consists of the snapshots of the results obtained after successful implementation. 6.1 Implementation All implementations are carried out on Windows 10 having hardware configuration of Intel core i5 processor with 8GB internal RAM and 1.60GHz of CPU speed. 6.1.1 Rainfall Predictor A. Acquisition of Training Dataset

Fig. 13 shows a snippet of the dataset used for training the rainfall prediction model: Fig. 13 Screenshot of Rainfall Model’s Training Set Department of Information Technology, DJSCE Page 30 Crop Suitability Predictor B. Data Preprocessing The following algorithm was used to replace the missing values (.) by large numbers (-9999): df = pd.read_csv(r'C:/Users/Zeel/Desktop/AgroConsultant/rainfall_dataset.txt',encoding = \"ISO-8859- 1\",delimiter='|') df.fillna(-99999, inplace=True) C. L​ inear Regression from sklearn import preprocessing, cross_validation

from sklearn.linear_model import LinearRegression X= np.array(df.drop(['label','Frequency','Year'],axis=1)) X = preprocessing.scale(X) X_lately = X[-forecast_period:] X = X[:-forecast_period] df.dropna(inplace = True) y = np.array(df['label']) y = y[:-forecast_period] X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size = 0.2, random_state = 101) clf = LinearRegression(n_jobs = -1) #Makes CPU process in as many parallel jobs as possible clf.fit(X_train, y_train) accuracy = clf.score(X_test, y_test) forecast_y = clf.predict(X_lately)

Department of Information Technology, DJSCE Page 31 Crop Suitability Predictor 6.1.2 Crop Suitability Predictor A. Acquisition of Training Dataset Fig 14 shows a snippet of the dataset used for training the crop suitability model.

Fig. 14 Screenshot of Crop Suitability Predictor’s Training Dataset B. Data Preprocessing i. The following algorithm was used for performing data pre-processing in order to remove the missing values: dt = pd.read_csv(r'C:/Users/Zeel/Desktop/AgroConsultant/final_dataset.txt',encoding=\"ISO-8859 - 1\",delimiter=' ') dt = dt.replace(dt.iloc[0,4],'-9999') dt = dt.fillna('-9999') ii. The following algorithm was used for assigning class labels (for a particular crop, say Wheat): suit = dt['QWHEAT'] / dt['AWHEAT'] suit.fillna(0, inplace = True) np.ceil(suit)

suit = np.where(suit == 0, 0 , 1) print('WHEAT') dt['yWHEAT'] = suit The above code is repeated for each of the 20 crops used in the model. Department of Information Technology, DJSCE Page 32 Crop Suitability Predictor C. Machine Learning Algorithms After implementing all the four machine learning algorithms specified in the Proposed Approach (Chapter 3), the following accuracies were obtained: ALGORITHM ACCURACY (%) Decision Tree 90.20 K-NN 89.78 Random Forest 90.43 Neural Network 91.00 Table 9. Comparison of accuracies Clearly, Neural Network provided the highest accuracy percentage. Hence, we implemented the crop suitability predictor using Neural Network.

The code snippet of the same is given below: from sklearn.neural_network import MLPClassifier X= dt.loc[:,['DMS01','DMS02','DMS03','DMS04','DMS05','DMS06','DMS07','DMS08','DMS09','DMS 10' ,'DMS11','DMS12','DMS13','DMS14','DMS15','DMS16','DMS17','DMS18','DMS19','DMS2 0', 'DMAQ3', 'DMAQ2', 'DMAQ1','DMPH5','DMPH6','DMPH7','DMPH8', 'DMTS1', 'DMTS2', 'DMTS3', 'DMTS4', 'DMTS5', 'ALT', 'DSEA', 'LON', 'LAT', 'RNJAN', 'RNFEB', 'RNMAR', 'RNAPR', 'RNMAY', 'RNJUN', 'RNJUL', 'RNAUG', 'RNSEP', 'RNOCT', 'RNNOV', 'RNDEC', 'TNJAN', 'TNFEB', 'TNMAR', 'TNAPR', 'TNMAY', 'TNJUN', 'TNJUL', 'TNAUG', 'TNSEP', 'TNOCT', 'TNNOV', 'TNDEC']] y = dt.loc[:,['yRICE','yWHEAT','ySUGAR','yJOWAR','ySOY','yBAJRA','yTOBACCO','yMAIZE', 'yJUTE', 'ySUNFLOWER','yCOTTON','yGRNDNUT','ySESAME','yOPULS','yPOTATO','yTUR', 'yRAPESEED']] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state = 101) Department of Information Technology, DJSCE Page 33 Crop Suitability Predictor

nnclf = MLPClassifier(solver='adam', alpha=0.001, hidden_layer_sizes=(50,100,200), random_state=1, max_iter = 20000, learning_rate_init=0.001) nnclf.fit(X_train,y_train) nnscore = nnclf.score(X_test, y_test) 6.2 Results In this section, we will discuss the actual results obtained for each of the system features discussed in Chapter 3 (section 3.2). 6.2.1 User Portal 1. Login/Registration Page The application portal is name A​ groConsultant.​ All first time users must create a new account for themselves by entering their name, contact details, farm location, and farm size, as shown in Fig.15. They must also decide upon a unique username and secure password, which they will use for all subsequent log-in attempts. The log-in page is shown in Fig. 16.

Department of Information Technology, DJSCE Page 34 Fig. 15 AgroConsultant Registration Page Crop Suitability Predictor



Fig. 16 AgroConsultant Login Page 2. User Profile Fig 17. User Profile Page Crop Suitability Predictor A logged-in user can view and edit his personal details, and also add a profile picture by visiting the User Profile page, as illustrated in Fig. 17. 3. Predictor Model At the beginning of each sow season, the user (farmer) can avail the predictor model. For this, he must enter the following soil characteristics using the drop-down list provided on the predictor page (Fig. 18): • Type of Soil

• Aquifer Thickness • Top Soil Thickness • pH of Soil • Season (Kharif/Rabi) These soil characteristics of a farm land can be obtained from the soil report prepared by analysis labs. Fig. 18 Predictor Page Department of Information Technology, DJSCE Page 36

Crop Suitability Predictor Apart from the soil characteristics, the crop suitability predictor model also requires the farm location, in terms of latitude and longitude. Since we do not expect each individual farmer to know their precise latitude and longitude, we make use of Google’s Location API. On clicking the G​ et Farm Location ​button in Fig. 18, the user can fetch his current latitude and longitude, which is displayed below the button in Fig. 19. Furthermore, crop suitability predictor also requires rainfall (in mm). This is provided by the rainfall predictor model, which is called when the user clicks G​ et Rainfall Prediction button in Fig. 18. On the click of this button, the user’s registered farm location (state) is sent as an input to sub-system 2 (as specified in Chapter 3). The sub-system in turn returns 12 values, corresponding to the expected rainfall in that particular region. These 12 values are shown under the G​ et Rainfall Prediction b​ utton in Fig. 19.

Fig. 19 Predictor Page with Output of Location and Rainfall Model Once the user is done entering the soil characteristics, as well as fetching the farm location coordinates and rainfall values, he can then click the ​Submit b​ utton. On the click of thus button, he will get the prediction, as shown in Fig. 20. Department of Information Technology, DJSCE Page 37 Crop Suitability Predictor



Fig. 20 Output of Predictor Model 4. User Dashboard User’s dashboard is divided into 2 sub-sections. The first section contains information about those crops that the user selects from the output of the predictor model, that is, from Fig. 20. For instance, suppose he selects both Wheat and Tobacco from Fig. 20. Then, on the dashboard page, he will be able to see icons of both these crops, as shown in Fig. 21. Now, when he clicks on Wheat’s icon, he will be able to see various details about that crop, as shown in Fig. 22. Fig. 21 User’s Dashboard Crop Suitability Predictor

Fig. 22 Crop Information Sheet The second section of the User’s Dashboard page is a table, which lists out all the details about the crops previously grown by that user. 5. Map View

Fig. 23 Map View Department of Information Technology, DJSCE Page 39 Crop Suitability Predictor User can view the sow decisions of his neighboring farmers by visiting the Map View page. Here, pop-up markers are used to pin-point each farmer’s location. When a pop-up marker is clicked, the name of the farmer and his sowing decisions are displayed. This is illustrated in Fig. 23. 6. Farmer’s Market A farmer can add his crop produce to the market by adding his name, item to be sold, quantity

and price. Similarly, a purchase can be made by clicking the ​Buy b​ utton in Fig. 24. Once the purchase has been made, both the buyer and sender will receive a text message on their registered phone number, informing them about the purchase. A sample text message is shown in Fig. 25.

Department of Information Technology, DJSCE Page 40 Fig. 24 Farmer’s Market Crop Suitability Predictor

Fig. 25 Screenshot of SMS after making purchase 7. Notifications

Fig. 26 User’s Notification Page On the notification page, farmers can view the announcements made by the admin. In addition to this, they can also view the admin’s response to their respective queries and complaints. Fig. 26 shows a screenshot of the user’s notification page. Department of Information Technology, DJSCE Page 41 Crop Suitability Predictor 8. Submit Query/Complaints Users can send across their queries and complaints to the admin by submitting a message on the S​ ubmit Query ​page of AgroConsultant. A snapshot of the page is shown in Fig. 27.

Department of Information Technology, DJSCE Page 42

Fig. 27 Submit Query Page 9. Online Learning Online learning is a feature that allows the developers to re-train the machine learning model of Crop Suitability Predictor, by using the real-time data provided by the farmers. At the end of the sow season, the farmers are requires to fill an ​End of Season Submission Form, as illustrated in Fig. 28. This form contains entry for the crop grown, area cultivated (in hectares), production (in tons), profit earned, start date and end date. This data will then be used to adjust the weights of the neural network annually, so as to increase the efficiency of the model. Crop Suitability Predictor



Fig. 28 End of Season Submission Form 10. Multi-Lingual Feature With the help of Google’s Translation API, each and every page on the AgroConsultant portal can be translated to any one of the following regional languages, to suit the convenience of the farmers across the country: Bengali, Gujarati, Hindi, Marathi, Kannada, Punjabi, Tamil, Telugu, Malayalam and Sindhi. The users can select a language of their choice by simply clicking the drop-down list on the top right corner of each page. Fig.29 and Fig. 30 are snapshots of the Predictor Page and the Crop Information Sheet in Hindi respectively. Crop Suitability Predictor



Fig. 29 Predictor Page in Hindi Fig. 30 Crop Information Sheet in Hindi Crop Suitability Predictor 6.2.2 Admin Portal The admin’s dashboard consists of a line graph, depicting the annual production statistics of four major crops, namely, Wheat, Rice, Maize and Jowar. This is shown in Fig. 31. Furthermore, the dashboard also displays the pie-chart analysis of state-wise production of each crop, as shown in Fig. 32.

Department of Information Technology, DJSCE Page 45

Fig. 31 Admin Dashboard- Snapshot 1 Fig. 32 Admin Dashboard- Snapshot 2 Crop Suitability Predictor Chapter 7 Testing and

Results Chapter 7 covers the test plan and the details of the results obtained after performing unit, integration and performance testing. ​7.1 Test plan The objective of the plan is to break the project down into distinct areas and identify features of the project that are to be tested. The test plan approach that has been used in our project includes the following: 7.1.1 Design verification and compliance test: These stages of testing have been performed during the development or approval stage of the product, typically on a small sample of units. 7.1.2 Test Coverage The design verification tests have been performed at the point of reaching every milestone. Test areas include testing of various features such as code, running for subset of crops, then running for multiple categories. 7.1.3 Test Methods Testing of diverse features has been performed in project. For such module, corresponding outputs were checked. For testing each module, the output produced from running the code was checked with the acceptable accuracy range.

7.1.4 Test Responsibility The team members working on their respective features performed the testing of those features. Test responsibilities also include, the data collected, and how that data was used and reported. Department of Information Technology, DJSCE Page 46 Crop Suitability Predictor 7.2 Test Cases: Preliminary testing and improvisation of the model was carried out using the test dataset that was created by splitting the primary data into train and test subsets. The results have been tabulated in the Table 10. We further tested the model using random test cases. The test cases required to assess the prediction model were generated considering different permutations and combinations of the input parameters encompassing cases for different seasons, soil types, weather, and so on. 91% test cases passed the test. 7.3 Methods Used 7.3.1 Unit Testing Unit testing is a method by which individual units of source code, sets of one or more program modules together are tested to determine if they fir for use. In our project, we

considered each module as one unit and tested these units with the help of test cases and test plan developed. Unit testing was carried out on each module and on every function within the module. Output of each unit was assessed for accuracy and if found incorrect, appropriate corrections were made. 7.3.2 Integration Testing Integration testing is a phase in software testing in which individual modules are combined and tested as a group. The purpose is to detect any inconsistencies between the individual units that are integrated together. The modules of our application were integrated together in order to verify that they provide the required functionalities appropriately. The various modules were tested together to check for their accuracy and compatibility. 7.3.3 Performance Testing Performance testing is testing that is performed to determine how fast some aspect of a system performs under a particular workload. It can also serve to validate and verify other quality attributes of the system, such as scalability, reliability and resource usage.

Department of Information Technology, DJSCE Page 47 Crop Suitability Predictor 7.4​ Experimental Results and Conclusions Precision Recall F-Score Neural Network 0.988983 0.985293 0.987134 Random Forest 0.968754 0.982389 0.975418 KNN 0.965359 0.983096 0.973984 Decision Tree 0.982133 0.991349 0.986685 Table 10. Comparison of Precision, Recall and F-Score values

Department of Information Technology, DJSCE Page 48 Crop Suitability Predictor

Chapter 8 Maintenance This chapter includes the user manual, which instructs the user on the pre-requisites of using the system. It also instructs the user on how to use the system, and the constraints of using the system. 8​ .1 User Manual 8.1.1 Pre-requisites 1. The user must have the soil report with him before using the predictor model. 2. The user must have an updated Windows based operating systems. 3. The user must have an active data plan or any sort of internet connectivity. 4. The user needs to use the predictor model at the same location where he/she wants to

grow the crop. 8.1.2 How to use 1. Fill in the values of soil type, aquifer, soil pH and the thickness of the soil using the soil report with the help of dropdown available. 2. Select the season in which you want to grow the crop.(Rabi or Kharif) 3. Get the farm location by clicking on the button ‘Get Farm Location’. 4. Get the rainfall prediction by clicking on the button ‘Rainfall Prediction’. 5. Click on the submit button and a modal will display with at most five categories of crops which the farmer can sow. 6. The user can select any 1 crop from each category. Department of Information Technology, DJSCE Page 49 Crop Suitability Predictor 7. On selecting the crop and clicking on the submit button, details of the crop such as the fertilizers required, pests and the diseases which may occur will appear on the users dashboard. 8.2 Constraints A) Select the values from the dropdown only

The user cannot manually enter the values and has to select the values of the different parameters from the dropdown available. B) Good internet Speed As the product requires internet connectivity to fetch data for the summarizer a good speed internet is required to avoid long waiting period.

Department of Information Technology, DJSCE Page 50 Crop Suitability Predictor

Chapter 9 Conclusion and Future Scope For our final year project, we have, thus, successfully proposed and implemented an intelligent crop recommendation system, which can be easily used by farmers all over India. This system would assist the farmers in making an informed decision about which crop to grow depending on a variety of environmental and geographical factors. We have also implemented a secondary system, called Rainfall Predictor, which predicts the rainfall of the next 12 months. The high accuracies provided by both these models make them very efficient for all practical and real-time purposes. The model proposed here can be further extended in the future to incorporate a feature to predict crop rotations. This would ensure maximized yield as the decision about which

crop to grow would now also depend upon which crop was harvested in the previous cycle. Furthermore, crop demand and supply as well as other economic indicators like farm harvest prices and retail prices can also be considered as parameters to the Crop Suitability Predictor model. This would provide a holistic prediction not only on the basis of environmental and geographical factors, but also depending on the economic aspects. Department of Information Technology, DJSCE Page 51 Conclusion 52Crop Suitability Predictor M ​Maintenance 50 C C​ OCOMO Model 18 D ​Data Design Diagram 24 APPENDDIXata Flow Diagram 25 E E​ xisting Systems 03

F F​ easibility Study 16 R R​ isk Management Mitigation Plan 21 Function Point Analysis 20 Future Scope 52 S S​ oftware Requirements 17 Sequence Diagram 28 H H​ ardware Requirements 17 T T​ esting and Results 47 I ​Introduction 01 Interface Design 29 U U​ se Case Diagram 27 Implementation and Results 31 User Manual 50 P ​Proposed Architecture 07 Project Scheduling 15 Department of Information Technology, DJSCE Page 52 Crop Suitability Predictor

References [1] “Onion, tomato price spike: season not the only reason”, available at https://www.thehindubusinessline.com/economy/agri-business/onion-tomato-price-s pike- season-not-the-only-reason/article9957255.ece, visited in February 2018 [2] “Agriculture in India: Industry Overview, Market Size, Role in Development...|IBEF”, available at https://www.ibef.org/industry/agriculture-india.aspx, visited in February 2018 [3] Haedong Lee and Aekyung Moon, “Development of Yield Prediction System Based on Real-time Agricultural Meteorological Information”, 16th International Conference on Advanced Communication Technology, 2014 [4] Rakesh Kumar , M.P. Singh, Prabhat Kumar and J.P. Singh, “Crop Selection Method to Maximize Crop Yield Rate using Machine Learning Technique”, International Conference on Smart Technologies and Management for Computing, Communication, Controls, Energy and Materials, 2015

[5] T.R. Lekhaa, “Efficient Crop Yield and Pesticide Prediction for Improving Agricultural Economy using Data Mining Techniques”, International Journal of Modern Trends in Engineering and Science (IJMTES), 2016, Volume 03, Issue 10 [6] Jay Gholap, Anurag Ingole, Jayesh Gohil, Shailesh Gargade and Vahida Attar, “Soil Data Analysis Using Classification Techniques and Soil Attribute Prediction”, International Journal of Computer Science Issues, Volume 9, Issue 3 [7] “INDIA AGRICULTURE AND CLIMATE DATA SET”, available at https://ipl.econ.duke.edu/dthomas/dev_data/datafiles/india_agric_climate.htm, visited in November 2017 [8] “How Decision Tree Algorithm works”, available at http://dataaspirant.com/2017/01/30/how-decision-tree-algorithm-works/, visited in February 2018 Department of Information Technology, DJSCE Page 53 Crop Suitability Predictor [9] “k-nearest neighbors algorithm-Wikipedia”, available at https://en.wikipedia.org/wiki/K- nearest_neighbors_algorithm, visited in February 2018 [10] “How the random forest algorithm works in machine learning”, available at http://dataaspirant.com/2017/05/22/random-forest-algorithm-machine-learing/, visited in February 2018 [11] “Artifical Neural Network”, available at https://en.wikipedia.org/wiki/Artificial_neural_network, visited in March


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook