Back to projects
FarmIntel logo

FarmIntel

FarmIntel is an agricultural intelligence system designed to help farmers and agro-enterprises make smarter data-driven decisions and optimize farming operations. It comes with ML pest and plant disease detection, as well as real-time weather and crop yield predictions, AI recommendations for optimal farming practices, and a community of farmers and agro-enterprises to share knowledge and best practices.

Accomplishments

  • Trained a transfer-learning image classifier using a pretrained efficientnet_b0 backbone (via the timm library) fine-tuned on the PlantVillage dataset for leaf disease classification.
  • Supported classification across 15 disease/health classes covering Pepper, Potato and Tomato crops (e.g. Tomato__Tomato_YellowLeaf__Curl_Virus, Potato___Late_blight, Pepper__bell___Bacterial_spot).
  • Built a full training pipeline: 224×224 input, AdamW optimizer (lr 1e-4), CrossEntropyLoss, and a CosineAnnealingLR scheduler over 15 epochs with batch size 32.
  • Applied data augmentation (random resized crop, horizontal flip, rotation, color jitter) plus ImageNet normalization to improve generalization.
  • Implemented a best-checkpoint save strategy that tracks validation accuracy each epoch and persists only the best-performing weights to best_model.pth.
  • Wrote a dataset-splitting utility to automatically partition the raw PlantVillage dataset into an 80/20 train/val split in ImageFolder structure.
  • Auto-generated the class label file (labels.txt) from the dataset folders during training so inference labels always stay in sync.
  • Built a production inference class LeafDiseaseModel that loads the trained model once globally (avoiding per-request reload) and returns top-k predictions with confidence scores.
  • Added an uncertainty-estimation capability via Monte Carlo Dropout (predict_image with mc_dropout_runs), returning per-class probability and standard-deviation uncertainty.
  • Exposed the model through a REST API endpoint (DiseaseDetectView) that accepts image uploads and returns predictions plus alternatives.
  • Added a confidence threshold (0.60): low-confidence predictions return an "unsure" response with candidate matches instead of a single answer, reducing misleading diagnoses.
  • Integrated a Gemini-powered TreatmentService that generates structured, actionable treatment plans (immediate actions, chemical control, organic control, prevention) for each detected disease.

Links

Skills used

PythonDjangoDjango REST FrameworkPostgreSQLPyTorchtimm (EfficientNet-B0)Ultralytics YOLOv8Google Gemini APIJWTCloudinaryPaystack

Status

Completed
Not Live