Vernard's picture
agriscan-efficientnet model
b5e92f1 verified
|
raw
history blame
7.74 kB
metadata
library_name: transformers
tags:
  - agriculture
  - plant-disease-classification
  - computer-vision
  - efficientnet
  - Africa
license: apache-2.0
datasets:
  - BrandonFors/Plant-Diseases-PlantVillage-Dataset
language:
  - en
pipeline_tag: image-classification

AgriScan-EfficientNet

Crop Disease Classification Model

Model Details

Model Description

AgriScan-EfficientNet is a vision model fine-tuned to identify diseases in key crops critical to smallholder farmers in Africa. It is the core AI engine of the AgriScan platform—an initiative by CDSA (Cross Domain Solution Architect) to provide accessible, AI-powered agricultural intelligence.

This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.

  • Developed by: Vernard Sharbney Ngomane of CDSA
  • Funded by [optional]: This model was developed as part of a pro-bono innovation project.
  • Shared by [optional]: [More Information Needed]
  • Model type: Image Classification (Fine-tuned EfficientNet)
  • Language(s) (NLP): [More Information Needed]
  • License: Apache 2.0
  • Finetuned from model [optional]: google/efficientnet-b3 (via PyTorch Image Models)
  • Demo: AgriScan Live Demo Space

Model Sources [optional]

Direct Use

This model is intended for direct use in agricultural decision-support systems. Its primary function is to analyze images of plant leaves and predict the presence and type of disease.

  • Primary Use Case: Integration into mobile applications (via TFLite), web APIs, or messaging bots (WhatsApp) to provide instant disease diagnosis for farmers and agricultural extension officers.
  • Educational Use: Can be used in training materials or apps to help students and farmers learn to identify common crop diseases.

Out-of-Scope Use

  • Medical or Human Diagnosis: This model is strictly for plant disease classification.
  • Absolute Decision-Making: Predictions are advisory. Final agricultural decisions should involve human expertise and local context.
  • Non-Visual Data: Cannot analyze soil samples, weather patterns, or textual descriptions alone.

Bias, Risks, and Limitations

  • Geographic & Crop Bias: Trained primarily on the PlantVillage dataset, which may not fully represent the diversity of disease manifestations, camera qualities, and environmental conditions (e.g., specific lighting, soil backgrounds) found across all African farms.
  • Limited Scope: Classifies diseases present in the training set. It is not an "unknown disease detector" and may misclassify novel or regional-specific pathogens.
  • Field Condition Performance: Lab/studio images from PlantVillage may lead to lower accuracy on blurry, angled, or occluded field photos.
  • Mitigation Strategy: The AgriScan project employs IBM AI Fairness 360 (AIF360) for bias auditing and uses a confidence threshold. Low-confidence predictions are flagged for human review.

Recommendations

Users should:

  1. Treat outputs as a first alert system, not a definitive diagnosis.
  2. Be aware of the model's training background and correlate predictions with local agricultural expert knowledge.
  3. Report misclassifications to help improve future model versions.

How to Get Started with the Model

Use the code below to get started with the model.

[```python from transformers import AutoImageProcessor, AutoModelForImageClassification from PIL import Image import torch]

Load model and processor from the Hub

processor = AutoImageProcessor.from_pretrained("VCDSA/agriscan-efficientnet") model = AutoModelForImageClassification.from_pretrained("VCDSA/agriscan-efficientnet")

Load and preprocess an image

image = Image.open("path_to_your_leaf_image.jpg").convert("RGB") inputs = processor(images=image, return_tensors="pt")

Run inference

with torch.no_grad(): logits = model(**inputs).logits

Get prediction

predicted_class_idx = logits.argmax(-1).item() label = model.config.id2label[predicted_class_idx] print(f"Predicted disease: {label}")

Training Details

Training Data

Primary Dataset: Plant-Diseases-PlantVillage-Dataset

Description: Contains over 54,000 images of healthy and diseased leaves across 14 crop species and 38 disease classes.

Preprocessing: Images were resized to 300x300 pixels, normalized using ImageNet statistics, and augmented with random horizontal flips and slight rotations to improve generalization.

Training Procedure

Fine-tuning Regime: Standard supervised fine-tuning on the PlantVillage classification task.

Optimizer: AdamW

Learning Rate: 5e-5 with linear decay

Epochs: 10

Framework: PyTorch, using Hugging Face transformers and timm libraries.

Evaluation

Testing Data, Factors & Metrics

Testing Data: 20% hold-out split from the PlantVillage dataset.

Primary Metric: Top-1 Accuracy

Secondary Metrics: Precision, Recall, F1-Score (computed per class).

Results

Overall Accuracy: 98.7% on the PlantVillage test set.

Note on Real-World Performance: This high accuracy reflects performance on curated lab images. Field performance is actively being evaluated through pilot studies and is expected to be lower. Continuous evaluation with real farmer data is a core part of the AgriScan development cycle.

Model Examination [optional]

Explainability To build trust and transparency, the AgriScan project uses IBM AI Explainability 360 (AIX360) to generate saliency maps (e.g., Grad-CAM). These maps visually highlight the regions of the leaf most influential to the model's prediction, helping users and developers understand the model's "reasoning."

Environmental Impact

  • Hardware Type: 1 x NVIDIA Tesla T4 GPU
  • Hours used: ~4 hours
  • Cloud Provider: Google Colab
  • Carbon Emitted: Estimated < 0.5 kgCO2eq (based on ML CO2 impact calculator)
  • Mitigation: The model's efficiency (EfficientNet architecture) and intended use case—potentially reducing pesticide overuse and crop loss—aim to offset its training footprint with positive environmental impact.

Technical Specifications [optional]

Model Architecture and Objective

EfficientNet-B3

Input

3-channel RGB image (300x300 pixels)

Output

Logits over 38 disease classes (compatible with PlantVillage labels).

Export Formats

Available in PyTorch (.bin), ONNX (.onnx), and TensorFlow Lite (.tflite) formats for cross-platform deployment.

Citation [optional]

@misc{agriscan2025, author = {Ngomane, Vernard Sharbney and CDSA}, title = {AgriScan: An AI-Powered Agricultural Intelligence Platform}, year = {2025}, publisher = {Hugging Face}, url = {https://huggingface.co/VCDSA/agriscan-efficientnet} }

@article{tan2020efficientnet, title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks}, author={Tan, Mingxing and Le, Quoc V.}, journal={International Conference on Machine Learning}, pages={6105--6114}, year={2020}, publisher={PMLR} }

Model Card Contact

For questions, comments, or partnership inquiries regarding the AgriScan model, please open a discussion on the AgriScan Hub community.