GreenAI: An Explainable AI and IoT-Enabled Offline Framework for Precision Agriculture
This paper introduces GreenAI, an offline-first, explainable AI and IoT-enabled framework tailored for precision agriculture in Pakistan that integrates high-performance crop recommendation and disease diagnosis models with transparent decision support and edge computing to deliver scalable, farmer-centric solutions in low-connectivity environments.
Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
In the vast, sun-drenched fields of Pakistan's Punjab province, the future of farming is being rewritten not just by the seasons, but by the quiet hum of technology working in the dirt. For generations, farmers have relied on intuition and experience to decide what to plant, when to water, and how to treat ailing crops. Today, a new approach known as precision agriculture seeks to refine these ancient practices with data, using sensors and computers to make decisions that are both smarter and more sustainable. This field relies on three main pillars working together: the Internet of Things, which connects simple sensors to the digital world; artificial intelligence, which finds patterns in vast amounts of information to offer advice; and a newer concept called explainable AI, which ensures that the computer does not just give an answer, but explains why it gave that answer. The goal is to move beyond generic rules and provide guidance that fits the specific soil, weather, and crops of a single farm, even in places where the internet connection is unreliable or non-existent.
Against this backdrop, a team of researchers from universities in Faisalabad and Rawalpindi has developed a system called GreenAI. This is not a cloud-based service that requires a constant internet connection to function; instead, it is designed to work offline, carrying the intelligence directly to the farmer's device. The system acts as a comprehensive digital assistant, combining four distinct capabilities into one unified platform. It recommends the best crops to plant based on local soil conditions, diagnoses diseases from photos of leaves, monitors the environment in real-time, and provides market insights. Crucially, every recommendation the system makes is backed by a clear explanation, allowing the farmer to understand the reasoning behind the advice, which builds trust in a technology that might otherwise feel like a black box.
To make this system truly useful for the region, the researchers first had to build a foundation of local knowledge. They created a specialized dataset containing information on 19 major crops grown in Punjab, such as rice, cotton, wheat, and mango. This collection includes 9,500 balanced examples, each recording the specific mix of soil nutrients, temperature, humidity, and rainfall that led to a successful harvest. Using this data, they tested several different computer algorithms to see which one could best predict the right crop for a given set of conditions. The algorithm that emerged as the most effective was a model known as XGBoost. When tested on new, unseen data, this model correctly identified the best crop 97.40 percent of the time. It also achieved a high score in balancing its predictions across all different crop types, proving it could handle the diversity of the region's agriculture without favoring one crop over another.
The system does not stop at telling farmers what to plant; it also helps them protect their crops. The researchers developed a visual diagnosis tool that can identify plant diseases by analyzing images of leaves. They trained a deep learning model on a massive collection of 113 different disease categories, ranging from common fungal infections to specific pests affecting local crops. This model, built on a streamlined architecture called EfficientNetV2-S, learned to recognize the subtle signs of illness with remarkable precision. In its testing phase, the system correctly identified the disease in 99.03 percent of cases. To ensure farmers could trust these diagnoses, the system includes a visual aid that highlights exactly which parts of the leaf image triggered the alarm, showing the user the specific spots of discoloration or damage that led to the conclusion.
A major innovation in GreenAI is its ability to function without a steady internet connection, a critical feature for rural areas where networks often fail. The researchers integrated a small, low-cost sensor node based on a microchip called the ESP32. These devices can be placed directly in the soil to continuously measure moisture, temperature, and acidity. The sensor stores this data locally on a small memory card, allowing it to keep working even when the network is down. Once a connection becomes available, the data is automatically sent to a central system for analysis. This "offline-first" design ensures that the farm's monitoring never stops, regardless of the connectivity outside. The system is also designed to be lightweight, meaning the complex calculations can be performed on the device itself or on a simple server, rather than requiring massive, expensive cloud infrastructure.
To make the technology accessible and trustworthy, the researchers integrated a layer of transparency into every step of the decision-making process. When the system suggests a crop, it does not just output a name; it uses a method called SHAP to show which factors mattered most. For instance, the analysis revealed that rainfall was the single most influential factor in deciding which crops to plant, followed closely by the nitrogen levels in the soil. The system also uses partial dependence plots to show how changing one variable, like increasing the soil pH, would shift the recommendation. This level of detail allows a farmer to see that the advice is grounded in real agricultural science, not just a random guess. Similarly, for disease detection, the system highlights the specific areas of a leaf image that indicate a problem, making the diagnosis visible and understandable.
The entire framework was tested in a real-world setting to prove its viability. The researchers built a prototype sensor node and deployed it in a field, where it successfully collected and transmitted environmental data. The system demonstrated that it could handle the full workflow: gathering data from the soil, analyzing it with artificial intelligence, and delivering actionable advice to a mobile device. The response times were incredibly fast, with crop recommendations generated in less than three milliseconds on a standard computer, and even faster on the small edge devices used in the field. This speed, combined with the ability to operate without the internet, means that a farmer can receive critical advice the moment they need it, whether they are standing in a remote field or checking their phone in a village with spotty service.
GreenAI represents a significant step toward making advanced agricultural technology practical for the people who need it most. By combining accurate crop recommendations, highly reliable disease detection, and real-time environmental monitoring into a single, offline-capable system, the researchers have created a tool that respects the realities of rural life. The high accuracy rates, ranging from 97.40 percent for crop selection to 99.03 percent for disease diagnosis, suggest that the system is ready for wider use. More importantly, by making the AI's reasoning visible and understandable, the project bridges the gap between complex computer science and the daily decisions of a farmer. As the researchers continue to refine the mobile application and expand the system to cover more regions, the vision is clear: a future where every farmer, regardless of their location or internet access, has a powerful, intelligent partner in the field.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.