Artificial Intelligence Technology in the Agricultural Sector: A Systematic Literature Review

Due to the increasing global population and the growing demand for food worldwide as well as changes in weather conditions and the availability of water, artificial intelligence (AI) such as expert systems, natural language processing, speech recognition, and machine vision have changed not only the quantity but also the quality of work in the agricultural sector. Researchers and scientists are now moving toward the utilization of new IoT technologies in smart farming to help farmers use AI technology in the development of improved seeds, crop protection, and fertilizers. This will improve farmers’ profitability and the overall economy of the country. AI is emerging in three major categories in agriculture, namely soil and crop monitoring, predictive analytics, and agricultural robotics. In this regard, farmers are increasingly adopting the use of sensors and soil sampling to gather data to be used by farm management systems for further investigations and analyses. This article contributes to the field by surveying AI applications in the agricultural sector. It starts with background information on AI, including a discussion of all AI methods utilized in the agricultural industry, such as machine learning, the IoT, expert systems, image processing, and computer vision. A comprehensive literature review is then provided, addressing how researchers have utilized AI applications effectively in data collection using sensors, smart robots, and monitoring systems for crops and irrigation leakage. It is also shown that while utilizing AI applications, quality, productivity, and sustainability are maintained. Finally, we explore the benefits and challenges of AI applications together with a comparison and discussion of several AI methodologies applied in smart farming, such as machine learning, expert systems, and image processing.


I. INTRODUCTION
Smart farming applies information technologies for the optimization of complex farming systems. It incorporates information and communication technologies to improve agriculture production system. The agricultural sector is one of the most important production sectors. It is concerned with all aspects of agricultural activities and is divided into the four major subsectors of crops, forestry, livestock (production and animal health), and aquaculture. Artificial intelligence (AI) encompasses a broad range of applications in the field of computer science related to the possibility of building smart machines, robots, or sensors that are capable of simulating human actions to achieve tasks on behalf of humans to serve society intelligently. These actions are controlled by application programs using information technology devices. Combining AI approaches and traditional agricultural methods, smart agriculture is being used to improve national economies by monitoring crop growth using the principles of precision farming [1]. With these strategies, together with the help of machine learning, the Internet of Things (IoT), and cloud computing, all environmental features can be monitored to choose the best environment for each type of crop through the classification of the gathered data using one of the available classification techniques. The Internet of things (IoT) is a system of interrelated physical devices or objects with sensors, processing ability, software, and other technologies that connect and exchange data with other devices and systems over the Internet or other communications networks without requiring human-to-computer or human-to-human interaction. Smart irrigation is another new technique in agriculture to help farmers in automating irrigation processes by collecting data using smart devices such as Raspberry Pi [2]. The collected data are then analyzed to select the best technique for switching the flow of water on the farm to the ON or OFF state. Therefore, smart irrigation system provides the agriculture sector and farmers with many benefits such as: • Cost savings due to minimized water waste • Reduced human efforts • A unified view of soil characteristics, including moisture and nutrient contents • Smart notifications in case of abnormalities • Better long-term landscape health • IoT ecosystem for smart irrigation AI and machine learning can be used to monitor crops and soil health on a real-time basis, allowing companies to estimate crop yields and predict the best time for harvesting to maximize profit. Similarly, the early classification of plant diseases will help farmers use the best strategies to fight them. Using sensors, machine vision, AI models, and robots makes it possible to perform harvesting processes on behalf of workers with greater accuracy and speed. Moreover, it helps reduce the wastage of crops in the field that is experienced with the traditional method of harvesting. Using artificial intelligence techniques and tools, it is possible to predict the best time to fertilize fields and sow seeds to achieve maximum yield and better prices in a proper time and manner. The spraying of chemicals is considered an important method to control pest insects, fungi, and bacterial diseases of plants.
Applications of artificial intelligence in agriculture are divided into different types of activities that can be handled using AI as follows: • Crop and soil monitoring (monitor the crop health). For example, AI and machine learning can be used to monitor crops and soil health on a real-time basis, allowing companies to estimate crop yields and predict the best time for harvesting to maximize profit.
• Disease diagnosis (early classification of plant diseases helps to use the proper strategy to fight it). The early classification of plant diseases will help farmers use the best strategies to fight diseases.
• Agriculture robot (tackling the labor challenges). Using sensors, machine vision, AI models, and robots makes it possible to perform harvesting processes on behalf of workers with greater accuracy and speed.
• Predictive insights (Enables right decision-making) • Crop yield prediction (predicting the best time to sow). Using artificial intelligence techniques and tools, it is possible to predict the best time to fertilize fields and sow seeds to achieve maximum yield and better prices in a proper time and manner.
• Intelligent spraying (allows for cost savings). Intelligent spraying helps to reduce the wastage of crops in the field that is experienced with the traditional method of harvesting. The spraying of chemicals is considered as an important method to control pest insects, fungi, and bacterial diseases of plants.
According to United Nations reports [3], the world's population will rapidly increase from 7.8 billion in 2020 to around 11 billion in the upcoming years. As predicted by the FAO, the global population will reach 8 billion people by 2025 and 9.6 billion by the end of 2050 [4]. Therefore, global food production must be increased to satisfy the huge increase in population. This growing demand for food cannot be met by using traditional farming techniques, as farmers not only need to increase their productivity; they also need to provide food of better quality for their customers. Parasuraman et al. [5] emphasized the fact that because the total population is expanding extremely rapidly and the demand for food is increasing alongside the increase in population, different classes of IoT applications, robotization, machine learning, deep learning, and AI techniques should be utilized effectively to increase not only the production of food but also the quality of the produced food. In this regard, they proposed a framework for utilizing classifier models to support better detection of crop diseases and reported that the proposed detection algorithm achieved 99.96% accuracy.
The contribution of this research work can be summarized as follows: • The survey is addressing how researchers can utilize AI applications effectively in data collection using sensors, smart robots, and monitoring systems for crops and irrigation leakage. It is also shown that while utilizing AI applications, quality, productivity, and sustainability are maintained.
• This survey contributes to knowledge through the identification of the gaps and challenges in existing research in smart farming.
• The provided discussions and comparisons between different AI methodologies applied in smart farming such as machine learning, expert systems, and image processing will create new opportunities for researchers to conduct new research tracks in this area of research.
• In this survey, the provided information on the application of smart agricultural technology would help different countries especially developing countries to improve the quality of the agriculture sector to achieve farm sustainability in those countries.
In this survey we listed, compared and classified the existing studies based on new criteria of classification: we did a comparison based on the type of sensors, protocols, wireless communication technologies as well as applications. We have presented a classification of the publications examined in the three dimensions (Benefits, Challenges and Methodology). We have proposed a categorization of each dimension according to the context and the field of application of the publications. In-depth classification is also introduced to distinguish publications according to their types (automated decision-making, farm tracking, workflow assistant, etc.). We investigated many different domains such as IoT, and sensors including networks, communication protocols, cloud computing services, image processing, data collection, crop, and livestock monitoring. Moreover, different types of challenges, for example, data accuracy, security, network, and data transmission may exist in the smart farms and are investigated fully to provide a sustainable and good productive environment for the farms. Some scientists have performed research based on Artificial Intelligence (AI) to resolve farmers' problems. But they do not have a comprehensive review study to include many different technologies as discussed in the paper. To fill in this gap, this research provides a systematic literature review on AI in the agricultural sector based on 190 research publications mostly from recent years. This evaluation not only provides effective direction to the farmers but also shows possible models and implementations using AI techniques using different technologies.
The remainder of this article is organized as follows. In Section II, a systematic review of the methodology is presented. Background information about AI is presented in Section III. An extensive literature review is offered in Section IV, and in Section V, a general discussion of various related topics is presented, including the benefits and challenges of several techniques, the classification of previous studies, and a comparison of several AI methodologies applied in smart farming, followed by the conclusions of this work.

II. SYSTEMATIC REVIEW METHODOLOGY
Agriculture and food industries are considered among the most critical fields around the world. This sector can take advantage of AI and its subfields such as machine learning, computer vision, and image processing to solve many emerging problems. In these processes, IoT equipment can be used to collect helpful information from raw data on farms regarding agriculture and irrigation, while AI techniques can be utilized during preproduction (crop yield and finding irrigation leaks), production (disease detection and weather prediction), processing (product estimation), and distribution (storage and consumer analysis). In a systematic literature review, authors should search, understand, and classify the current research works in the area of interest and then perform analysis and draw conclusions based on their findings. For the present literature review, we searched journal papers, conference papers, and book chapters addressing AI and IoT applications in agriculture. We focused on high-quality papers indexed by IEEE Xplore, Clarivate, and Scopus. Figure 1. Systematic literature review phases show the review process followed for this paper.
A systematic review is completed with three phases: planning, execution, and reporting. In the planning phase, the reasons for conducting a literature review in a given area are considered. In the present case, several emerging applications are discussed, such as crop and livestock monitoring, abnormal activity detection, irrigation leakage detection, monitoring, remote operations, and productivity. In addition to these application areas, the most useful AI methodologies are discussed, such as machine learning, expert systems, the IoT, and image/video processing. The selected papers are categorized based on the dimensions of benefits, challenges, and methodologies.
In the execution phase of a systematic review, keywords are selected for each subtopic and then filters are applied. In the present case, most of the publication searches were performed manually in databases such as IEEE Xplore, Scopus, and Clarivate. Papers were selected from lists based on their titles, years, abstracts, conclusions, and publication sources. Finally, the authors read the full papers, filled out related tables, and analyzed the information. In the reporting phase of this systematic review, papers were classified into the three dimensions; benefits, challenges, and methodologies. Figure 3 illustrates the classification of AI applications in agriculture. AI technologies have benefited farmers, companies, and other members of the agricultural sector. Automated decision-making, monitoring, observation of irrigation leakage, and remote operations are some examples of the benefits for farmers. AI is also beneficial for companies and other organizations in terms of improving performance, cost and time optimization, quality and productivity improvement, security, and data collection.
Developing and using AI technology for farms also has some challenges including data collection, availability, and integration. Weather conditions, human interventions, government regulations, and privacy are some of the other challenges related to data collection. Most of the data need preprocessing before any image processing or machine learning can be applied. Methodologies can be categorized into the four main groups of the IoT, machine learning, expert systems, and image/video processing. While other AI methods do exist, these four categories constitute the most recent and frequently used techniques. Machine learning methods can be used for classification, clustering, decision-making, and optimization. Expert systems are often used in recommendation systems, decision-making, rule-based decisions, and fuzzy problems, as shown in Figure 2. Taxonomy of AI-based smart farming systems.

III. BACKGROUND ON ARTIFICIAL INTELLIGENCE
AI is an emerging topic of importance in the field of computer science. Computers and machines use AI methodologies to understand, analyze, and learn from data. There are many application areas for AI, such as robotics, e-commerce, social media, computer vision, face recognition, healthcare, agriculture, military usage, and games, and AI methodologies are also used in smart farming. Machine learning, smart sensors, image processing, computer vision, and expert systems methodologies can be used to solve problems in agriculture. AI information systems improve the quality, productivity, and sustainability of farming.

A. MACHINE LEARNING IN THE AGRICULTURAL SECTOR
Machine learning is a part of AI technology and it contributes to the agricultural sector by monitoring and controlling agricultural activities, thereby increasing productivity and improving the quality of the crops that are cultivated. Machine learning algorithms play essential roles in precision agriculture by detecting objects in agricultural fields. Treboux and Genoud [6] showed 94.27% accuracy with machine learning algorithms in detecting specific objects, clearly reflecting the immense impact of these applications in smart farming. Machine learning algorithms allow machines to learn about particular agricultural lands, the geographical structure of farming areas, and plants and crops using supervised and unsupervised learning methods. Datasets are organized and predefined in the former case, whereas datasets are not classified in the latter. Once the machine has learned about agricultural activities, it can perform actions such as monitoring and predicting temperature and humidity, soil moisture, crop yield, and plant diseases [7].
Simulatenously, machine learning algorithms are used to classify various agricultural datasets according to soil and land types. Such classifications help farmers select suitable crops. Machine learning algorithms such as random forest, naive Bayes, and K-means can classify these datasets to predict the most suitable crops for each area [8]. Applying these techniques will undoubtedly assist farmers in different agricultural activities for efficient and cost-productive crop production.
Therefore, machine learning in the agricultural sector is applied with the aim of developing computer programs that can handle the input data to make predictions such as the most ideal time for sowing or harvesting, irrigation methods and levels, selection of soil type, temperature, and plants. These inputs train the machine learning model to make appropriate decisions in the field, thereby helping farmers identify ideal farming opportunities. The selection of machine learning algorithms is highly dependent on the availability of data, size of the training data, accuracy and/or interpretability of the output, speed or training time, linearity, number of features and the modeling process involves regression, classification, learning, and clustering. In smart farming, machine learning systems work with the help of computer vision techniques (such as Image Classification, Object Detection, Panoptic Segmentation and Keypoint Detection) to recognize and evaluate various objects in an agricultural field. The data can be acquired through different sensors to be used in modeling the system, including training and testing with various machine learning algorithms. For example, to maintain controlled water irrigation, an automatic drip irrigation system can be implemented and controlled based on data such as temperature, light, humidity, and rain captured using various sensors in the field [9].
Furthermore, the support vector machine (SVM) algorithm is identified as one of the best classification algorithms and accuracy rates of 90%-97% were found in various studies where it was used to detect diseases in certain plants. These studies showed that the K-nearest neighbor (KNN) and SVM algorithms are suitable for classifying data and producing excellent overall accuracy [10]. Figure 3. ML Algorithm -categorization shows a brief categorization of machine learning algorithms based on their behaviors in the machine learning modeling process. They are divided into supervised and unsupervised learning categories.
Meanwhile, supervised algorithms produce output based on organized input data where the datasets are clearly labeled, classification algorithms can predict or classify data based on categories, such as male/female or spam mail/not spam, and KNN, decision tree, random forest, and SVM are examples of classification algorithms. Regression algorithms will predict continuous data or series of data such as salary and age. Simple linear regression, logistic regression, and multiple linear regression are examples of regression algorithms. Unsupervised learning algorithms are used when datasets are not labeled or organized. The machine learning model will learn from the dataset to identify an unknown object, such as identifying a person from a collection of image patterns. Clustering algorithms are used to form a structure for these uncategorized data. Upon identifying the pattern, the algorithm will group them into different clusters [11].
To illustrate the ML process and its features, Figure 4. ML Model for agriculture sector shows a machine learning model for the agricultural sector, consisting of three parts. The ''input'' part collects the required data from an agricultural field for data processing. Various types of IoT sensors and manually entered datasets are the primary resources for machine learning systems to train models. The collected datasets will be categorized as labeled or unlabeled in machine learning systems based on the data processing outcome. Some datasets will be separated for testing and classifications, while other sets will be used for making predictions with appropriate machine learning algorithms. The generated results in the ''output'' part can be analyzed further to improve system performance or for further related studies.

B. INTERNET OF THINGS IN SMART FARMING
In this section, we provide an overview of categories of sensors, IoT sensor types used in smart farming, wireless sensor networks, and IoT protocols used in smart farming.

1) PRIMITIVE SENSORS VS. SMART SENSORS
A sensor is defined as any device that can detect and measure different types of physical properties and quantities, such as wind speed and direction, air pressure, light, humidity, heat, and many other physical variables. The input value read by the sensor results in an electrical signal that is usually transmitted to a microcontroller and then makes its way to a network interface for further processing. The evolution from primitive to smart sensors allowed a leap in how data are collected from the environment, processed, and used in making decisions for further investigations. IoT smart sensors can connect huge numbers of smart systems that help us develop smart solutions for emerging problems [12], [13].   . Primitive sensor shows a block diagram for a primitive sensor, which basically senses a physical attribute, and then the resulting signals are manipulated for further processing and sent out as an analog current. Technological advancements have improved modern sensors in terms of how they convert the physically sensed data; signals are conditioned and converted to digital format, becoming input for an algorithm for processing and then being sent to the transceiver unit as illustrated in Figure 6. Smart sensor. A smart sensor usually consists of the following: 1. A sensing device that measures a physical attribute (heat, humidity, etc.). 2. Signal conditioning to translate the sensed signal into data. 3. A connected processing unit with memory and a user interface. This unit is loaded with an algorithm to process digital data. 4. A transceiver unit to exchange information with the gateway/sink sensor node.

2) SENSOR TYPES FOR SMART FARMING
Innovation is rapidly improving traditional farming practices. Technologies such as satellite imaging, unmanned aerial vehicles (UAVs), and sensor technologies are revolutionizing the agricultural industry. Smart farming applies information technologies for the optimization of complex farming systems. The objective of smart farming is to access and use data collected to solve a problem or optimize a solution. The main goal is to find a way to use the collected information in a ''smart'' way [15]. Smart farming embraces almost all operations of a farm [16]. Farmers can use portable devices such as smartphones and tablets to monitor real-time data (irrigation, climate, fertilization, etc.) that will aid farmers in reacting to situations based on the collected data and making informed decisions supported by smart algorithms. There are many types of sensors that can be used to read and process agricultural data. Below, we list the most common sensors used in smart farming and their specifications: 1. Water content sensor: This is used to measure the ratio of the amount of water in the tested soil to the total amount of the tested soil, which is the ability of  a substance to hold an electrical charge. It measures changes due to the change in the dielectric permittivity of the soil. Values range from 0 (dry soil) to the saturation of the porosity in the tested soil [17] where porosity saturation is the ratio of the pore volume to the total volume of the soil sample. The measurements depend on the soil type; consequently, the sensor needs to be calibrated for different locations. 2. Volumetric water content sensor: This type of sensor measures the water content of soil [18]. It works by evaluating the water suction in the soil, reflecting plant roots' efforts to extract water from the soil. It provides an estimation of the amount of water stored or the irrigation required to ensure the needed amount of water in the soil. 3. Electrical conductivity sensor: This is used to measure the saline content in soil by estimating the solute concentration, which can be hazardous for crops if the soil salinity is too high [19]. Soil salinity around the roots of plants is mainly caused by salt build-up from irrigation water, which can potentially cause long-term damage to the land itself. 4. pH sensor: This type of sensor is used to measure pH values, reflecting the acidity and alkalinity of the soil. Ideally, soil pH values range between 6.0 and 7.0. Values outside of this range indicate a lack of nutrients in the soil. Farmers need to regulate the pH value by using alkaline or acidic fertilizers, which improves production [20]. 5. Weed seeker sensor: This sensor uses advanced optics and processing power; it detects and eliminates resistant weeds. When it passes over a detected weed, it sends a signal to the attached spray nozzle to precisely deliver herbicide to the weed. The sensor consists of an active light source and a chlorophyll-identifying selective spray sensor. This allows for detecting and spraying only weeds, significantly reducing the amount of chemicals applied by up to 90%. As a result, optimized use of chemicals is achieved, which also reduces the cost [21]. 6. Temperature sensor: This sensor gives an alert if the temperature deviates from the normal range. The soil temperature determines what types of crops can be cultivated in a field. Temperature is important for plant growth processes such as water absorption and transpiration by plants through photosynthesis. Each crop has a different temperature range for its growth. The enzymes necessary for growth will not be active if the temperature is outside of the normal range [22]. 7. Wind speed sensor: This sensor aims to measure wind speed at a certain surface level. It is necessary to observe the changes in wind speed patterns and directions. The height at which this sensor is mounted depends on the crop [23]. Table 1 lists the most commonly used sensor types, wireless communication protocols, and user applications.

3) WIRELESS SENSOR NETWORKS IN SMART FARMING
A wireless sensor network (WSN) is a group of dedicated and spatially distributed sensors used for monitoring physical environmental variables. The sensed value is stored temporarily, and then the collected values are transmitted to a central station or sink [42]. Efficient WSNs for smart farming are now attracting the attention of both the research community and industry leaders. A WSN for smart farming consists of multiple nodes with wireless communication capabilities. Figure 7. A generic WSN node architecture illustrates a generic WSN node architecture. Each WSN node has a power source, sensor/actuator, microcontroller and memory, and transceiver (Tx/Rx) [43]. A node can support one or more sensors in measuring different values such as soil moisture/water content, soil temperature, soil electrical conductivity, and weather parameters. WSNs are characterized by being self-organized, selfconfigured, and self-healing. One of their most common advantages is the significant reduction in wiring since they do not rely on a wired infrastructure; this can reduce costs by up to 80% [44]. WSNs allow for tracking practices in hazardous, infrastructure-less, and rural areas. This offers nearly VOLUME 11, 2023 limitless setup flexibility for sensors and improved network robustness. Moreover, this technology reduces the need for network maintenance. Another advantage of WSNs is their portability, allowing them to be moved around in different farming fields. This allows farmers to conduct measurements for multiple fields or sites easily. In contrast, wired sensors are more expensive and require regular maintenance, and ensuring their mobility is not a trivial undertaking [45].

4) IoT PROTOCOLS IN SMART FARMING
The essential components of a smart farm's architecture are the deployed networking sensors, the sinks/base stations, a server, and the communication links of the network [46]. The sensors that are deployed in a specific farmland area communicate with the sink either directly or by relaying packets toward the sink to other sensor nodes using a common wireless routing protocol such as LEACH or PEGASIS. The sink then stores the data and sends them via the internet to the server. The server can be implemented using a cloud computing infrastructure, which allows for scalability and efficiency. WSN protocols are used in IoT to provide the PHY/MAC connectivity between IoT sensor nodes and the central gateway/sink. IoT encompasses different technology stacks, WSN is a subset of IoT where data is transmitted using several IoT devices without internet.  [47], SigFox, and NB-IoT [48]. The choice of the communication protocol depends on multiple factors such as the needed data rate, the power consumption, the transmission range, and the cost. NB-IoT is a standardsbased low-power wide-area (LWPA) technology developed by 3GPP that supports a wide range of new IoT devices and services. It uses a subset of the Long-Term Evolution (LTE) standard with limited bandwidth for a single narrow band of 200 kHz. LoRaWAN offers a high transmission range of about 32 km and very low energy consumption; it provides very limited data rates (maximum of 50 kbps), but they are generally enough for transmission of measurements from most currently available agricultural sensors. Table 2 lists the different wireless technologies used in WSNs. Table 2 for the different wireless communications technologies show that each technology has some advantages and disadvantages. Table 3 below, summarizes the advantages and disadvantages of each of the technologies in the context of smart farming. The summary reveals that the ZigBee Alliance sensors and SigFox are the best candidates for smart farming applications and their advantages overweigh the disadvantages.

6) CLOUD COMPUTING SERVICES
Cloud computing services can be used in smart farming applications for the purpose of collecting and storing the data transmitted by remote sensors. On the other hand, cloud computing can be used for processing the data and generating results for the users. Data processing consists of data analysis, visualization, and decision-making. Cloud services can be classified into three connected layers, namely Software as a Service (SaaS), Platform as a Service (PaaS), and Infrastructure as a Service (IaaS), which correspond to the internet applications offered for end users, the tools used to implement a wide range of applications, and physical resources, respectively [49].

C. EXPERT SYSTEMS IN AGRICULTURE
AI is now regarded as a well-established and important technology that has contributed to many fields, such as commerce, medicine, electronics, games, manufacturing, and many more. In the domain of agriculture, AI technology has been used to create computer programs that can perform tasks that require human skills. There are a wide range of AI technologies that have been used successfully in agriculture, including expert systems and artificial neural networks. Expert systems are computer programs that can perform tasks that normally require the abilities of a skilled human. These tasks are usually decision-making tasks rather than physical activities, such as predicting or forecasting weather conditions. Expert systems are used in agriculture to change farming practices and replace human labor. In expert systems, ''intelligence'' means understanding and analyzing a pattern in the data to replicate human behavior for decision-making and problem-solving. The first application of AI techniques in the management of crops occurred in 1985 [50]. Numerous expert systems were developed to overcome the problems of vague, unfocused, and imperfect information in agricultural management, such as TEAPEST, which recommends a suitable control mechanism for identifying serious insect pests of tea. Rice-Crop Doctor was developed by MANAGE as an expert system to detect rice pests and diseases in addition to their cures. AMPRAPALIKA is an expert system that detects specific diseases of mango by using indicators and recommending treatments for mango tree diseases, and many other expert systems have been developed to address different aspects of agriculture [51].
There are many research proposals and systems with the aim of building expert systems that can determine land suitability for specific crops. One such study aimed to develop an expert system for making land suitability decisions for fruit crops, a process undertaken by analyzing the soil to recommend suitable plants [52]. In another study, new technological advancements were applied to model new types of diseases that can damage crops. The proposed system combined various factors in this application of technological advancements [53]. Some expert systems were also developed in the agricultural domain to evaluate the nutritional quality of the soil and determine whether plants absorbed sufficient, sustainable nutrients [52].
Image analysis using expert systems plays an important role in determining plant characteristics holistically. Such systems measure the heterogeneity of leaf pieces to determine leaf scorch, which in turn helps determine symptoms of leaf damage [54]. Image analysis particularly helps in two main fields of agriculture, namely ecological informatics and biometeorology, which require the quick interpretation of plant photo images to save time in the treatment process. In addition, many regression models were proposed using crop nutrition parameters. Such models and systems can decrease the risk of plant diseases for the global economy by detecting diseases and recommending applicable treatment to control them [55].

D. CHALLENGES OF ADOPTING AI IN AGRICULTURE
AI has provided great opportunities to the agricultural sector; however, there are still many challenges faced by researchers in this area, such as collecting the required data for building the knowledge base. In addition to external factors, challenges from sowing to harvesting have led researchers to improve and create AI techniques such as artificial neural networks, fuzzy systems, expert systems, and agricultural robots. These systems are widely used in many farming applications such as crop and soil monitoring, weed management, pest management, disease detection, yield prediction, and general efforts to overcome challenges. Environmental sustainability is a key factor in farming, as climate change will cause decreases in water supplies and increased costs of production. Crop management systems provide interfaces that cover many features of the management of crops. This approach was first introduced by McKinion and Lemmon [50]. The designing of such systems is important for guarding crops from many different kinds of damage. Another challenge in farming is crop pests and the selection of measures to control them. Drone technologies were developed by different companies to help farmers virtually visit all their crops and provide full monitoring systems, which can be used to discover dead soil, diseases, irregular crops, and pests, in addition to recommending solutions to these issues.
Plant diseases caused by pests have a significant effect on the global economy as 35% of crops are destroyed by different diseases. Thus, monitoring systems are needed to diagnose diseases and pests in addition to providing solutions. Such solutions can be based on past experiences. Soil quality is another factor to be considered for crop growth. It is known that many plants require specific soil characteristics to achieve maximum yield and profit [51].
Other challenges that farmers face in their efforts to successfully grow crops include climate factors such as temperature, humidity, sunlight, and rainfall. Machine learning techniques are being developed to forecast and predict the suitability of such factors [56]. It is now necessary to introduce modern technology that can use such data accurately to develop intelligent prediction systems in agriculture and yield maximum profit. Furthermore, to achieve large-scale planting, farmers face other challenges in trying to achieve precise planting and avoid the waste of agricultural resources, which can lead to unstable output. There are many solutions proposed by researchers and companies to overcome such problems by avoiding human labor and developing smart agriculture using sensor and IoT technologies for data collection and analysis [57].
AI technologies have shown very promising results in the domain of real-time monitoring of data, which is particularly suitable in the field of agriculture. As can be seen in the above proposed solutions, machines communicating with each other and using suitable AI technology will benefit farmers in their efforts to achieve their objectives with minimum waste of materials and maximum benefit.
Nevertheless, smart farming is not as widespread as expected because farmers usually perceive AI as only belonging to the physical world, and cannot be applied on land. This is not due to hesitation or worry about taking the risk, rather, it is due to the difficulties they face in understanding how to use AI-based farming tools.

E. IMAGE PROCESSING IN SMART FARMING
Image processing consists of manipulating images using computer programs. The inputs of these programs are images, and the outputs are either altered images or sets of parameters related to the input images [58]. Image processing is useful in multiple fields, such as medicine [188], geology [189], and smart farming [184]. It can be used to detect damaged stems, leaves, or fruit, and to measure the spread of disease in a field or the weights of fruits [185].
In image processing, an image is preprocessed by being transformed into a matrix of numbers. Then, depending on the objectives of the manipulation, different operations can be applied to the matrix. These operations will be performed in a fixed sequence for each pixel of the image. Image processing may involve multiple techniques, as follows: Image enhancement: Images can be easily subjected to distortion [59]. This may be due to Gaussian noise, contrast deviation, or blurring. The latter is usually seen in most images [60]. Image enhancement consists of processing an image in order to make it clearer. This can be achieved by noise reduction, image sharpening, brightness adjustment, and contrast increase, generating clearer images that are more suitable for display or further processing and analysis.
Image restoration: Multiple factors cause corrupted or degraded images. These can vary from a non-adjusted camera focus to time effect. Image restoration techniques aim to create images with the initially targeted quality so that new images can be restored from initially corrupted ones by reducing their degradation.
Image compression: Image compression entails minimizing the size of an image file while preserving its quality. This process leads to the optimization of storage resources and the reduction of time spent sending images and downloading them from webpages.
Image smoothing: Images may contain noisy data such as dots, blurs, speckles, or stains, and image smoothing methods act as filters to remove noisy data. There are multiple image smoothing methods including anisotropic diffusion, median filters, Gaussian filters, adaptive median filters, conservative smoothing, and mean filters. Most of them are based on low-pass filters, which help in decreasing the large difference between pixel values by averaging nearby pixel values while considering single values calculated for an image such as median and average values. They remove impulse noise from images by reducing the high-frequency components and retaining the low-frequency components [61].

1) COMPUTER VISION
Computer vision is intended to empower computers to perceive, recognize, and understand the real world in ways very similar to humans. This field is now becoming more popular with the success of mobile technology, which generates unlimited streams of photos and videos that cannot be analyzed by only human vision and thus require the intervention of computer vision.
On the other hand, computer vision techniques are greedy in terms of computing power. The continuous progress and decreasing price of computing power has contributed to the flourishing of computer vision. Novel artificial intelligence techniques such as convolutional neural networks (CNNs) are being utilized for both software and hardware advancement [62]. Computer vision techniques are being widely used for smart farming goals such as optimizing the performance of automated robots or minimizing the losses of fruit harvesting with automatic robots [63] and post-harvesting fruit classification [64].

2) COMPUTER VISION TECHNIQUES
Researchers have proposed different computer vision algorithms for different tasks. Some of these are as follows: Image classification: Image classification aims at classifying images into preknown classes. This task is very challenging, especially with larger numbers of variable items.
Object detection: Object detection aims at localizing semantic objects into an image. This technique usually detects objects based on predefined categories of images by comparing and matching a set of features with the image database. Standard classification algorithms such as AdaBoost [65] and SVM [66] are usually adopted for object detection purposes. Research has been undertaken to detect different objects such as faces [65] and pedestrians.
Image segmentation: Image segmentation involves partitioning images into multiple regions to be separately examined. It can be considered as pixel-level classification, where pixels are classified into specific entities [67]. Its main purpose is to change the representation of the images into a more meaningful one that can be analyzed more easily.

F. DATA COLLECTION AND IoT SENSORS
AI-enabled IoT sensors are widely used in many farms to collect data. These sensors can be categorized into many VOLUME 11, 2023 different groups based on location, optic, mechanics, airflow, electrochemical functions, etc. Effective usage of sensors helps farmers to have much more accurate predictions and good analysis while building their AI models. It is important to collect and manage data with smart sensors working in different IoT environments. One such study introduced a sensor management system to collect the data produced by each sensor in smart buildings and enable them to be processed and controlled by remote devices [68]. In another recent study [69], the data collection of IoT devices in a sparse network of IoT sensors was explored using a UAV and two new data collection solutions using an algorithm to address cases of full or incomplete data collection from sensors. In another relevant work [70], a data collection mechanism was proposed in remote areas using UAVs and building models for IoT-based smart farms to collect and process data using scheduling. Other scholars have devoted their attention to using the LoRa platform and cloud infrastructure to disseminate data for smart agriculture and effective irrigation.
Sensor data obtained by monitoring temperature, humidity, and soil moisture in the LoRa network were transmitted to the cloud environment and collected IoT data were analyzed in the testing environment [71]. Another important undertaking for smart farms is measuring soil and ambient parameters in agriculture. Placidi [72] proposed a model wherein visualization was provided after data collection using real-time operations. The overall reliability of the system was proven with a long-term experiment with two natural soils, loamy sand and silty loam. In another work [73], a data collection model using a ZigBee wireless sensor network was suggested; it covered all aspects of crops based on a sustainable agriculture model. The system supported the data collection and remote-control processes of agricultural production, and it also facilitated data analysis and operations using the single-point crossover multiple-generation genetic algorithm. The results proved that the smart agricultural model offered clear improvements in production.
Other scholars have devoted attention to IoT-based smart sensors that provide important innovations in the agricultural industry to increase productivity and energy efficiency. Research on IoT sensor technology was also undertaken in consideration of solutions using specific IoT sensors and sensor technologies in remote sensing and agricultural applications to assess weather conditions, soil quality, and the development of crops using robots for harvesting and weeding [74]. In another relevant study [75], the applications of printed sensors in smart farming were investigated and the advantages and disadvantages of measurement and monitoring applications were weighed while noting the limitations. That study also included measurements of chemicals, soil monitoring, and microclimate conditions in greenhouses.
Recently, many different IoT software has been used worldwide in various agricultural solutions, especially for data-driven models needed to improve farm production or solve insect-related diseases. Additionally, these solutions become more effective and powerful by using machine learning applications. Authors [76] discussed the issues related to the software development models for IoT applications. Their results indicate that adaptation of these models in IoT-based software solutions is more difficult than the other types of standard implementations since the involvement of hardware-related problems. Modern software solutions in IoT can be categorized into remote sensing, computer imaging, livestock monitoring, agricultural drones, precision farming, and so on. The work [77] reflected a solution for protecting crops from cattle with infrared sensors by monitoring their movement in the fields. Another work related to the decision support system in [78] discussed the AgroDSS is a cloud-based smart evaluation of agricultural data analysis.

G. CROP AND LIVESTOCK MONITORING
According to the World Resources Institute, there will be nearly 10 billion people on earth by 2050. To feed this many people sustainably, it will be necessary to increase food production by 53% to handle the overall expansion of agriculture lands and lower emissions by 67% [79].
One way to meet these demands is by smart farming. Incorporating IoT devices, wireless and wired networks, cloud computing, artificial intelligence, and software management systems, we can monitor and improve farming outputs. Farming can be monitored in two main areas: crops and livestock monitoring. Each category has its own specifics and needs.

1) CROP MONITORING
Crop monitoring takes into consideration one or more of the following points: • Environmental conditions including humidity, temperature, solar radiation, fertilization, and pesticide application, for which data can be collected through WSNs and IoT sensors [80].
• Crop diseases, including visual data that can be collected with high-resolution cameras, which may be fixed or mobile via UAVs [81].
In both cases, the information collected with these devices needs to be further processed for anomaly classification, prediction, and risk estimation [82].
Bauer and Aschenbruck [83] proposed an IoT-based farm monitoring system. Their focus of analysis was the leaf area index, which provides information on the photosynthetic processes and vital conditions of plants. WSN clusters of sensors were used to measure solar radiation (including temperature, humidity, and light) to calculate the photosynthetically active radiation range. Raspberry Pi was used at each cluster node, exchanging data with the central base unit through the LTE modem. The data were subsequently processed within a farm management information system for generating reports and making decisions.
Bagheri [84] developed a remote sensor system with high spatial and temporal resolution to improve the monitoring processes for temporal changes in agriculture via a UAV. The system architecture consisted of a main onboard system and ground station subsystems, with multispectral cameras for high-precision capturing, a GPS tracking system, and a telemetry system to transfer data among the subsystems. This monitoring system could speed up the monitoring processes and increase the accuracy of crop classification. After image capturing, multispectral imaging classification maps were developed with a maximum likelihood model. The results were very promising, with accuracy of 94% and a kappa coefficient of 0.9.
A similar study was developed in a vineyard [85]. The images captured were used to detect grape leaf stripe disease via the application of the normalized difference vegetation index, which facilitates analysis at the level of a single plant. This system allowed for the detection of anomalies near the infrared wavelength, which is not possible for the human visible spectrum. Thus, this study confirmed the benefits of using smart monitoring for plant protection.
In another previous study [86], the aim was to implement an integrated plant protection architecture and tree protection architecture by combining UAVs, cameras, and a WSN. After extensive research, a system with the following components was proposed: 1. Environmental data acquisition-Libeliu's Plug and Sense kit, a robust waterproof enclosure with specific external sockets, and incorporated GPS. Data transmission was performed with the LoRaWAN Gateway protocol, which performs best compared to other technologies. 2. Imagery data acquisition-An eBee X senseFly drone together with a Parrot Sequoia+ camera to capture ground and air images. 3. Imagery data processing -Preliminary processing of the images directly in the field via Pix4D to improve the overall processing time. 4. Cloud infrastructure-Data coming from both land and air are stored, processed, and analyzed using multiple machine learning and computer vision algorithms. They are managed through web and smartphone applications. Cloud platforms are the best choices for such storage due to the additional tools they provide.
The proposed system aimed to provide multiple area solutions, extended area coverage, and macroscopic and microscopic data, portability, and adaptability.

2) LIVESTOCK MONITORING
According to the FAO, livestock contributes 40% of the global value of agricultural output and supports the livelihoods and food and nutrition security of almost 1.3 billion people [87]. Currently, the livestock sector emits an estimated 7.1 GT of CO 2 equivalent per year, representing 14.5% of human-induced greenhouse gas (GHG) emissions. Increasing the efficiency of livestock supply chains is crucial for limiting the growth of GHG emissions in the future.
It was previously reported that smart monitoring of animal health and welfare could affect the global meat supply by reducing emissions by 2.5% and health problems and diseases by up to 33% [87]. The precision farming approach focuses on increasing productivity and preventing the spread of diseases on farms. Through IoT infrastructure and cloud-based technologies, it is possible to monitor farms in real-time to support and predict animal diseases before they can spread. Digital devices such as wearables are being used to monitor the real-time behaviors of animals and thus improve their health, lactation, or reproduction. Moreover, livestock facility data collection is used to monitor environmental factors such as malodor, gas emissions, and ventilation.
Smart systems consist of three main parts: sensing devices, communication channels, and storage and processing infrastructure. The sensing devices can be of several forms, such as collars, tags, actuators, or buzzers, and they are mostly known as IoT devices. Communication technologies are mostly wireless technologies such as Bluetooth, Wi-Fi, and mobile technologies such as 4G or LTE. The storage and processing infrastructure is usually a cloud platform, which gives system supervisors the opportunity to use multiple processing tools and help them make decisions. Moreover, the cloud infrastructure offers AI and machine learning-based applications to support IoT applications.
Recent research has shown that the usage of smart monitoring has immense potential for improving livestock outputs. Several studies have been conducted with cattle, sheep, goats, poultry, and house pets, indicating positive impacts in several directions. Precision livestock farming consists of monitoring, controlling, tracking, predicting, and automating applications [89]. These monitoring systems process and transmit data to the concerned parties in real time. Moreover, it is important that the farmers need to obey the laws of governments to follow the national standards and guidelines for livestock which are need to be developed collaboratively by authority and livestock industries.
Parameters observed via these monitoring systems include the following: • Physiological data, such as body temperature, humidity, or heart rate [89].
• Other factors such as environmental conditions [93], [96]. The normal body temperature of cows should be between 38 • C and 42 • C. Lower temperatures indicate indigestion or milk fever and higher temperatures indicate serious health issues. Humidity values above 72% indicate mild stress and those above 80% are linked to severe stress causing the reduction of heat exchange and weakness. Normal heart rates are considered to be between 48 and 84 BPM. A normal healthy animal eats for approximately 3-4 hours per day and digests the food for 9.5-10 hours per day. Incorrect measurements of these values will lead to under-or overfeeding and subsequent sickness or food waste.  The common tools used for physical measurements include wearable collars [97], [98], [99] and infrared sensors. Collars are mainly used to measure body temperature, blood pressure, and the pulse rate of the animals. Skin temperature is measured with infrared cameras and thermometers. The data are transferred to a database for further processing through wireless communication. Several types of microcontrollers can be used. According to a previous study [100], four features help in monitoring lameness, which are the daily number of steps, walking distance, time spent lying down, and eating. That study used three machine learning methods, namely the artificial neural network, SVM, and random forest approaches. All methods gave perfect results in distinguishing healthy and sick animals.
Joshitha et al. [101] proposed an automated smart system for tracking the movements of cattle. A LoRaWan system combined with GPS, NodeMCU, temperature and humidity sensors, a power supply, and a Raspberry Pi module was arranged to collect and process data on the movements of the cattle. The system assured better productivity and protection than existing conventional methods.
A similar proposal was made in another previous study [102], where the LoRa approach was implemented with a mobile gateway instead of a static gateway. Since LoRa utilizes the sub-1-GHz unlicensed spectrum, it was concluded that the static gateway was productive mostly for small livestock areas because of the sufficient data extraction rate and lower energy consumption. However, in larger livestock areas, the mobile gateway offers lower deployment costs and sufficient value. The system works by using sensor collars, which are hung around the cows' necks. These collars consist of a heartbeat sensor, a temperature sensor, a respiration sensor, and a humidity sensor. The data are transferred to the gateway and then to the farmers or breeders. In cases where there are many monitoring devices, the data transfer infrastructure should be designed accordingly so that the system can operate most efficiently.

3) POULTRY FARMS
Several studies and solutions have been proposed regarding poultry farms. The main issue to be considered in poultry farming is the housing environment. This entails odor monitoring, ventilation systems, temperature, carbon dioxide, and humidity. Other factors include the type of chickens, housing systems, building structures, ventilation systems, bedding materials, flow rates, types and amounts of feed and animal activity levels, manure handling systems, building management (cleaning and disinfection procedures), and cleaning practices [103].
Major malodor problems may arise on farms as a result of waste and chicken manure. Odor emission is influenced by various parameters such as temperature, humidity, wind speed and direction, season, and distances. Aunsa-Ard et al. [104] used an e-nose system to analyze malodor on poultry farms in Thailand. Their system consisted of eight metal oxide gas sensors and three major parts: a sample delivery system, detection unit, and signal processing system. The system provided high-precision data measurements. Another study used three fuzzy logic controllers to monitor the temperature, humidity, CO 2 , and NH 3 on a poultry farm, applying LabView and fuzzy control to regulate those parameters. By using fuzzy controllers, the power consumption by the actuators was decreased by 42% [105].
Wu et al. [106] developed a combined system of a traditional henhouse with a remote environmental monitoring system using ZigBee and ARM. The system provided reliable and stable performance. The main considered parameters were temperature, humidity, and light. In the study by Li et al. [107], an online poultry monitoring system was proposed. The system was based on wireless sensor networks and wireless sensor technology. Temperature, CO 2 , and NH 3 concentration measurements showed high accuracy, leading to a reliable system. In another study [108], the authors took into consideration power shortages and issues raised for ventilation systems for poultry. They proposed a smart notification system using an infrared sensor to detect fan malfunctions and notify users in three ways: phone calls, SMS, and the LINE application. The above section describes the background of artificial intelligence and using AI and IoT applications in smart farming.

IV. AI IN AGRICULTURE
Agriculture has a significant role in the sustained viability of any economy. It is significant for long-term economic growth and structural transformation, and it has evolved in terms of the processing, production, and conveyance of crops and domesticated animals. Currently, the agricultural sector is being influenced by new innovative IoT technologies, wireless communications, machine learning, and AI. Thanks to these technologies, the collection and analysis of data such as temperature, weather, soil properties, and historical crop performance provide predictive information that helps solve agricultural problems such as crop diseases, pesticide control, weed management, lack of irrigation, and water management [109]. At the same time, intelligent robots that operate in dynamic and unstructured situations and interact with humans have sparked increased interest and expanded applications in all fields, including agriculture.
Significant advances have occurred in the field of agriculture from 1980 to the present day. For example, Jha et al. [110] listed more than 50 technological advances in subfields of agriculture, including the use of artificial neural networks and expert systems, machine learning and fuzzy logic systems, automation, and IoT techniques to solve agricultural problems. Artificial neural networks that predict and forecast based on parallel reasoning were incorporated into the agricultural sector by Robinson and Mort [111], who proposed one of the first models to be fed with raw meteorological data like humidity, temperature, precipitation, and wind direction to predict the occurrence of frost.
Gliever et al. [112] used an artificial neural network successfully to differentiate weeds from cotton plants and soil in images collected from commercial cotton fields with 92% overall accuracy. Maier and Dandy [113] presented a literature review of the use of artificial neural networks for forecasting water resource variables and they outlined the steps that should be followed, the options available, and the issues that should be considered in the development of models that use artificial neural networks for the prediction of water resource variables. Song and He [114] used an artificial neural network and expert system to help farmers detect crop nutritional disorders in time. That combination led to diagnostic efficiency of 92% for nutritional disorders in crops. Prakash et al. [115] developed an expert system with a graphical interface based on fuzzy logic. It stored knowledge provided by agricultural experts, implemented reasoning algorithms to simulate human thinking, and provided a decision-making framework to help farmers improve their soybean planting and harvesting decisions in circumstances where the help of an agricultural expert is needed but not immediately accessible.
Sannakki et al. [115] applied an image processing-based approach for the automatic grading of leaf diseases by utilizing fuzzy logic. The proposed system was divided into five steps including image acquisition, image preprocessing, color image segmentation, calculation of the image total leaf area and image total disease area, and disease grading by fuzzy logic. The system gave accurate results. Tilva et al. [116] developed a fuzzy inference system to forecast plant diseases on the basis of weather data. The framework was created to prevent diseases in plants using an ''IF, THEN'' condition that indicated diseases happening because of a particular range of temperature and humidity. Shahzadi et al. [117] developed a specialist expert system based on the IoT that gathers and sends real-time data to a server to make appropriate decisions to enhance productivity and limit losses due to diseases and insects/pests.
Embedded intelligence aims to discover individual behaviors by mining their digital traces during interactions with the IoT. Yong et al. [118] applied wireless sensor networks and embedded intelligence in the domain of agriculture and presented a technology roadmap that explained the challenges and opportunities in agricultural areas in general and offered examples of IoT applications for smart irrigation. Patil and Thorat [119] used the IoT and machine learning to predict grape disease before it occurred. That involved developing a monitoring system for leaf temperature and a humidity sensor to identify grape disease risks in the early stages using a hidden Markov model that provides SMS alerts to farmers and experts.
Several studies have presented different decision-making strategies to help farmers monitor their fields [120], [121], [122], [123], [124], [125], [126], [127]. For example, Koteish et al. [120] proposed a real-time agriculture monitoring mechanism based on the IoT for sensing the soil moisture of a field and enhancing the irrigation system. They divided the monitored field into small zones and studied the data collected by the sensors from each zone to allow farmers to make the right decisions based on a predefined decision table. These studies showed efficiency in terms of data reduction, energy conservation, and accurate decision-making. The above section describes using IoT technologies in smart farming.

V. ROBOTICS IN AGRICULTURE
The literature has reported various ideas regarding the ability of robots to assist in agricultural activities. Indeed, the mechanization and automatization of agricultural tasks are an essential step to addressing population growth. Khadatkar et al. [128] emphasized the available robotic systems for various farm operations for field crops and horticulture and they discussed the following approaches and technologies presented in the literature for undertaking various agricultural operations: • Transplanting: Robotic transplanters use computer graphics or machine vision systems for transplanting operations [128]. Most robotic transplanters consist of a robotic arm for seedling pick-up, a path manipulator, and an end-effector [129], [130].
• Intercultural operations: Intercultural operations such as weeding are done to kill weeds by mechanical weeders or chemical spraying. Robotic weeders use vision-based systems for weed detection, guiding weeders, and uprooting weeds mechanically [131], [132], [133]. Gonzalez-de-Soto et al. [134] developed a robotic patch spraying system for the precise application of herbicides.
• Harvesting: Fruit selection and detachment are among the essential tasks for efficient harvesting. Most robotic harvesters have been developed for fruits and operate by grasping the fruit with grippers and then detaching it based on shape, size, color, and texture [135], [136].
Rahmadian et al. [137] explored three important developments of autonomous robotics in agriculture: navigation (incorporating GPS technology and vision-based sensor navigation to direct robots through agricultural fields), harvesting systems (incorporating sensors for harvesting and actuators to control harvesting devices), and soil analysis systems (giving information about the state of the farm's soil). However, agricultural conditions present many difficulties for robotic VOLUME 11, 2023 navigation. One relevant study [138] presented a literature review of the approaches for path planning in several agricultural areas. Bochtis et al. [139] offered a review of advances in agricultural machinery, where one of the approaches involves path planning methods for area coverage on farms. Palmer et al. [140] addressed improving the efficiency of field operations and suggested that precise tracking of predetermined efficient courses could reduce both overlaps and misses.
According to some researchers [128], [138], there are two main categories of path planning algorithms: • Point-to-point path planning: The goal consists of determining a collision-free path from a starting point to a destination point, optimizing parameters such as time, distance, or energy.
• Coverage path planning: The aim is to determine a path that passes over all points of an area or volume while avoiding obstacles [141]. Cao et al. [142] defined all the requirements for coverage operations. Luís et al. [138] indicated that path planning has been successfully applied to agrarian robots for field coverage and point-to-point navigation, with coverage path planning being slightly more advanced. Other researchers [143] presented a review of case studies in which robots were applied in recent agricultural tasks, including multi-robot systems and ground and aerial robots. Gliever and Slaughter [112] demonstrated that a well-validated computer simulation can provide a virtual proving ground that is essential for understanding how the robots of the future should be designed and controlled. Another study [143] suggested steps for making robotic simulations helpful, such as generating large amounts of data for machine learning and consequently facilitating the development of human-robot interactions and intelligent robots.
Oliviera et al. [144] reviewed the main existing applications of agricultural robotic systems for the execution of land preparation before planting, sowing, plant treatments, harvesting, yield estimation, or phenotyping. They evaluated robots according to the following main criteria: locomotion system, development stage, final application, use of sensors in robotic arms, and computer vision algorithms. They concluded that agricultural robotic systems are promoted and proposed in four main areas for future research: locomotion systems, sensors, computer vision algorithms, and IoT-based smart agriculture [144]. The above section discusses the usage of robotics in the agriculture sector and its start of the artwork.

VI. ABNORMAL ACTIVITIES
The first step in anomaly detection is defining the normal patterns as a standard reference point for the data analysis and processing phase. In general, an anomaly is defined as an abnormal state of the data that does not fit with the standard normal flow of systematic data behavior.
In a previous study [145], the occurrences of abnormal behaviors in the data processing phase were classified into the categories shown in Table 4.
For the performance evaluation of the detection model, some anomalies were inserted into the data during the process of data collection from the sensors. The model was able to detect anomalies from different sensors successfully. The implemented autoencoder model in that study [145] was considered as one of the most well-recognized neural network techniques classified as an unsupervised learning method, where the encoder has to learn the ways of compressing, encoding, and reconstructing the data. Basically, after the input data are acknowledged, the autoencoder starts the encoding process, utilizing the bottleneck layer in order to shrink the input data size. In the decoding phase, the autoencoder is trained to ignore non-vital data in the process of reconstructing the original data. By ignoring non-vital data such as moisture too low, light too high, or humidity too low in the decoding process, the autoencoder will be able to process large numbers of features with as little loss of normal data as possible and maximization of the loss of the anomalies contained within the testing dataset.
The autoencoder produces output in the form of images and labels the anomalies as abnormal data attributes. The data in the training phase are divided into validation (25% of the original data size) and training (75% of the original data size) datasets. After the training phase of the model, the threshold is determined along with the hyperparameters (batch size, learning rate, number of nodes, and number of epochs) using the validation dataset. The optimal training parameter setup values are shown in Table 5 [145].
Park et al. [146] proposed a machine-to-machine (M2M) standard communication method between things within the IoT environment in order to address the fact that most IoT services and devices are implemented to operate in a prototyped zone limited to the location where the experiment is taking place. The proposed method paved the way toward more interactive and well-connected system sensors and controlled devices within smart farm zones inside IoT environments. The M2M method offers functions including remote configuration, operation instruction, connections, data collection, data storage, device management, and security. In the same study [146], the compiled and processed information, basically generated from different IoT-based devices within livestock houses as shown in Figure 9. Livestock houses and farm communication structure using the M2M approach [146], was transmitted and received according to the M2M standard method.
The livestock houses consisted of multiple pig barns, each of which had a set of IoT equipment as shown in Table 6 [146]. Creating a predictive model for each device is essential in order to identify multidevice failure situations in livestock houses. The accumulated received data from livestock houses' sensors and control equipment feed the predictive model in the learning process. The training process takes place in a central server using transmitted data in a realtime manner from the livestock farm's devices. The data received at the server side are used to predict occurrences  of malfunctions in order to inform the user so that suitable action can be taken according to the type of malfunction. The proposed anomaly detection mechanism suits all IoT device types and numbers within livestock houses or farms zones.
According to Moso et al. [147], smart farms are producing enormous spatial, temporal, and time-series data streams. Analyzing these enormous volumes of streamed data will aid in better understanding various issues of productivity and efficiency regarding farm processes. Monitoring and analyzing a farm's progress by utilizing a suitable anomaly detection technique will help in recognizing any behavioral deviations from the norm. In the work of Moso et al. [147], using the enhanced locally selective combination in parallel outlier ensembles (ELSCP) as an ensemble anomaly detector was proposed. An unsupervised data-driven methodology was defined to be applied in two case studies of temporal data in smart farming. The first study considered harvesting data along with the use of a combine-harvester Global Positioning System (GPS) in tracking events. The second case study addressed crop data, considering the link between crop status (damaged or not) and detected anomalies. Referring to the area under the precision-recall curve (AUCPR), Moso et al. [147] concluded that their proposed methodology applied to the combine-harvester dataset yielded a score of 0.972, and for the crop dataset, 30% of the detected anomalies could be directly linked to crop damage. The main focus of their work was evaluating anomaly detection on farms by analyzing GPS logs, along with the following contributions:

1.
A detailed state-of-the-art report was offered for anomaly detection techniques with a focus on smart agriculture. 2. A robust ensemble-based methodology for the detection of anomalies from data streams in smart agriculture contexts was proposed. 3. The proposed technique was implemented and applied to a data stream of combine-harvester GPS logs with the aim of identifying anomalies that impact the harvest efficiency of farm machinery. 4. The proposed technique was also implemented and applied to crop data with the aim of identifying anomalies that reveal the status of crops during harvesting.
In smart agriculture field, Catalano et al. developed a multilayered architecture anomaly detection system to alleviate the infrastructure threats. In their work, two machine-learning algorithmic approaches'; the multivariate linear regression (MLR) and a long-term memory neural network algorithm (LSTM) were employed in the development process of the anomaly detection system. The system was fed by a real dataset coming from a smart agriculture system located in the Apulia region (Italy). In the training phase of both MLR and LSTM models, the datasets were obtained from Google Colab platform and the performance was evaluated by metrics. VOLUME 11, 2023 Right after the training process, the testing phase took place to generate predictions on the obtained data; therefore, the result will be assessed to reveal the detected anomalies [148]. The novelty of Akhter et al. work is that they developed an interdigital phosphate sensor for smart agriculture with a low-cost and low-power planar. The fabrication of the sensor is produced using a 3D printed template; in time, Multi-Walled Carbon Nanotubes (MWCNTs) and Polydimethylsiloxane (PDMS) are used to form the electrodes and substrate of the sensor respectively. In order to characterize the sensor for a wide range of temperature and phosphate detection the Electrochemical Impedance Spectroscopy (EIS) is employed. The system is trained with a well-recognized AI data processing algorithm which is K-nearest neighbor (KNN) machine learning algorithm. The obtained data from sensors are labeled as unclassified raw data. The principle of Euclidean distance used in KNN to compute the nearest distance between the training dataset matrix and new entry. The next step in this phase is optimizing the 'K's parameter from training dataset matrix and new entry. At this stage, shortest distance group of rows of the matrix is classified, the nearest possible result is computed using the mean deviation of those distances. The experimental outcomes were validated via standard UV vs. Spectrometry promotes the reliability of the sensor [149]. The above section discusses the recognition and identification of anomalies activities in agriculture.

VII. IRRIGATION LEAKAGE
Water is scarce and it is one of the most essential resources in the agricultural sector. A large amount of water is wasted as a result of the improper management of irrigation systems. As per the United Nation's World Water Development Report, more than 50% of the world's population will be facing high levels of water scarcity by 2050 [150]. The main reason for water wastage in farming is leakage in water distribution systems (WDSs). In an unmonitored irrigation system, small leaks in the WDS often go unnoticed, resulting in critical problems such as ruptures or bursts in the pipelines. The leakages in water pipelines are mainly due to excessive pressure on the pipelines, which causes distortion and further leads to the bursting of pipes when water flows through them [151].
Leakage detection in these pipelines by using a proper irrigation leakage monitoring system can help reduce water wastage and improve the efficiency of irrigation systems. A considerable number of studies have been conducted on leakage detection in WDSs. Researchers have developed different approaches for leakage detection and localization, such as the use of flow sensors and methodologies to analyze inputs from the sensors.
Daadoo et al. [151] proposed a system using wireless networks for leakage detection in WDSs for domestic environments. The two main phases of the system were an alarm based on GSM to send SMS information to the user and an Android application to control the pump. The proposed system used water sensors and ultrasonic sensors for water leakage detection and a microcontroller as a controlling unit. The results showed that the proposed system gave good responses to the sensor and owners could enjoy the ease of controlling the water pump through the mobile Android application.
Odumodu et al. [152] presented UFMNet, or Ultrasonic Flow Metering Network, with real-time flow monitoring, providing a cost-effective solution for pipeline leak detection. UFMNet is composed of a set of time-synchronized ultrasonic sensors to measure flow data (changes in the flow rate at different sections of the pipeline) continuously at high frequencies and radio transceivers to enable data correlation and in-network processing of the data flow. The authors listed the main advantage of the proposed system as the cost effectiveness of the development and installation process. Furthermore, the system provides more flexibility, as it can be deployed without shutting down pipelines. Results showed that the system could achieve reasonable accuracy.
A hybrid entropy clustering-based framework for the identification and placement of potential pressure sensors in WDSs for leakage detection was proposed by Taravatrooy et al. [153]. Minimizing the number of pressure sensors by reducing redundant information based on information theory and choosing the optimal solution based on a multicriteria decision-making model were the unique points of this study. The main aim of the proposed system was to develop an effective framework for optimizing leak detection by decreasing the cost of pressure sensor procurement and maximizing the coverage of the sensor network.
Fan et al. [154] and Coelho et al. [155] used a machine learning-based framework for water leakage detection in their works. In the former case [149], the authors used a semi-supervised learning framework of clustering and then localization for optimal sensor placement and leakage localization. In this approach, the WDS is partitioned into water leakage zones using a modified K-means clustering algorithm and a machine learning model is trained for leakage detection. New leakage characteristics extracted by the unsupervised learning algorithms proposed in that study [154] were determined by principal component analysis and an autoencoder neural network. An important feature of the proposed model was that it could be trained with the leakage characteristics matrix of the unbalanced data to detect abnormal conditions. The method achieved satisfactory performance for leakage detection and leakage localization. On the other hand, Coelho et al. [155] used a wireless sensor network to monitor the WDS and a machine learning algorithm to identify the precise locations of water leaks. A study to identify the most suitable machine learning classification algorithm for leakage detection was presented in that paper. The proposed system was able to achieve 75% accuracy for leakage detection with the benefit of being a low-cost application. Figure 10. Machine learning (ML)-based framework for leakage detection depicts a simplified model used in machine learning-based water leakage detection frameworks.
Aditya et al. [150] discussed different smart techniques available for detecting leakages and burst events in pipeline networks along with the present challenges and future possibilities in their work. Their study highlighted the major limitations of smart water technology as false alarms and the difficulty in identifying exact leak locations.
The calibration method proposed by Moasheri et al. [156] used a two-step process of identifying the zone with the most leakages and dividing that leaky zone into virtual zones. Calibration of the probability of leakage and the roughness coefficients of the pipes in the WDS were obtained simultaneously with the imperialist competitive algorithm. This method used the analysis of field pressure and flow metering results in the network, and it was shown that the method had no limitations on the number of leakages that could be evaluated simultaneously. This method helped reduce operational costs by reducing the number of field measurement devices.
Islam et al. [157] proposed a novel methodology based on a fuzzy-based algorithm to analyze the uncertainties of different WDS parameters such as roughness, nodal demands, and water reservoir levels to detect leakages. An experimental case study showed that the developed model could detect leakages and diagnose the exact locations of leakages within a minimal amount of time. The limitation of this model was the higher level of computational effort in cases of multiple leakages with limited numbers of sensors. Moreover, the model did not facilitate optimization of the number of nodes and their placement. The above section introduced the irrigation leakage and its solutions using AI techniques.

VIII. QUALITY, PRODUCTIVITY, AND SUSTAINABILITY
Food quality, productivity, and sustainability are critical issues in all countries because of the increasing population, climate change, and decreased resource availability. Traditional farming is not sufficient for ensuring high quality and quantity in secure food production. Global changes including climate change, water shortages, increased labor costs, and security challenges are essential problems in the agricultural sector. AI, the IoT, and robotics are important technologies used in smart farming to increase quality and productivity. Information technology supported by sensors, smart cameras, data science, and robotics can increase crop productivity and sustainability in farming. It is more practical and efficient to use AI technologies for monitoring and automating decisionmaking processes in agriculture [158]. In addition, crop and animal management is easier and more efficient with these technologies. AI-based smart monitoring systems provide more profitable, secure, and efficient farming. They reduce the cost of resources such as water and labor and increase reliability and security [159].
Productivity and sustainability in farming can be increased by applying the following AI, IoT, and robotics-based technologies: • Crop monitoring using the IoT • Automated monitoring of information systems and decision support • Data analysis using machine learning algorithms • Yield mapping using supervised machine learning • AI-based smart tractors, agribots, and robotic technology • Supply chain management and tracking • Price forecasting and optimization Figure 11. AI-enabled IoT smart farming system provides an example of an AI-enabled IoT smart farming system. IoT sensors (optical sensors, electrochemical sensors, mechanical soil sensors, location sensors, airflow sensors, etc.), drones, and Wi-Fi bots collect data from the fields and share the data via the cloud to the AI-based smart farming system. Smart farming systems apply many different machine learning, image processing, computer vision, remote sensing, and expert system algorithms to retrieve knowledge from raw data and thus support farm management and decision-making. These systems increase the quality, productivity, and sustainability of agriculture and supply chains.
Thakor et al. [158] proposed an IoT-based Digi farming model to analyze the production of farms. IoT sensors collect data from farms and help farmers make decisions and monitor their crops. Mobile and web applications are very efficient in disseminating product information and supporting e-commerce. Thakor et al. [158] evaluated several AI-based and IoT-based farming methodologies and compared them to traditional farming systems. Their results show that AI-based farming production is more efficient and profitable and that the Happiness Index scores of farmers and their living standards are higher among those engaged in smart farming compared to traditional farmers. Suebsombut et al. [159] classified the current trends and future possibilities of farming production and sustainability considering climate change, food security, and farm management, which are all relevant to smart farming, information management, product lifecycles, supply chains, and traceability. The experimental results showed that one of the most important variables was soil carbon emission, which affects food production and sustainability. VOLUME 11, 2023 FIGURE 11. AI-enabled IoT smart farming system. Quality, productivity, and sustainability in agriculture are affected by plant diseases, prices of crops, weather and climate, water availability, insurance, agent commissions, and potential lack of farming and management skills. Radu et al. [160] proposed a farm information management system with two levels, namely the local farm and the cloud farm. The farm management systems collected data from several farms and applied data preprocessing and machine learning algorithms to extract knowledge from the raw data. These authors compared farm management with local, cloud, and mobile applications. Cloud-based farm management systems yielded more accurate results than the others. Data collection for several crop species and several types of data will increase the efficiency and productivity of farming. Soil moisture, macronutrients, and micronutrients are also important parameters in agriculture for the maximum productivity and efficiency of crops. Production resources such as water and fertilizers should not be excessively or insufficiently applied. Researchers have shown that soil sensing techniques using real-time IoT technology can increase soil productivity with efficient water usage [161].
Malik et al. [162] proposed fog computing in sustainable and productive smart farming systems. Low-cost sensors and smart management were used to enhance agricultural productivity. In their paper, simulation platforms were modeled for data collection, sensor deployment, and data processing. These are critical parts of the smart farming ecosystems. The system considered sensor node placement, robot planning, data collection, mobile nodes, energy nodes, and coverage area. Sensors are especially important in smart farming for efficient monitoring and early warning systems. The proposed model gave promising results based on sensor energy, transmission delay, and packet delivery ratio. It has also been proposed that sensor placement and management simulation models can support sustainable IoT systems for farm management [163], [164]. Such systems can work with cloud computing in real-time applications. Probabilistic rule-based and supervised learning algorithms have also been proposed to enhance the productivity of crop production and water level arrangements [165], [166], [167], and Bayesian networks are often used in smart farming to monitor sensors remotely.
Priyadharsini et al. [168] proposed a new AI-and machine learning-based information system that used deep learning to analyze types of seasonal agricultural products. Input, hidden, and output layers were used with a total of 9 neurons in training. Monitoring the soil nutrition and pH level increased the productivity of the crops, and deep learning-based classification yielded more than 90% accuracy. Machine learning supervised classification algorithms are also used for preprocessed raw data received from multiple sensors using information fusion for crop monitoring to increase productivity and sustainability in smart farming [169], [170], [171]. Experimental results have shown that probabilistic-based methods such as the naïve Bayes classifier and Bayes network algorithms offer high accuracy in classification.
Deep learning is one of the machine learning algorithms which uses artificial neural network technique. Deep learning performs feature extraction automatically without human intervention which provide advantages in training of data. Deep learning is used several applications of the smart farming such as plant classification, behavior recognition, anomaly detection, pest recognition, smart irrigation and weed detection. Park et al. [146] collect livestock data from sensors and controllers to find out the anomalies in the farm. Feature vector includes temperature, humidity, CO2, ventilation, radiator temperature and external temperature. Anomaly detection accuracy in the farm is more than 93% using deep learning algorithms. Shakeel et al. [183] proposed deep learning algorithm-based cow behavior detection. Deep recurrent learning algorithm is used to identify and forecast cow behavior patterns. Proposed algorithm provides robust, secure and efficient computing time. Durai et al. [184] proposed several deep learning and other machine learning algorithms to predict the weather conditions, analyze the soil, recommend the crops for cultivation, determine the amount of fertilizers. Results in deep learning is more promising than the rule-based algorithms such as decision tree and random forest.

IX. BENEFITS OF SMART FARMING
Smart farming helps to determine the optimal use of natural resources in an economically sustainable manner. In addition, IOT based smart farming systems facilitates demand forecast, improves quality of supply, and ultimately the experience of the consumer. The objective of the extensive data collection and analysis approach used in smart farming is to increase the agricultural output while contributing to the environmental protection. Smart farming has proven to be beneficial to society in several regards. In this section, the main benefits of smart farming as seen by farmers, companies, and other members of the agricultural sector will be addressed.

A. FARMERS
As was described above, the usage of smart devices, AI, machine learning, expert systems, and cloud computing can significantly improve the monitoring processes of farms and allow actions to be taken to resolve any abnormalities or problems that have occurred. The usage of smart sensors allows farmers to measure all the required parameters related to their specific farms, such as crops or livestock, in real time. Image processing and machine learning enable the early diagnosis of plant diseases, leading to an early identification of the best strategies to fight them. Moreover, AI provides predictive insights that facilitate the decisionmaking processes of farmers in several stages of the farming process.
Cloud computing and web and mobile applications make notification processes remotely available, allowing farmers to be anywhere and still have real-time knowledge about the daily conditions of their farms. Finally, smart monitoring systems allow farmers to use fewer resources, including water, energy, food, fertilizers, land, and human resources, compared to traditional approaches.

B. COMPANIES
The farming and agricultural industry can benefit from IoT-enabled smart farming for real-time data collection and process automation, which helps achieve better decisionmaking, reduces waste, and maximizes efficiency in operations. According to Hunter et al. [172], the growing demands for global food consumption will require an increase in agricultural production of 25%-70% by 2050. Meeting this demand is a serious challenge around the world. With smart farming, it is possible to support the production of larger quantities of food. Smart agriculture has the potential to help address the world's problems with food security and sustainability.
Smart farming enables accuracy and precision in agriculture, subsequently allowing for improved labor and fuel efficiency. Resource consumption and human errors can be reduced using IoT technologies, thus reducing the operational costs and enhancing the quality of the products. The implementation of smart farming technologies is a major factor driving the growth of the smart farming market. However, although smart agriculture models are beneficial, there are still many challenges that need to be addressed, such as the high costs of smart agriculture equipment and the management of huge volumes of data related to productive decision-making.
Precision in smart farming allows us to optimize the use of resources such as fertilizers and irrigation water and thus improves food quality. Agricultural data collected using IoT devices help agricultural companies make the right decisions related to farming and the selling of crops [168].

C. AGRICULTURAL SECTOR
Smart farming solutions have important effects on the agricultural sector from different perspectives. For example, observing and collecting data from large farms with respect to humidity, air temperature, soil moisture, and sunlight intensity will have positive effects on the efficiency of water usage. Therefore, it will affect the overall crop yield. Since the world's population is increasing day by day, it is essential to use new techniques in the agricultural sector to increase food productivity. In this sense, smart farming is the best solution for increasing food production and maximizing profit. Smart farming solutions should be implemented effectively using IoT platforms and low-cost sensors while saving time, money, and resources. The outcomes of such implementations will benefit the agricultural sector in different ways that include increased production quality, the protection of water supplies, real-time data collection, lower operational costs, improved livestock farming, remote monitoring of fields, and reduced environmental footprints.
In many countries, research and development in the field of smart farming is being promoted to maximize sustainable food production while ensuring better profitability for farmers. One example of the implementation of smart farming in the agricultural sector was offered by Collado et al. [174]. They addressed the challenges related to the implementation of such projects, taking into consideration the human resources, the availability of fully equipped research centers, and the environmental aspects.

A. DATA ACCURACY
The success of a smart farming system is highly reliant on the accuracy of the data captured by IoT devices, as decisions will be made based upon the analysis of the data. IoT platforms, low cost sensors and data insights enables increase of efficiency and production in smart farming. However, in smart farming, data accuracy can be easily affected by multiple factors. First, IoT devices are generally designed for indoor environments, while in real life, smart farming takes place outdoors where environmental conditions can be very harsh, with snow, hail, floods, wind, or dust. This may lead to the rapid deterioration of IoT sensors. For example, sensors that contain copper might experience rapid oxidation, dust may easily cover several types of sensors, and some humidity sensors might be saturated in highly humid environments [175]. This will lead to the deterioration of the measurement capacity of the sensors and thus to degradation in data accuracy. Furthermore, electromagnetic interference caused by high-voltage grids across rural areas can cause data distortion or corruption due to the generation of electromagnetic fields [175].
Furthermore, IoT devices should not be running 24 hours a day; they should be switched off if no data are to be read. However, continuous data transmission is important for smart farming, so a serious challenge is seen in efforts to balance energy consumption and continuous signal transmissions.
Battery depletion can also cause data inaccuracy since it is a gradual process that is not immediately detected. Until the moment of detecting a battery problem and fixing it, sensors may be sending data of questionable accuracy.

B. SECURITY
Since smart farming relies on the integration of multiple technologies, networking, the IoT, and cloud computing, it inherits all the security issues related to those technologies. Different attacks can be executed against smart farming systems, and node capture may alter or replace devices [176]. Denial of service and sleep-deprivation attacks deplete the batteries of IoT devices and disrupt data transmission, which means that decision-making processes are also disrupted [177]. Furthermore, for technical reasons, IoT sensors usually cannot be placed in protective boxes [175]. The installation and use of advanced smart farming systems require the intervention of experts. The uncertainty, the technical and operational feasibilities of the system are critical. With the use of sensors and IoT in smart farming, some issues related to security and data privacy arise. Indeed, when a device is connected, it can be the source of an attack. In addition, sensors have batteries with a limited lifespan and in the majority of cases the battery is not replaceable, i.e. the age of a sensor is that of its battery. This is why reducing energy consumption, recycling or waste disposal are important challenges.
Smart farming may be applied in huge rural areas, where controlling the security of the whole location is challenging and expensive. Generally, security cameras on farms will be stationed at critical locations and access points, but it would be very challenging to ensure the security of every part of a farm. Attacks with consequences like flooding, the under-watering or over-watering of crops, and the misuse of pesticides are often described as agroterrorism, and agroterrorism may also be waged against food animal populations [175] [178]. Such actions can create fear, financial loss, and social disturbances. Rettore de Araujo Zanella et al. [175] stated that with the emergence of smart farming, new types of agroterrorism may appear, which can also be referred to as cyber-agroterrorism. Cyber-agroterrorism involves actions of attacking smart farming systems to cause serious financial and social damage. Security is thus very challenging for smart farms, as they face the possibility of both local physical attacks and online cyber-attacks. In smart farming, sensors, actuators and other technologic devices are exposed to climatic and natural events such as rain, snow, sun and hail. Animals, human, or agricultural machinery can damage or remove them from the installed locations.

C. KNOWLEDGE
The attitudes of farmers toward smart farming play crucial roles in the success and democratization of smart farming, especially since most farmers prefer to not take risks and continue with traditional farming practices [179]. The required skills and knowledge might represent a barrier for farmers that hinders them from adopting smart farming. In particular, attaining new skills and knowledge consumes both extra time and extra expenses. Researchers [180] [181] have agreed that training farmers would be an easy matter in developed countries where different types of advanced technology are already available and adopted by farmers. However, it is more difficult in developing countries, where most farms are in rural areas.
Charania and Li [182] stated that smart farming reduces the need for labor. Therefore, in countries where unemployment is a problem, smart farming would constitute a threat to farm laborers. This may discourage laborers from cooperating and contributing to the success of such technology as it injects insecurity in terms of employment stability.

D. NETWORK AND DATA TRANSMISSION
Transmitting data continuously to the cloud is an important task for smart farming systems. Subsequently, high-quality internet services with reliable bandwidth are mandatory. However, the largest percentage of farming zones are located in rural areas, where internet services are weaker than in urban zones, and this poses a serious challenge. If the network and/or internet is extremely unreliable and does not meet the minimum requirements of smart farming platforms, it is recommended to equip the platforms with local computers for data storage and decision-making processes rather than losing efficiency while sending a continuous stream of data over a weak network. However, this will make smart farming more expensive to implement [175]. The costs will increase upon including computers with adequate computational capacity and highly skilled employees may be required to operate the systems. The population is estimated at 9.7 billion by 2050, which requires improving agricultural mechanisms to increase food production and have high yields in a limited time. Moreover, agriculture is not limited to food production but constitutes the necessary raw materials in various sectors such as poultry, medicine, industrial, etc. We believe that the collection of new types of data such as water quality, citizens' behaviors, degree of air pollution and geographical characteristics of agricultural areas (the spatio-temporal characteristic of the agricultural area and its topological relationship with water points and urban areas) combined with the knowledge of experts in the agricultural field constitute an essential source for understanding potential agricultural problems and finding potential solutions. Indeed, in the short term, new types of sensors will be used in agriculture with a large continuous automation and use of AI techniques. In the long term, the strategies for improving productivity and selecting agricultural products will become more widespread to solve global problems rather than local ones.
Despite the major benefits smart farming offers to farmers, there is still a few things that demotivate them are mainly the lack of knowledge and costs associated. Some other general factors are as follows: • Initial cost of investment into a smart environment such as hardware, software, configurations and training.  • Building a smart farm requires technical knowledge on choosing the appropriate smart devices, a reliable network infrastructure based on the characteristics of the farm, setting up and monitoring software packages to implement actions such as watering triggers, alarms and notifications. Missing this knowledge is associated with extra cost of maintenance.
• One of the main parts of the system is the smart energy.
The solar agricultural market is still in the early stages of development and challenges related to technology costs, limited awareness of the benefits, lack of appropriate policy incentives and limited governmental subventions for farmers and suppliers who decide to use these technologies. • Coping with climate change, soil erosion and biodiversity loss is a novel journey for the majority, which may lead to continuously changing on the smart farm infrastructure.
• Farmers need to meet global rising demand of higher quality food. They need to reduce their impact on the environment, increase the nutritional content of crops and minimize chemical residues, which also needs extra technologies.
• There is a trend of youth migration form rural areas into cities which makes it more difficult for farmers convincing and inspiring young people to stay and become future farmers. Encouraging and training farmers to use technologies in farming has become a policy priority in several counties. Table 7 provides the categorization of the reviewed publications in the three aforementioned dimensions. These findings show that IoT data collection, machine learning, and benefits for farmers are the focuses of a large percentage of the relevant publications in the literature. VOLUME 11, 2023

XII. COMPARISON OF METHODOLOGIES
Machine learning, expert systems, and image processing methodologies are commonly used to solve various problems in the agricultural sector. Table 6 provides information about several recent applications of AI techniques for smart farming systems. For example, Shakeel et al. [183] proposed a deep learning-based classification algorithm for cow behavior recognition. Durai et al. [184] developed a system using the random forest classifier and deep learning algorithm to classify crops. They reported very promising results with accuracy of 95.45%. Decision tree, K-nearest neighbor, and random forest algorithms were used in mushroom classification by Rahman et al. [186] with accuracy of 100%. Other relevant algorithms used in recent works are given in Table 8. It shows that Junior et al. [185] have the best accuracy in the spectral, hierarchical, and DBSCAN clustering applications using decision tree and K-nearest neighbor algorithm compared with other machine learning algorithms. Sharma et al. provided a review of precision agriculture using machine learning algorithms to demonstrate that data-driven solutions in smart farms improve the productivity and quality of the products. In prediction of the crop growth K-neighbor's classifier, Logistic Regression, Ensemble classifiers algorithms give very promising results. Linear regression algorithm is commonly used predict the production value for climate data such as rainfall, temperature and humidity. Deep learning algorithms are very successful for weed detection, image classification, image segmentation and object tracking in agricultural data. Neural network, k-nearest neighbors and Naïve Bayes classifier algorithms are used in insect recognition and classification. Experimental results show that accuracy is more than 90%.

XIII. CONCLUSION
Smart farming is a concept that involves handling and controlling farms using new technologies such as the IoT, robotics, drones, and AI to increase the quantity and quality of products while reducing the human labor required for production. These benefits will have positive effects on the profitability and the growth of the economy as population sizes are dramatically increasing worldwide. Therefore, researchers and scientists are moving toward the utilization of recently introduced IoT technologies in smart farming to help farmers use AI technology in the development of improved seeds, crop protection, and fertilizers. AI in agriculture is emerging in the three major areas of soil and crop monitoring, predictive analytics, and agricultural robotics. In this regard, farmers are rapidly beginning to use sensors and soil sampling to gather data to be used by farm management systems for further investigation and analysis.
In this survey, we have studied many AI applications in the agricultural sector to investigate the various developments and solutions to improve the productivity of farms and solve some environmental problems encountered during the production of different types of products in agriculture. The AI models for farms help countries to maintain sustainability in this sector. We began with background on AI, which included a discussion of all AI methods utilized in the agricultural sector, such as machine learning, the IoT, expert systems, image processing, and computer vision. Second, a comprehensive literature review was presented, focusing on how researchers have utilized AI applications effectively in data collection by using sensors, utilizing smart robots, monitoring crops, and monitoring irrigation leakage. It was shown that quality, productivity, and sustainability are maintained while utilizing AI applications. Third, the benefits and challenges of AI applications were explored along with a comparison and discussion of several AI methodologies applied in smart farming. In this regard, considering the publications that were reviewed, it was concluded that machine learning, expert systems, and image processing methodologies are the most frequently used methodologies in the literature for solving problems in the agricultural sector.
Smart farming technologies are emerging technologies that help countries to maintain sustainability in the agriculture sector, however, the research community should consider some research gaps and challenges that create new opportunities for researchers to conduct new research tracks using trusted, secure data, factors in climate changes and weather forecasting to improve productivity. A lot of research work effort has been conducted to use machine learning for the early detection of disease in farms. However, there is a limitation in this field due to disease infestation and therefore, new models should be developed for early prediction of diseases before the farm harvest is affected significantly. The research gaps and challenges explained above encourage researchers to work on these gaps and create new opportunities and directions to conduct new research on various tracks as future work.
In this survey, we have also discussed the most recent applications of AI methods in smart farming while focusing on which AI methods or algorithms are used and the accuracy rates that were obtained. Tables were provided to demonstrate the most recent AI techniques and the associated applications as well as the obtained accuracies and, researchers have obtained very promising results while utilizing AI methodologies effectively. In conclusion, this survey has provided in-depth descriptions of AI applications in smart farming. Therefore, due to the provided information, discussions, and comparisons given here, this survey will be a useful guide for researchers conducting research on AI applications in smart farming. CHAMSEDDINE ZAKI received the master's degree in computer science from the École Polytechnique de Nice-Sophia Antipolis, in 2007, and the Ph.D. degree in computer engineering from Centrale Nantes, in 2011. He is currently an Assistant Professor with the American University of the Middle East, Kuwait. He has published more than 25 journal and conference papers in the fields of geographic information systems, spatiotemporal data analysis, multicriteria analysis, conceptual modeling, and travel time estimation.