**3.2 Machine learning in crop production**

Crop Production and management include crop selection, soil preparation based on suitability analysis, sowing seeds, application of manure & fertiliser, water management through proper irrigation mechanisms, and harvesting. Machine learning in agriculture crop production links various participants in the food chain or agricultural chain. Machine learning helps the agriculturalists in making better decisions in crop quality determination, yield prediction, plant species determination, crop disease prediction, and harvesting techniques (**Figure 11**).

The machine learning algorithms data acquired from IoT sensors in the agricultural field. Once the data feed, ML algorithms train the model using history and can make predictions at any stage of production to determine the different features required to predict the yield. It will help to improve the nutritional value (if deficient in the current return predicted) in the next production. Consequently, the crop production price will show a dramatic improvement in the upcoming yield. Application of A.I. in agriculture will enable the farmers to get up to minute information about current production, suggestions on next production, plant species identification, and quality improvement.

Once Land suitability analysis for cultivation is done, crop species selection has to be done based on suitability. Based on the nourishing factor in the soil and nutrient capability, a crop can be selected appropriately. Multi-criteria decision-making models used to get land suitability analysis. Image processing techniques integrated with machine learning suggested for plant species identification for the given crop image. Patil et al. analysed the various ML techniques used for crop selection based on environmental parameters and live market. They have used the K.N.N. classifier for the data obtained through multiple IoT sensors and prices based on entries in National Commodity and Derivative Exchange.

#### *Internet of Things and Machine Learning Applications for Smart Precision Agriculture DOI: http://dx.doi.org/10.5772/intechopen.97679*

Land specific yield prediction by considering Crop yield prediction using topological algorithms like ANN, backpropagation, and Multi-layered perceptron through the implementation of a neural network. Support vector regression (S.V.R.) a variant of SVM used for crop yield prediction. As nitrogen is an essential component for photosynthesis, nitrogen management is mandatory as the yield prediction. The various decision support systems provide agricultural decisions, the agriculturalist has to deal with enormous heterogeneous data for making wise decisions, so Machine learning plays a vital role. Chlingaryan et al., 2018 have analysed the various ML approaches and signal processing methods used for crop yield prediction and optimised techniques for nitrogen management. They reviewed that B.P.N.N. provides best accurate crop yield estimation (by considering the importance of vegetative indices), CNN with Gaussian Process is best for feature extraction, best Multi-class crop estimation by M5 Prime R.T., Least Squares SVM for Nitrogen management and Fuzzy cognitive map for representing the expert's opinion.

A comparative analysis of ML algorithms M5-Prime, K.N.N., S.V.R., ANN, and Multi-linear regression model was carried out on prediction of crop yield and suggested that M5-Prime outperforms others followed by K.N.N., S.V.R., ANN, and the last Multi-Linear Regression. It was evaluated based on the accuracy metrics (Normalised Mean Absolute Error, Root Relative Squared Error, Root mean square error, and Correlation Factor). Corn yield prediction predicted by Back Propagation Neural Network whose efficiency tested on green vegetation index, Normalised Difference Vegetation Index, perpendicular vegetation index, and soil adjusted vegetation index. Also, Deepa learning showed the most stable results on corn yield prediction at the particular region (Iowa state) when compared with Estimated Randomised Trees, Random Forest, and SVM. Deepa learning overcomes the overfitting problem prevalent in most of the ML algorithms.

One or more stages of crop cultivation will give information to other steps and vice versa. Depending on soil test results done during land suitability and crop health monitoring, the fertilisers will be recommended. Consequently, water and nutrient management carried out. The ML approaches work best for fertiliser recommendation. Water management is M.L.P. neural network with Backpropagation algorithm based on soil nutrient content, Gradient boosting and Random forest for soil nutrient assessment and Multivariate Relevance Vector Machine and Multilayer Perceptron for estimating the water requirement based on evapotranspiration and climatic data. Periodic Drought assessment is essential for crop maintenance and water management. Machine learning approaches used for drought assessment are Random Forest, Cubist, boosted regression trees, support vector regression, coupled wavelet ANNs, and ANN. Drought assessment is done based on the drought factors (land surface-related) and drought index.

#### **3.3 Machine learning in crop protection**

Crop protection implies the protection of crops from weeds (unwanted plants that grow in the land), pests (insects, bugs), and intruders (an animal which intends to graze the crops and human for theft). K-Means clustering, Support vector machines, and Neural networks are more prominent machine learning techniques employed in Precision Agriculture for crop protection. The weeds may cause a significant loss to the crop yield. Weedicides are applied (weeding) before the crop seeding stage and flowering stage. The weedicides, instead of any common herbicide, have to be explicitly asked to avoid the devastation of the desirable crop in the field. Accurate detection of weeds is more significant and done using Machine learning algorithms integrated with sensor data.

One of the most undesirable weeds, which causes a significant loss to crop and very difficult to detect and abolish, is Silabynum marianum. Pantazi XE et al., have suggested a weed detection method by multispectral imagery obtained through a camera mounted on Unmanned Aircraft Vehicle (UAV) using Counter Propagation ANN, XY-Fusion Network and Supervised Kohonen Network (S.F.N.) to detect Silabynum marianum from other crops. Furthermore, a weed detection system that accurately classifies the weeds was designed based on hyperspectral images through the camera mounted on a robot using an active learning machine learning model. This model designed using a class neural network classifier (one class mixture of Gaussians) for novelty detection and one self-organising class map. This active learning model provides 100% accuracy on the classification of the crop, whereas different weed species detection accuracy varied from 34 to 98%.

The different weed species detected using this model are *Taraxacum officinale*, *Ranunculus repens*, *Poa annua*, *Cirsium arvense*, *Stellaria media*, *Urtica dioica*, *Sinapis arvensis*, *Oxalis europaea*, *Polygonum persicaria*, and *Medicago lupulina*. The model outperformed when compared with the autoencoder network and one-class SVM classifiers. Some of the other weeds detected through images from cameras on UAV using machine learning techniques are: identification of broadleaf and grass from soybean using Convolution Neural Network (CNN) in comparison with SVM, Random Forest and Adaboost; weeds classified in sugarbeet fields with sugarbeet shape features using SVM and ANN are Pigweed, Turnip weed, Lambsquarters and Hare' s-ear mustard.

Some pests may infect weeds, and that might be contagious to the crops, so pest detection is one of the essential stages in crop protection. Thus weeds serve as hosts for pests and diseases consuming all the resources supplied to the plants. It is done using machine learning algorithms and followed by the recommendation of pesticides for pests. The images acquired through the optical sensors attached to UAV help in detecting the pests. CNN provides better results in this classification of pests from images. D. C. Corrales et al. have suggested a list of supervised machine learning algorithms used for crop protection in terms of diseases and pests. The are SVM, K.N.N., ANN, Decision trees, and Bayesian Network. Decision trees, SVN, and ANN, are best for prediction and classification of pests, whereas Bayesian Networks and K.N.N. are excellent in training. These pests have a devastating effect on the crop storage, precautionary measures taken by identifying the categories of pests and their nature of the occurrence. Crop Image analysis used to categorise the type of pests using computer vision.

Cheng et al., have implemented a deep residual learning model for classifying the pest image and it outperforms the Back-Propagation Neural Network and SVM in the accuracy of the pest image recognition. Also, it provides better performance than deep CNN (Alexnet). Tomato Whitefly classification using deep CNN, Paddy crop pests classification using deep CNN [84] and banana pest and disease detection using deep CNN are some of the successful CNN based crop pest classification models outperforming the traditional approaches. Therefore integration Image processing or computer vision and machine learning CNN algorithms provide the best classification of crop pests and diseases.

Animal intrusion detection is one of the threats to the agricultural crop. These intrusions identified and detected to avoid loss of crop production. IoT sensors provide periodic alerts on the detection of an animal object like rats, cow, sheep, elephant, and other wild animals. It can be detected effectively and prevented through wireless sensors alerts to farmers mobile and machine learning algorithms can be used for object classification. Also, Machine learning algorithms used to predict the animal or human object entry apriori by training the model with past data from IoT sensors.
