AWS Spatial Computing Blog
Empowering Sustainable Agriculture with AI-Powered Leaf Nutrient Sensing on AWS
The Challenge of Nutrient Management in Agriculture
For decades, fertilizers have been essential to producing healthy crops and maintaining yield. Yet in many orchards today, especially those growing pistachios, grapes, and almonds across California, the benefits of extra fertilizer are beginning to level off. Growers often apply more nutrients than the plants actually need because there is little reliable, real-time information about the condition of each tree.
When that information is missing, overapplication becomes the default. The unused portion of these fertilizers seeps into the soil and eventually reaches groundwater, adding to problems like nitrate pollution and eutrophication. In response, regulations on fertilizer use are becoming tighter, and growers are looking for more intelligent ways to manage fertilizers efficiently while protecting both yield and quality.
Currently, most nutrient testing still relies on sending leaf samples to chemical laboratories. A few leaves from different parts of an orchard are collected, mixed together, and treated as a single sample. After several days, the lab returns one average value for the entire field. This number says little about how nutrient levels vary from tree to tree or block to block.
Because of that limited view, growers must often make decisions with incomplete data. Some trees may receive too much fertilizer, others not enough. The result is wasted resources and uneven crop performance. Recognizing these challenges, we set out to develop a better approach that captures the true variability across the farm and gives growers the insight they need to act with confidence.
Building the Future of Leaf Nutrient Analysis
At the Digital Agriculture Lab at the University of California, Davis, we developed a new solution: a deep learning model that uses hyperspectral reflectance data from leaves to predict 16 important leaf traits, including nitrogen, phosphorus, potassium, calcium, magnesium, and more.
This AI model is now integrated into a complete digital pipeline, accessible through both a mobile app and a web platform. Growers can walk through their fields, scan individual leaves using a handheld spectrometer connected via Bluetooth to our mobile app, and receive trait predictions in seconds.
For users who already have spectral data, our web application at digitalaglab.com allows simple upload and instant predictions.
But for all of this to work fast, reliable, and scalable, we needed a robust cloud infrastructure. We built the platform using several key AWS services, including AWS Lambda, Amazon API Gateway, Amazon Cognito, and Amazon S3, which together enable secure data flow, efficient processing, and seamless scalability.

Authors Parastoo Farajpoor (right) and Dr. Pourreza (left) demonstrating the app with a local grower (middle)
Powering Instant, Scalable Predictions from Field to Cloud
At the core of our platform is a cloud-based system that delivers real-time insights directly to growers. Whether they are scanning an individual tree or managing an entire orchard, users receive meaningful results in just seconds.
When a grower scans a leaf using the mobile app, the device captures the spectral data and sends it through an internet connection to our cloud system. There, a trained AI model processes the data and returns trait predictions almost immediately. The entire process happens fast enough to support in-field decision-making.
We built this system in the cloud to ensure it can grow with demand. Our goal was to create something that is reliable, secure, and capable of running at full speed regardless of location or load. Offloading model inference and data processing to the cloud allows the app to remain lightweight and responsive, even in areas with limited connectivity. The result is a system that works just as well in a single field as it does across multiple farms. As adoption increases, the platform is ready to support more users and more data without any interruption in service.
This cloud infrastructure gives us the flexibility to meet growers where they are and deliver insights exactly when and where they are needed. It is a critical part of how we make advanced plant science tools accessible to the people who feed the world.
Delivering Outcomes for Growers and the Environment
Traditional chemical testing takes time and typically offers only a single average value to represent an entire field. By replacing that approach with fast and detailed leaf-level analysis, we are giving growers the ability to understand the nutrient status of their crops with much higher resolution. They can now capture the nutrient profile of individual blocks or even specific trees whenever they need it.
This approach allows growers to apply fertilizer more efficiently and avoid using more than necessary. It helps improve yield and fruit quality by matching nutrient supply with actual crop needs. It also reduces the risk of excess fertilizer reaching groundwater, which is important for protecting natural resources. And as regulations around nutrient application continue to tighten, this technology provides the data needed to comply with those rules without guesswork.
Growers who have tested the early versions of the system so far are not just impressed by the speed and convenience. They seethe potential for long term change. With better data and better timing, they can achieve both productivity and sustainability. This technology makes that possible.
What’s Next?
We’re continuing to refine our AI models with more data, broader trait prediction, and improved generalizability across crop types and growing conditions. Future versions will support other crops and a mapping function to create a more comprehensive picture of within-field spatial variability.
Our vision is to make high-resolution nutrient sensing accessible to every grower, from small family farms to large commercial operations, anywhere in the world.

Video of the AI-powered app being tested with growers