DaViT-Base, Four-Head Crop, Category, Disease and Pest Classifier
One shared DaViT-Base backbone with four classification heads, trained on smallholder-farmer photographs sent to FarmerChat from Ethiopia, India, Kenya and Nigeria. It answers four questions in a single forward pass: which crop, whether the problem is a disease, a pest or nothing, which disease, and which pest.
The disease head is masked by the predicted crop, so it chooses only from diseases recorded on that crop. The pest head is never masked, because an insect looks the same whatever plant it sits on and a wrong crop call should not rule the right insect out.
Heads
| Head | Classes | Notes |
|---|---|---|
| crop | 110 | |
| category | 3 | disease, pest/weed, healthy |
| disease | 285 | 284 disease names plus healthy; masked by the predicted crop |
| pest | 92 | never masked |
87.4M parameters, 224x224 input, fp32 weights.
Results on the held-out test split
These are this checkpoint's own numbers, seed 42, on the 16,273 test images it never saw.
| Head | Accuracy | Rows scored | Macro-F1 |
|---|---|---|---|
| crop | 89.04% | 16,273 | 59.51% |
| category | 89.26% | 16,273 | 88.15% |
| disease | 77.59% | 11,916 | 41.79% |
| pest | 73.60% | 4,276 | 43.42% |
Mean head accuracy 82.37%. The four heads do not share a denominator, so that mean is unweighted.
These differ slightly from the paper's table, for two reasons. The paper reports the mean of two
seeds (42 and 1337), which differ by under a point on every head. The paper also applies a crop synonym
merge before scoring, which folds duplicate classes in the label list (sugar beet with beet,
chili pepper with pepper, and three more) and lifts crop by about 0.9 points. Category, disease,
pest and disease macro-F1 reconcile exactly as the plain two-seed mean.
Training
| Backbone | davit_base.msft_in1k |
| Epochs | 25, best checkpoint at epoch 20 |
| Precision | bf16 |
| Effective batch | 512 (128 per device, 4 devices) |
| Learning rate | 3e-4, 3% warmup, head LR multiplier 5.0 |
| Weight decay | 0.05 |
| Label smoothing | 0.1 |
| Loss weights | crop 1.5, category 0.5, disease 1.0, pest 1.2 |
| Hardware | 4x L40S, distributed data parallel |
| Training images | 82,975 |
Using it
The checkpoint ships as model.safetensors (and the original best.pt, whose model key holds the
same 410 tensors). Load the weights into a DaViT-Base backbone with four linear heads sized as above.
run_meta.json carries the full resolved training configuration.
To reproduce the masked disease behaviour you need crop_disease_mask.npy, a boolean
[110, 285] table of which diseases occur on which crop, published with the evaluation set at
DigiGreen/Crop-Disease-Image-Eval-Synthetic.
Labels, and what they are not
The labels come from a council of eight vision-language models with a consensus vote, not from expert annotation at scale. On images where the council could not agree, the label falls back to the production vendor's own output. So a score against these labels measures agreement with that council, not clinical correctness. The evaluation set published alongside (DigiGreen/Crop-Disease-Image-Eval-Synthetic) excludes every row whose label came from the vendor.
Limitations
- Trained and evaluated on one service's traffic from four countries; it has not been tested elsewhere.
- Crop support is uneven: a small number of crops carry most of the rows, and many have very few.
- The crop and disease heads answer from fixed lists, so anything outside them cannot be named.
- Severity, multiple problems in one image, and progression over time are not modelled.
Citation
The accompanying paper, Configurable Multi-Stage Vision Pipeline for Crop Disease and Pest Diagnosis, is included in this repository (arXiv:2609.21651).