Zum Inhalt springen
ModelAufgelistetExtern
Herunterladen

Arabica Coffee Leaf Disease Efficientnet B0

A efficientnetb0 (4.0M params) fine-tuned to classify 5 arabica coffee leaf conditions from close-up RGB crops.

ArtOtherVersionRevision 252d268BBewertung

Modellquelle

Art
Other
Dateigröße
15,5–15,6 MB
Version
vRevision 252d268
Aktualisiert
10. Okt. 2026
Downloads
69
Quelle
Hugging Face

Quellenbeschreibung

Arabica Coffee Leaf Disease Classification — efficientnet_b0

A efficientnet_b0 (4.0M params) fine-tuned to classify 5 arabica coffee leaf conditions from close-up RGB crops.

⚠️ Read this before comparing to published numbers

The source dataset lists 58,549 images. It contains 3,756 unique images — 93.6% of the rows are exact byte-for-byte duplicates. One Healthy image appears 520 times. After also grouping near-duplicate crops of the same leaf (perceptual hash, hamming <= 5), only 2,891 independent images remain.

Class counts collapse dramatically, and the balance inverts — Healthy is the largest class as listed and the smallest in reality:

ClassListed rowsByte-uniqueIndependent groups
Cerscospora7,681322317
Healthy18,9836248
Leaf_rust8,3361,042918
Miner16,9781,639923
Phoma6,571691685
TOTAL58,5493,7562,891

This model is trained and evaluated on the deduplicated, group-disjoint data, so no near-duplicate crop appears in more than one split.

The obvious expectation is that removing this much duplication should crater the score. It does not — and reporting that honestly matters more than a tidy story:

Split protocoln trainTest accuracyTest macro-F1
Naive random split over all 58,549 rows (leaky)40,9811.00001.0000
Group-aware split over 2,891 independent images (honest)2,6280.99110.9941

The leaky protocol buys only +0.0089 accuracy / +0.0059 macro-F1. So on this dataset the duplication inflates the apparent size (58,549 vs ~2,891 real images) far more than it inflates the score. These five classes are simply easy to separate: a model trained on 2,628 images with no duplicate leakage still reaches 99.11%.

Do not read this as "leakage is harmless" in general — it is a property of this dataset's easy class boundaries. Read it as: this dataset is ~20x smaller than its row count suggests, and its headline accuracies are not evidence of much.

Results (honest split, test n=564)

MetricScore
Accuracy0.9911
Macro-F10.9941

Measured with timm's canonical inference transform (224px, crop_pct=0.875, bicubic), i.e. exactly the preprocessing the Usage snippet produces.

Per-class

ClassPrecisionRecallF1Test supportTrain images
Cerscospora1.0001.0001.00048226
Healthy1.0001.0001.000943
Leaf_rust1.0000.9810.990156729
Miner0.9801.0000.9902461147
Phoma1.0000.9810.990105483

Intended use

Research and educational use only. Not a substitute for agronomist diagnosis. The Healthy class is supported by only 43 training images from 48 independent sources — treat its predictions with particular suspicion.

Training

  • Backbone: efficientnet_b0 (ImageNet-pretrained, via timm)
  • Data: 2628 train / 564 val / 564 test, split by near-duplicate group (70/15/15), verified zero group overlap
  • Resolution: 224x224 (source crops are mostly 128x128, so they are upscaled)
  • Optimiser: AdamW, OneCycle LR (max 3e-4), weight decay 0.05, 20 epochs, batch 64
  • Loss: cross-entropy, label smoothing 0.1, no class weighting (uniform)
  • Augmentation: random resized crop (0.6-1.0), h/v flip, colour jitter, random erasing
  • Precision: bf16 autocast. Selection: best val macro-F1.

Usage

import timm, torch
from PIL import Image

model = timm.create_model("hf-hub:Huyt/arabica-coffee-leaf-disease-efficientnet-b0", pretrained=True).eval()
cfg = timm.data.resolve_data_config({}, model=model)
tf = timm.data.create_transform(**cfg)

img = Image.open("leaf.jpg").convert("RGB")
with torch.no_grad():
    probs = model(tf(img).unsqueeze(0)).softmax(-1)[0]

idx = int(probs.argmax())
print(model.pretrained_cfg["label_names"][idx], float(probs[idx]))

Class order (index -> label):

['Cerscospora', 'Healthy', 'Leaf_rust', 'Miner', 'Phoma']

Limitations

  • The dataset is ~20x smaller than advertised. 2,891 independent images, not 58,549. Everything below follows from that.
  • Healthy is critically under-supported: 48 independent images total. Its metrics rest on 9 test images and are not trustworthy.
  • Crops, not leaves. Inputs are close-up patches (mostly 128x128), not whole leaves. The model expects similar close-ups; it is not a whole-plant or field classifier.
  • Near-duplicate grouping is a lower bound. Perceptual hashing at hamming <= 5 catches tight crops of the same lesion. Wider crops of the same leaf may survive as separate groups, so residual same-source optimism may remain even in the honest number. A nearest-neighbour probe (ImageNet embeddings, test vs train) found the honest split's residual-similarity signal to be no worse than a comparably-built rice split (+0.42 vs +0.52 excess over the same-class baseline), but that probe cannot cleanly separate leakage from a genuinely low-diversity dataset. Treat 99.11% as an upper bound on real-world performance.
  • The test set is small. 564 images; at 99.11% accuracy that is ~5 errors total. Per-class figures rest on tens of images and carry wide error bars.
  • Single-source dataset (JMuBEN / JMuBEN2, Kenya). No external validation; the lab->field gap is unmeasured.

Reproduction

coffee_dedup.py (hashing + grouping), coffee_split.py (both splits), coffee_train.py (training), coffee_eval_final.py (canonical-transform eval) are included in this repo.

Dataset citation

@article{jepkoech2021arabica,
  title={Arabica coffee leaf images dataset for coffee leaf disease detection and classification},
  author={Jepkoech, Jennifer and Mugo, David Muchangi and Kenduiywo, Benson K and Too, Edna Chebet},
  journal={Data in brief}, volume={36}, pages={107142}, year={2021}, publisher={Elsevier}
}

Quellen

1 Quelle
Hugging FacePrimärVersion 252d26841543befab22880876f8ca91543230aab
huggingface.co/Huyt/arabica-coffee-leaf-disease-efficientnet-b0/tree/252d26841543befab22880876f8ca91543230aab

Verifiziert 10. Okt.

Modellartefakte

2 Artefakte

model.safetensors

safetensors · 15,5 MB · SHA-256 f7ed56b64868…286f · Hugging Face

Herunterladen

pytorch_model.bin

bin · 15,6 MB · SHA-256 cd25ca129c08…4abf · Hugging Face

Herunterladen

Quellenauszüge

3 Auszüge

--- license: cc-by-4.0 tags: - image-classification - agriculture - plant-disease - coffee - timm library_name: timm pipeline_tag: image-classification datasets: - Project-AgML/arabica_coffee_leaf_disease_classification metrics: - accuracy - f1 --- # Arabica Coffee Leaf Disease Classification — efficientnet_b0 A `efficientnet_b0` (4.0M params) fine-tuned to classify 5 arabica coffee leaf conditions from close-up RGB crops. ## ⚠️ Read this before comparing to published numbers The source dataset lists **58,549 images**. It contains **3,756 unique images** — **93.6% of the rows are exact byte-for-byte duplicates**. One `Healthy` image appears **520 times**. After also grouping near-duplicate crops of the same leaf (perceptual hash, hamming <= 5), only **2,891 independent images** remain. Class counts collapse dramatically, and the balance inverts — `Healthy` is the *largest* class as listed and the *smallest* in reality: | Class | Listed rows | Byte-unique | Independent groups | |---|---|---|---| | Cerscospora | 7,681 | 322 | **317** | | Healthy | 18,983 | 62 | **48** | | Leaf_rust | 8,336 | 1,042 | **918** | | Miner | 16,978 | 1,639 | **923** | | Phoma | 6,571 | 691 | **685** | | **TOTAL** | **58,549** | **3,756** | **2,891** | **This model is trained and evaluated on the deduplicated, group-disjoint data**, so no near-duplicate crop appears in more than one split. The obvious expectation is that removing this much duplication should crater the score. It does not — and reporting that honestly matters more than a tidy story: | Split protocol | n train | Test accuracy | Test macro-F1 | |---|---|---|---| | Naive random split over all 58,549 rows (**leaky**) | 40,981 | 1.0000 | 1.0000 | | Group-aware split over 2,891 independent images (**honest**) | 2,628 | **0.9911** | **0.9941** | The leaky protocol buys only **+0.0089 accuracy** / **+0.0059 macro-F1**. So on this dataset the duplication inflates the *apparent size* (58,549 vs ~2,891 real images) far more than it inflates the *score*. These five classes are simply easy to separate: a model trained on 2,628 images with no duplicate leakage still reaches 99.11%. Do not read this as "leakage is harmless" in general — it is a property of this dataset's easy class boundaries. Read it as: this dataset is ~20x smaller than its row count suggests, and its headline accuracies are not evidence of much. ##...

Source context: 69 downloads · 2 likes · Pipeline image-classification · Library timm · Repo Huyt/arabica-coffee-leaf-disease-efficientnet-b0

Source context: 162 downloads · 0 likes · Pipeline image-classification · Library timm · Repo Huyt/arabica-coffee-leaf-disease-efficientnet-b0