Agri snap
Your farm's health in a heartbeat
The problem Agri snap solves
AgriSnap solves the critical problem of delayed or inaccessible agricultural expertise for smallholder farmers. When farmers discover a potential disease on their crops, they often have no immediate way to identify it, leading to incorrect treatment, widespread crop loss, and significant financial hardship. This information gap is a major contributor to the estimated 40% of crop yield lost globally each year.
How People Can Use It
AgriSnap acts as an AI-powered agronomist that fits in a farmer's pocket, making their work easier, faster, and more effective.
-
Instant Disease Diagnosis
A farmer can simply take a photo of a suspicious leaf on their plant. Instead of guessing or waiting days to find an expert, the app uses a Convolutional Neural Network (CNN) to analyze the image and provide an accurate diagnosis within seconds. This transforms a moment of uncertainty into a moment of clarity. -
Actionable Treatment Advice
The app doesn't just identify the problem; it provides a solution. Farmers receive clear, step-by-step advice on how to treat the specific disease, including recommendations for organic sprays or commercial pesticides, along with correct dosages. This prevents the overuse of incorrect chemicals, making farming safer and more sustainable. -
On-Demand Expert Support
Our integrated Rasa chatbot acts as an on-demand assistant. Farmers can ask follow-up questions in their own language, get connected to nearby suppliers for recommended products, or receive information on relevant government support schemes. It replaces the difficult task of finding information with a simple conversation.
Challenges we ran into
One of the biggest hurdles we ran into was the high latency of the disease prediction API. When we first integrated the system, the time between a user snapping a photo and receiving a diagnosis was over 10 seconds, which is far too long for a smooth mobile experience, especially on a slow network.
The Problem
The slowness came from two main bottlenecks:
Large Image Uploads: The React Native app was sending the raw, high-resolution image file directly from the phone's camera. Uploading these large files (often 3-5 MB) over a mobile network was a major source of delay.
Model Loading Time: Our initial implementation in Django loaded the entire TensorFlow CNN model from the disk for every single API request. This model-loading step alone was taking several seconds, creating a severe bottleneck on the server side.
How We Solved It
We tackled this with a two-part optimization strategy:
-
Client-Side Image Compression
First, we implemented an image processing library (expo-image-manipulator) in the React Native app. Before uploading, the app now resizes the image to a more manageable resolution (like 800x800 pixels) and compresses it to a high-quality JPEG. This drastically reduced the file size to under 200 KB without a significant loss in quality for the model's prediction, cutting down the upload time by over 90%. -
Pre-loading the AI Model
Second, we refactored our Django backend. Instead of loading the model on each request, we now load our trained TensorFlow (.h5) model into memory once when the Django server first starts up. We configured it as a global singleton object. This way, every subsequent API call to the prediction endpoint could access the already-loaded model instantly, completely eliminating the model-loading delay from the response time.
By combining these client-side and server-side optimizations, we successfully reduced the total prediction time from over 10 seconds to an average of just 2-3 seconds, creating a responsive and practical application for our users.
Tracks Applied (1)
