Downloads · 30 days
31
30% of all-time downloads
Madras1/plantdoc-rtdetrv2-leaf-disease-detector
plantdoc-rtdetrv2-leaf-disease-detector is a object detection model from Madras1. Use it when you need objects located in an image. It is set up for transformers. The card lists the license as apache-2.0.
RT-DETRv2-R18 fine-tuned for object detection on an audited and cleaned version of the PlantDoc dataset.
Downloads · 30 days
31
30% of all-time downloads
All-time downloads
103
Public
Parameters
20.1M
81 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors80.6 MB · 99%
From the Hugging Face model README
RT-DETRv2-R18 fine-tuned for object detection on an audited and cleaned version of the PlantDoc dataset.
The model detects leaf regions and assigns one of 27 plant or disease categories. It does not segment individual lesions and should not be interpreted as a clinically or agronomically validated diagnostic system.
PekingU/rtdetr_v2_r18vdThe source dataset was agyaatcoder/PlantDoc, originally containing
2,578 images in its train and test splits.
Before training, the dataset was audited for invalid boxes, incorrect image dimensions, exact duplicates, perceptual duplicates, conflicting labels and extremely rare classes.
Final frozen splits:
| Split | Images | Boxes |
|---|---|---|
| Train | 2,009 | 6,863 |
| Validation | 245 | 853 |
| Test | 247 | 966 |
All 27 retained classes occur in every split. Known exact and perceptual duplicate pairs between splits were removed.
The final split manifest and cleaning summary are included in this repository.
The test split was evaluated once after model selection using only the validation split.
| Metric | Validation | Test |
|---|---|---|
| mAP@[0.50:0.95] | 0.279448 | 0.239394 |
| [email protected] | — | 0.336945 |
| [email protected] | — | 0.267526 |
| mAP small | — | 0.000000 |
| mAP medium | — | 0.140294 |
| mAP large | — | 0.260317 |
| mAR@100 | — | 0.662587 |
Strongest test classes included:
| Class | AP |
|---|---|
| Corn rust leaf | 0.756111 |
| grape leaf | 0.565980 |
| Apple leaf | 0.468707 |
| Strawberry leaf | 0.406445 |
| Squash Powdery mildew leaf | 0.388265 |
Several tomato and potato disease classes obtained substantially lower
AP. Complete per-class results are available in
test_per_class_metrics.csv.


A global confidence threshold of 0.075 was selected exclusively on the validation split by maximizing detection F1 at IoU 0.50:

The threshold is intentionally permissive. For a cleaner visualization
with fewer predictions, try values between 0.10 and 0.15.
Application-specific threshold calibration is recommended.
from PIL import Image
from transformers import pipeline
detector = pipeline(
task="object-detection",
model="Madras1/plantdoc-rtdetrv2-leaf-disease-detector",
)
image = Image.open("plant.jpg").convert("RGB")
predictions = detector(image, threshold=0.075)
for prediction in predictions:
print(prediction)
python inference.py plant.jpg \
--threshold 0.075 \
--output prediction.png
The script automatically uses CUDA when available and otherwise runs on CPU.
test mAP small = 0).model.safetensors: trained model weightsconfig.json: model architecture and class mappingpreprocessor_config.json: image preprocessing configurationinference_config.json: recommended inference settingsinference.py: local inference and visualizationcleaning_summary.json: dataset-cleaning summarysplit_manifest.csv: frozen split manifesttraining_history.csv: epoch-level historytest_metrics.json: aggregate test metricstest_per_class_metrics.csv: per-class test metricsDataset photographs are not redistributed in this model repository.
The base model PekingU/rtdetr_v2_r18vd is distributed under the
Apache License 2.0.
The Hugging Face dataset agyaatcoder/PlantDoc declares the
CC BY 4.0 license. Users of the source dataset must preserve its
required attribution.
@inproceedings{10.1145/3371158.3371196,
author = {Singh, Davinder and Jain, Naman and Jain, Pranjali and
Kayal, Pratik and Kumawat, Sudhakar and Batra, Nipun},
title = {PlantDoc: A Dataset for Visual Plant Disease Detection},
year = {2020},
publisher = {Association for Computing Machinery},
doi = {10.1145/3371158.3371196},
booktitle = {Proceedings of the 7th ACM IKDD CoDS and
25th COMAD},
pages = {249--253}
}