Back to Home

Machine Learning Engineer in Punjab
Fasal Doctor Case Study

Fasal Doctor is an offline AI application built for farmers in Punjab to instantly diagnose crop diseases without internet access. Utilizing on-device Machine Learning (TFLite) and the smartphone camera, it scans infected plants, identifies the disease, and provides PAU-affiliated agricultural advisory and treatment plans instantly in the field.

Fasal Doctor AI app logo

Technical Implementation

  • Fine-Tuned Computer Vision

    Custom AI model trained on local agricultural datasets capable of identifying specific regional crop diseases with high accuracy.

  • On-Device Inference (TFLite)

    The neural network runs entirely on the device processor, requiring zero latency and zero cloud API costs.

  • PAU-Affiliated Advisory

    Integrates official treatment data and actionable agricultural advice immediately following a diagnosis.

The Rural Agriculture Challenge

In remote farming communities across Muktsar Sahib, Bathinda, and Faridkot, cellular signals are frequently unstable or absent. When a farmer spots a fungal infection or pest damage on a wheat leaf, sending a high-resolution image to a remote cloud API server is impossible due to network timeouts and expensive mobile data charges.

This network limitation delays vital diagnoses, allowing crop diseases like wheat yellow rust or cotton leaf blight to spread rapidly and destroy entire harvests. Fasal Doctor eliminates this issue by performing 100% of its computational diagnostics directly on the user's mobile device processor.

Model Quantization & Mobile Performance

To run a convolutional neural network on a smartphone without causing CPU overheating or excessive battery drain, I designed an optimized machine learning pipeline.

INT8 Quantization Flow

I trained a custom **MobileNetV2** model on the PlantVillage dataset supplemented with over 3,000 images of regional crop diseases. I then applied Post-Training Quantization (PTQ) to convert weights from 32-bit floats to 8-bit integers, compressing the model size from **54MB to only 11.2MB** with less than 0.8% loss in accuracy.

PAU Chemical Advisory Engine

Once a disease matches a classification confidence threshold of >85%, the app queries a local SQLite database populated with Punjab Agricultural University (PAU) advisory standards. The app displays the exact chemical formulas (e.g., Propiconazole 25 EC), volume calculations, and safety rules in Punjabi and English.

Multi-Threaded Flutter Isolates

Running image inference inside a mobile app requires careful resource management. If the camera stream is processed on the main UI thread, the application's interface will lag or freeze, ruining the user experience. To solve this, I wrote code that sends camera frames to a background **Flutter Isolate**. The background thread handles image scaling, normalization, and inference computation before passing the classification results back to the main UI.

Real-World Field Impact

By deploying this solution locally, farmers receive immediate biological data without spending money on continuous cellular data plans or cloud services. The key advantages of this on-device approach include:

  • Zero Server Costs: Since all diagnostics run on-device, hosting costs do not scale with user volume.
  • Sub-2 Second Latency: Diagnosis is returned almost instantly, regardless of signal strength in deep fields.
  • Empowered Farming: Access to accurate PAU advisories allows farmers to buy the correct pesticide dosage, reducing chemical runoff.

Offline Diagnostics Accuracy & Data Calibration

A major challenge in deploying agricultural computer vision models is the variance in lighting conditions. Sunlight angles, cloud shadows, and dust on camera lenses alter image properties, causing false diagnoses.

To stabilize accuracy, the app runs local image processing filters before inference. The captured camera frame is dynamically adjusted for brightness, contrast, and histogram equalization, ensuring the leaf is clearly distinguished from the background soil before passing the matrix to the interpreter.

The Impact

By shifting the intelligence from the cloud to the edge, Fasal Doctor solves the primary hurdle of agri-tech in India: connectivity. Farmers receive immediate biological analysis directly in remote fields.

FlutterTFLiteComputer VisionOffline AIOn-Device MLAgritech Punjab

Looking for a custom crop scanner or Agtech solution?

Explore my design and consulting services for offline AI mobile tools.