Chapter 3

Artificial Intelligence in Precision Agriculture

Machine Vision

Machine vision is a branch of artificial intelligence. Machine vision is an application of machine vision that enables a machine to recognize an object. Machine vision captures and analyzes visual information using one or more video cameras, analog-to-digital conversations, and digital signal processing. Machine vision has been widely used to support precision agriculture by providing automated solutions to tasks that are traditionally performed manually. Manual methods tend to be tedious and error-prone. Machine vision can provide accurate and efficient solutions to support agricultural activities. Moreover, machine learning algorithms enable the analysis of massive volumes of data quickly and accurately, providing a means for the implementation of machine vision applications in agriculture.

Image Acquisition, Preprocessing, and Segmentation

The first stage of any machine vision system is the image acquisition stage. The digitization and storage of an image is referred to as image acquisition. After the image has been obtained, various methods of processing can be applied to the image to perform the many different vision tasks required today. Preprocessing images commonly involves removing low-frequency background noise, normalizing the intensity of the individual particle images, removing reflections, and masking portions of images.

Sensor Types Used for Machine Vision

Vision sensors play a crucial role in acquiring image data. The most common image data types used are black and white, RGB (red, green, blue), RGB-D (red, green, blue, depth), multispectral, hyperspectral, and thermal imaging (Figure 3.8).

Black and White

The black and white (B/W) images combine black and white in a continuous spectrum to create various shades of gray. These are also known as grayscale images containing only one color channel (band). The value of each pixel in the image represents the intensity of light. These images contain only black, white, and various levels of grey.

RGB

A widely used imaging method is RGB imaging that uses the digital camera to capture visible light reflected from the objects to produce a digital image. Visible light falls in the 400 to 700 nm range of electromagnetic spectrum and includes red, blue and green bands of the electromagnetic spectrum.

RGB-D

Fruit detection using color information alone can be challenging due to variations in fruit color caused by different lighting conditions and overlapping fruits and fruits with similar color to the rest of the plant, leading to misclassification. Moreover, distinguishing crops from weeds in 2D images can be difficult. Stereo vision, which provides depth information, crop height, leaf shape, and leaf area, can aid crop differentiation and monitoring.

Multispectral

Multispectral imaging collects a few discrete spectral bands, typically less than 10, including RGB channels from the visible spectrum, near and far infrared, and near-ultraviolet bands of the electromagnetic spectrum.

Hyperspectral

Hyperspectral imaging consists of continuous narrow bands with spectral resolution of 10 to 20 nm. Hyperspectral images can contain hundreds of bands of the electromagnetic spectrum and have more informational content than multispectral imaging, but complexity is escalated due to the presence of redundant information.

Thermal

Thermal imaging senses infrared radiation emitted by an object to produce a thermal image of the corresponding object. It can be used to detect water stresses in crops, considering that the temperature for the plants under water stress is higher than that of unstressed plants.

Machine Vision Algorithms

Machine vision algorithms encompass various techniques and methods designed to process and analyze images. These algorithms transform raw image data into meaningful information that can be used for various tasks. They are essential for enabling machines to understand and interact with their environment. The algorithms can be categorized into several types, each serving a specific purpose within the vision system. Machine vision algorithms are crucial in various applications, including quality control, object recognition, and automated inspection. Examples of general machine vision algorithms include image segmentation, object detection, image matching, etc.

Machine Vision Image Training Datasets

Common to all machine vision-based precision agriculture tasks is presumably the goal of detecting the objects of interest (e.g., crop, weed, or fruit) and discriminating them from the rest of the scene. Achieving this requires, in addition to a well-designed hardware system, a robust data analysis pipeline that generally involves training machine learning models with specific image datasets. A high-quality, large-scale machine vision dataset is vital to the performance of the developed data analysis pipeline and the success of the end task.

Types of Training Data for Machine Vision

In machine vision, there are two main types of training data: labeled and unlabeled. Labeled data is divided into supervised and unsupervised, while unlabeled data is also known as raw data. Supervised data is the most common type of training data used in machine vision, providing clear instructions for the algorithm being trained.

Benefits of using Machine Vision Training Data

By providing a more extensive and diverse set of data, machine vision training data can help reduce the amount of bias in algorithms. Machine vision training data can help to improve the speed of algorithms. By providing a larger dataset, you can reduce the time needed to train an algorithm.

Public Image Datasets

Public datasets are scraped and annotated by groups working on making an application that requires a dataset of that kind (usually research groups). Once done with their application, they make the dataset public and free to use. Table 3.1 lists publicly a sampling of available datasets based on targeted precision agriculture tasks, including modality, platform, annotation, and application.

Image Annotation

Image annotation in agriculture is an essential process that involves labeling objects and features in images. It provides contextual information that aids machine learning models in recognizing patterns and making accurate predictions. Data labeling is crucial for training AI/ML systems to identify, analyze, and optimize various aspects of agricultural practices. The annotation of images where crops are affected by diseases or pests plays a crucial role in enabling early detection and facilitating targeted intervention strategies. The annotation of individual crops or plants facilitates the accurate counting and estimation of crop yields.

Data Labeling Techniques Used in Precision Agriculture

Data labeling, the process of annotating information with meaningful tags, plays a crucial role in precision agriculture by enabling the analysis of vast amounts of data for optimizing farming practices and improving overall productivity. Common techniques include bounding box annotation, polygon annotation, semantic segmentation, and polyline annotation. These methods help in tasks like crop identification, disease detection, and field monitoring.

Applications of Machine Vision in Precision Agriculture

Current applications of machine vision are increasingly recognized as key enablers of precision agriculture. Many applications using machine vision technology have been developed in agricultural sectors, such as land-based and aerial-based remote sensing for natural resources assessments, precision farming, postharvest product quality and safety detection, classification and sorting, and process automation. This is because machine vision systems not only recognize the size, shape, color, and texture of objects but also provide numerical attributes of the objects or scene being imaged. Moreover, machine learning algorithms enable the analysis of massive volumes of data quickly and accurately, providing a means for implementing machine vision applications in agriculture. This technology allows farmers to take proactive measures—such as targeted application of fertilizers and pesticides—resulting in optimized yields, reduced crop losses, and minimized environmental impact.

Weed Management

In-Row Mechanical Weeding. In-row mechanical weeding with AI machine vision refers to a system where a robotic machine uses machine vision powered by artificial intelligence to identify and precisely remove weeds within crop rows, allowing for targeted mechanical weeding without harming the desired plants, essentially automating the process of weeding between crop seedlings within a row.
Herbicide Application. Machine vision has been widely used for automating weed detection and spraying only weeds (Figure 3.14). By training machine vision systems with extensive datasets of annotated images, algorithms can learn to distinguish between desirable plants and weeds, down to the individual species, based on their unique visual characteristics.

Crop Monitoring

Machine vision for agriculture excels in monitoring crop health and detecting issues early. High-resolution cameras mounted on drones or satellites can capture detailed images of fields. These cameras capture crops at various growth stages, allowing farmers to monitor health and identify potential issues. Machine vision algorithms can detect subtle changes in leaf color, shape, and texture, which may indicate the presence of diseases or nutrient deficiencies.

Insect Detection

Machine vision can automate insect detection processes by facilitating automated data acquisition and processing, remote control, and informed decision-making. Machine vision enables machines to extract, interpret, and understand visual information from their environment. At the same time, ML algorithms can automate the process of identifying pest species based on various data inputs, such as images, DNA sequences, or acoustic signals. IoT-enabled traps capture pests and transmit images to central systems for identification. Automated systems can identify pests much faster than manual methods.

Disease Detection

One of the most promising applications of AI in disease detection involves the use of machine vision technology. High-resolution cameras mounted on drones or robotic devices traverse the fields, capturing images of crops from various angles and perspectives. These images are then compared against a vast dataset containing millions of images of healthy and diseased plants. Machine learning algorithms can be trained to recognize specific diseases based on leaf patterns or discoloration, enabling rapid diagnosis across large areas. Machine vision technology excels in early disease detection by analyzing visual cues and patterns in plant health. By capturing high-resolution images and utilizing sophisticated algorithms, the grower can identify subtle changes in leaf coloration, texture, and morphology that indicate the presence of plant disease long before it becomes visible to the naked eye. For instance, advanced neural networks can be used to analyze these images, recognizing patterns and anomalies that indicate the presence of disease.

Pesticide Spraying with Drones

Drones equipped with machine vision technology can identify specific areas infested with pests and diseases, allowing for targeted pesticide application. This pivotal approach ensures that only the necessary amount of chemicals is used, minimizing environmental impact and reducing costs. With high-resolution cameras and advanced algorithms, drones can detect even the smallest signs of infestation.

Soil Analysis

Soil analysis and nutrient management are critical components of modern agriculture, as they directly impact crop growth, productivity, and sustainability. With high-resolution imaging capabilities, the systems can capture detailed images of soil samples, allowing for microscopic analysis. By employing advanced image processing algorithms, they can identify and quantify various soil components, such as organic matter, particle size, moisture content, and mineral composition.

Yield Estimation and Forecasting

Machine vision-based techniques to analyze crop images provide a detailed view of plant health, growth stages, and potential yield. High-resolution cameras capture intricate details, which are then processed by algorithms to generate data-driven insights. Yield prediction involves evaluating plant height, leaf area, and fruit count. These variables are essential for estimating crop yield.

Determining Crop Maturity

Machine learning algorithms analyze images of crops in the field to identify and extract crucial features, such as color, size, shape, and even texture. Machine learning algorithms, including support vector machines (SVMs), decision trees, and artificial neural networks (ANNs), have been utilized to classify fruit ripeness based on visual cues such as color, texture, and shape.

Harvesting

Harvesting crops is labor-intensive, and securing staff during peak harvest seasons can be challenging, leading to delays and increased costs. Automated harvesting systems powered by machine vision technology can save time, reduce costs, and improve overall productivity. Automated harvesting systems excel in selecting crops based on their size, color, and maturity level. By putting in place strict quality control measures during the process, these systems can optimize selection, ensuring only the highest-quality produce is collected—this attention to detail results in improved quality, extended shelf life, and enhanced market value.

Phenotyping

Traditionally, phenotyping involved labor-intensive manual measurements, but now, AI-driven machine vision systems have transformed this field. These technologies can capture high-resolution images and analyze vast datasets, providing precise insights into plant growth, health, and genetic traits. In agriculture, machine vision phenotyping enables one to monitor plant characteristics such as leaf size, shape, color, and growth patterns. Farmers and researchers can use advanced algorithms to identify traits that contribute to higher yields and disease resistance.

Sorting and Grading of Perishable Crops

Fruit sorting and grading refer to the sorting of fruit based on parameters like size, shape, and maturity level (Figure 3.20). By efficiently sorting and grading crops, machine vision systems drastically reduce the time and labor required for these repetitive tasks. With advanced image-classification algorithms, these systems can detect and sort various crop types swiftly and accurately. For instance, they can differentiate between large and medium-sized potatoes, meeting specific order requirements within moments. This level of precision in crop sorting guarantees that the output meets market standards consistently.

Click on the following topics for more information on artificial intelligence in precision agriculture.