Fighting Crop Diseases with AI and Internet of Things
IoT Sensors Help Boost Maize Production in Africa
Maize can be cultivated in low rainfall conditions, providing sustenance and income for many across East Africa during frequent droughts. Agriculture contributes 40% of the continent’s GDP, with 60% of its population engaged in farming activities. Any fluctuation in agricultural yield significantly affects the region’s economic output.
Theofrida Maginga, a Ph.D. candidate at the African Centre of Excellence in Internet of Things, University of Rwanda, emphasizes the dual role of maize. “Maize serves both as a source of food and a commercial crop. It provides income and meets domestic food needs,” she says.
When conditions are perfect, each acre of land can yield up to 1,800 kilograms (kg) of maize. Due to diseases and other challenges, area farmers harvest an average of 668 kg per acre. This stark contrast underscores the urgent need for innovative solutions to combat these issues.
Researchers at the University of Rwanda have developed a solution that harnesses the power of machine learning and Internet of Things (IoT) sensors to detect signs of maize diseases. This novel solution allows for early intervention to increase yield and reduce the costs associated with disease mitigation.
The project addresses the immediate economic challenges of the region while paving the way to apply advanced technologies in other areas. It’s a promising step toward a more prosperous and technologically advanced agricultural sector in Africa.
Farmers rely on manual visual inspections to detect diseased crops. This method requires extensive experience or expert assistance, but many farms are remote, which limits access to experts. The alternative, collecting samples with special devices to send to labs for analysis, is costly and time-consuming, and lost time can accelerate crop loss.
Recognizing these challenges, Maginga and the researchers from the University of Rwanda set out to find a solution to expedite the detection of diseases in maize. An obvious approach would be to develop a computer vision solution capable of automatically monitoring crops and detecting visual symptoms.
The experiments Maginga and her colleagues conducted revealed that it took two to three weeks for visual symptoms to appear on the plant. By the time these symptoms are detectable, the disease can spread to a larger area of the field. This delay can lead to significant crop losses and increase the cost of intervention and treatment.
“If you are able to detect the disease before the visual symptoms have started to reveal themselves, then the farmer can start the intervention sooner,” she said.
This team explored alternative signals that manifest before visual symptoms develop. “We identified gases that plants emit when they are fighting pathogens,” Maginga said. “It is similar to how the human body works. When you have a virus, you tend to develop a fever.”
The team also uses ultrasound movement signals of the stem as another potential early indicator of disease infection. The goal was to create a machine learning system capable of distinguishing between healthy and infected crops based on these signals. The hypothesis was the system could detect diseases before visual symptoms appeared.
“If we can remotely monitor the diseases using sensors and IoT devices and provide early warning, intervention could start sooner,” Maginga said. “Farmers could start treating fields without support from extension officers.”
Bringing the Field to the Lab
To develop a machine learning model capable of detecting early signs of disease in maize crops, the researchers set up a lab to collect training data from healthy and infected crops. They exposed a subset of plants to disease and measured the parameters over time to generate time-series data for training the model. The team chose to focus on northern corn leaf blight, a disease common in Africa and known to cause significant damage to maize crops.
“We chose a disease for which we could easily generate the pathogens in the lab. And the northern corn leaf blight tends to hinder the yield of maize crops significantly,” Maginga said. “A bigger issue was using IoT sensors to measure these signals before visual symptoms appeared on the plants.”
The researchers set up two different treatment groups, each containing four varieties of maize. The control group consisted of plants that were not exposed to the pathogen. A test group included plants exposed to the disease. They cultivated the disease in a separate lab setting and emulated the process of inoculation by infecting the test plants at an appropriate time. IoT sensors, installed on plants in both groups, collected data.
“The collected data allowed us to examine patterns over time and determine whether the emission of volatile organic compounds or the ultrasonic movements of maize differed between healthy and infected crops,” Maginga said.
To monitor the gases emitted by the maize plants, they used a volatile organic compound (VOC) air quality sensor. They installed ultrasound sensors close to the plants to monitor their movements, and they inserted NPK sensors into the soil to monitor changes in the nitrogen, phosphorous, and potassium in the soil.
The researchers used ThingSpeak™, a platform designed for monitoring, collecting, and visualizing IoT sensor data. ThingSpeak provides tools to directly monitor the data remotely through a cloud service.
“With ThingSpeak, we collected the data of the ultrasound sensors and monitored their changes in real time,” Maginga said. “One of the best experiences was using the data ThingSpeak gathered to share with the team.”
The data from the air quality sensors was stored on local SD cards. The NPK sensor data was sent to a local computer in the greenhouse lab.
Training the Machine Learning Models
Following the data collection process, the researchers embarked on the task of training their machine learning models. The initial exploratory data analysis (EDA) led them to discard the data from the NPK sensor. “It was not showing any particular pattern that could be used to classify healthy and infected crops,” Maginga explained. “It also required a lot of power.”
The team turned their attention to the data collected from the air quality and ultrasound sensors. After preprocessing the data with wavelet transforms, they trained separate machine learning models on each data set. For the ultrasound data, they used a long short-term memory (LSTM) network. This type of deep learning model is particularly effective for sequential data. “We were able to train the network to do anomaly detection on the data,” Maginga said.
The patterns in the VOC sensor data were markedly different, necessitating a different approach. The researchers opted for an LSTM network enhanced with convolutional neural network (CNN) layers. This combination allowed the model to capture spatiotemporal patterns and perform a more nuanced analysis of the data.
“After we introduced the preprocessing method and also included these two LSTM and CNN layers, the model was able to show good differentiation between healthy and infected plants, and the performance improved after several development tests,” Maginga said. “Now we are back to deploy these models and see how they perform in the field.”
As the researchers explored different machine learning architectures, the team explored possible combinations of neural networks.
“MathWorks provided a lot of learning resources about combining the LSTM and CNN together,” Maginga said. “And the idea behind trying to explore the wavelet transform also came from those resources.”
Deploying Sensors in the Fields
The application of the machine learning model and IoT sensors developed by Maginga and her team is promising. Their system can detect diseases in maize crops just four to five days after inoculation, a significant improvement compared to the 14 to 21 days it typically takes for visual symptoms to appear.
However, the cost of the technology is a potential barrier for farmers. A full set of sensors and data collection gear currently costs around $50. To get a comprehensive reading of their crops’ status, farmers would need to purchase and set up several installations across their farms. The researchers are working to reduce these deployment costs.
“We are looking to cut the costs of the installation by half. But the real payback is in the higher crop yields,” Maginga said. “By installing this system, farmers will be able to save half of the crops that they would previously lose to diseases.”
The return on investment from each installation could allow farmers to gradually install more sensors across their fields, providing more granular data and improving their disease detection and prevention system. In essence, the system could pay for itself through increased crop yields.
To make their system more accessible to farmers, the researchers are developing chatbots. These digital assistants could simplify the use of the system, providing farmers with easy-to-understand information and advice. Maginga and her team developed a large language model (LLM) chatbot, MkulimaGPT, for the farmers to use. The platform is named after the Swahili word for farmer, mkulima.
The ultimate goal of the project is to translate the outcomes of the disease prediction model into simple, understandable messages for farmers.
LLMs like ChatGPT perform well in languages such as English, where online data is abundant. But the native language of many Tanzanian farmers is Swahili, which does not have abundant training data for LLMs. To address this, the researchers are working on collecting data that could be used to customize models for diagnosing plant diseases.
“We have set up a sample data set of questions and answers. For example, if you come across a disease, how can you tell what stage it’s in? What should you do to manage the disease? What are the common interventions before an expert comes in?” Maginga said. “We are looking into the direction of using the available ChatGPT model to enhance the user experience. We want to help smallholder farmers interact with these state-of-the-art technologies in the most simple and customized way.”
The ultimate goal of the project is to translate the outcomes of the disease prediction model into simple, understandable messages for farmers. This is particularly important for those who may not have skills in data science and analytics or immediate access to experts. These efforts are geared toward empowering farmers to intervene earlier and protect their crops against diseases. This is a prime example of how the use of modern-day technology can have an immediate impact on some of the endemic problems that are plaguing the region.
As the researchers transition from the controlled environment of the lab to the unpredictable conditions of real fields, they are gathering data and fine-tuning their models to better adapt to real-world conditions, where data is noisier and distributions might vary over time.
“Now we are retraining and fine-tuning our models,” Maginga said. “We have great hopes for the VOC sensor as we start deploying the setup in real fields where there are many uncontrolled factors as opposed to controlled lab environments.”
The team is considering expanding their work to other crops, such as tomatoes, which also suffer significant losses from diseases. They are incorporating more expert knowledge to further refine their techniques.
“I see so much potential in agriculture itself, which is yet to be explored, and I’m seeing a lot of research gaps that need to be taken on by the experts,” Maginga said.