Instructions to use TamAko783/TPDD_Honglin_CLS-yolo26n-cls with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use TamAko783/TPDD_Honglin_CLS-yolo26n-cls with ultralytics:
# Couldn't find a valid YOLO version tag. # Replace XX with the correct version. from ultralytics import YOLOvXX model = YOLOvXX.from_pretrained("TamAko783/TPDD_Honglin_CLS-yolo26n-cls") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
yolo26n-cls β Tobacco Leaf Abnormality β Model Family
A family of YOLO26-nano classification models (ImageNet-pretrained, fine-tuned) for tobacco leaf abnormality identification on the TLA dataset. Two members:
| Member | Weights | Training data |
|---|---|---|
| Base | base/yolo26n-cls-base.pt |
canonical real images + Tier-3 lesion-paste + colour-safe oversampling (dataset_yolo_cls) |
| Synthetic | synth/yolo26n-cls-synth.pt |
Base, fine-tuned on combined_synth = canonical + 762 SD-turbo diffusion rare-class variants |
Both classify all 16 TLA classes. val/test are 100% real and identical for both.
Dataset credit
Data collected & annotated by Hong Lin, Rita Tse, Su-Kit Tang, Zhenping Qiang, Giovanni Pau et al. (Macao Polytechnic University) β TLA / TPDD. Original repository: https://github.com/honglin1226/Tobacco-Plant-Disease-Dataset. Cite TPDD (ICDIP 2022, 10.1117/12.2644288) and FREN (Frontiers in Plant Science 2024, 10.3389/fpls.2024.1333236). Models trained by TamAko783 (not the data creator). The source dataset carries no explicit license β these models are released for non-commercial research only.
Evaluation scope β COMMON classes only
Under the leakage-safe 80/10/10 split, the four long-tail classes (anthracnose,
black_shank, tswv, genetic_abnormality) have only n=1 held-out image each,
so a per-class score there is a coin-flip. They are predicted by the models but
NOT benchmarked. All headline metrics below are over the 12 common classes
(β₯8 test images): wildfire, brown_spot, frog_eye, target_spot, tmv, cmv, pvy,
weather_fleck, sunscald, potato_tuber_moth, nematodes, healthy.
Results (12 common classes, held-out real test = 120 images)
| Metric | Base | Synthetic |
|---|---|---|
| Top-1 | 0.891 | 0.920 |
| Macro-F1 (single split) | 0.884 | 0.900 |
| Macro-F1 (5-fold CV) | 0.933 Β± 0.012 | β |
| Reference: FREN 16-way 10-shot | 0.818 | 0.818 |
The 5-fold cross-validation (every real leaf rotated through the held-out fold) is the trustworthy benchmark for the Base model: macro-F1 0.933, top-1 ~0.936, tight across folds β comfortably past the paper's 0.818, with no single-image luck.
Per-class F1 (common 12, single-split test)
| class | Base | Synthetic | Ξ |
|---|---|---|---|
| wildfire | 0.973 | 1.000 | +0.03 |
| weather_fleck | 0.957 | 1.000 | +0.04 |
| tmv | 0.889 | 0.963 | +0.07 |
| target_spot | 0.842 | 0.952 | +0.11 |
| sunscald | 0.857 | 0.929 | +0.07 |
| potato_tuber_moth | 0.889 | 0.947 | +0.06 |
| healthy | 0.909 | 0.952 | +0.04 |
| nematodes | 0.750 | 0.800 | +0.05 |
| frog_eye | 0.952 | 0.952 | 0 |
| brown_spot | 0.952 | 0.952 | 0 |
| cmv | 0.870 | 0.800 | β0.07 |
| pvy | 0.769 | 0.545 | β0.22 |
Takeaway: the Synthetic fine-tune raises overall common-class accuracy
(top-1 +2.9pp, macro-F1 +1.6pp) and lifts most classes, but degrades the
mosaic-virus classes (pvy, cmv) β the diffusion rare-class variants appear
to blur virus-specific cues. Use Base when virus discrimination matters; use
Synthetic for best overall top-1.
Usage (apply the training preprocessing!)
Both models were trained on Shades-of-Gray colour-constancyβnormalised images.
A raw predict("leaf.jpg") on an unnormalised photo is off-distribution. Use the
repo's predict.py, or replicate it:
import numpy as np
from PIL import Image, ImageOps
from ultralytics import YOLO
def shades_of_gray(img, p=6):
x = img.astype(np.float32)
illum = np.maximum(np.power(np.mean(np.power(x, p), axis=(0, 1)), 1.0 / p), 1e-6)
return np.clip(x * (illum.mean() / illum), 0, 255).astype(np.uint8)
model = YOLO("base/yolo26n-cls-base.pt") # or synth/yolo26n-cls-synth.pt
im = ImageOps.exif_transpose(Image.open("leaf.jpg")).convert("RGB")
im = Image.fromarray(shades_of_gray(np.asarray(im)))
r = model.predict(im)
print(r[0].probs.top1, model.names[r[0].probs.top1])
Training (reproducible)
yolo26n-cls.pt(ImageNet), imgsz 256, batch 64, optimizer auto, cos_lr, dropout 0.1, label_smoothing 0.1, Tier-1 colour-safe online augmentation.- Base: 200 epochs (early-stopped ~28) on
dataset_yolo_cls(1295 train: 1122 real + 74 lesion-paste + 99 oversample; val 138 / test 138, 100% real). - Synthetic: Base fine-tuned 80 epochs on
combined_synth(Base train + 762 diffusion variants of the rare classes; val/test unchanged, 100% real). - Reproduce:
scripts/00_build_all.pyβtrain_part2.py(Base) β11_synthetic_variants.py+08b_combine_synth.pyβtrain_part2.py --model base.pt(Synthetic). Benchmark:eval_kfold.py(k-fold) /eval_part2.py(single split).
Files
base/yolo26n-cls-base.pt, synth/yolo26n-cls-synth.pt,
base/per_class_metrics.csv, synth/per_class_metrics.csv, this card.
License
Derived from the TLA/TPDD images, which carry no explicit license (https://github.com/honglin1226/Tobacco-Plant-Disease-Dataset). Released for non-commercial academic research only, with attribution and no ownership claim. Original authors may open an issue for takedown.
- Downloads last month
- 35