/ Модель

Характеристики

Лицензия
MIT
Библиотека
pytorch
Опубликована
25 окт 2026

plantdx-models

Классификация изображенийИзображение → label3 профессии
0скачиваний за 30 дней0лайковвеса обновлены26 окт 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

PlantDx классифицирует фотографию отдельного листа одной из 39 меток заболеваний, культур или фона и предназначена для учебных демонстраций и предварительной подсказки по симптомам.

PlantDx — модель классификации заболеваний листьев растений, разработанная Хайдером Али в рамках учебного проекта King's College London. Она принимает фотографию одного листа и относит её к одному из 39 классов: 38 классов культур и состояний для 14 видов культур, а также класс фона без листьев. Это обученная с нуля свёрточная нейронная сеть VGG-типа с четырьмя блоками свёрток, пакетной нормализации и пулинга; в ней около 1,25 млн параметров.

Модель предназначена для учебной демонстрации полного ML-процесса и предварительной подсказки по симптому на хорошо освещённом одиночном листе на простом фоне. На отложенной выборке лабораторных изображений указаны точность 99,64% и macro F1 0,995, однако на 2 578 реальных фотографиях PlantDoc точность составляет лишь 9,7%. Поэтому модель не подходит для полевых снимков, определения тяжести или локализации поражений и не должна служить основанием для агрономических решений без консультации специалиста. Веса опубликованы в формате safetensors; лицензия — MIT.

Сценарии применения

  • Предварительная классификация болезни на фото одного листа на простом фоне
  • Учебная демонстрация обучения и оценки модели компьютерного зрения
  • Показ распознавания 14 видов культур и их состояний на изображениях PlantVillage

Ограничения

Модель обучена на лабораторных фотографиях одиночных листьев и не проверена для полевых условий: на наборе PlantDoc точность составляет 9,7%. Она всегда выбирает одну из 39 меток, не оценивает тяжесть и расположение поражения и не должна использоваться для принятия решений о лечении или пестицидах без специалиста.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Model Card: PlantDx leaf disease classifier

Status: v1, 23 Oct 2026. Follows Mitchell et al. (2019), "Model Cards for Model Reporting". Every number links to a file in results/ (committed snapshot, regenerated by scripts/snapshot_results.py) or report/tables/, which in turn come from ClearML tasks (offline session ids in results/offline_sessions.jsonl, imported to the ClearML server on 25 Oct 2026; mapping in results/imported_sessions.json). Draft for Haider Ali to review.

FieldValue
ProjectPlantDx, 5CCSAGAP Small Group Project, King's College London
TeamHaider Ali (solo team). Team number: TBC
Repositoryhttps://github.com/HaiderAli3D/plantdx-5ccsagap
Model weightshttps://huggingface.co/Haider3D/plantdx-models (folders cnn/, resnet18/, mobilenetv3/)
Live apphttps://huggingface.co/spaces/Haider3D/plantdx
Related docsdocs/data.md, docs/requirements.md, docs/decisions.md (D-020 to D-026), docs/profiling.md

1. Model details

ItemValue
TaskSingle-label image classification: one leaf photo in, one of 39 labels out (38 crop and condition classes over 14 crops, plus Background_without_leaves)
Primary modelFrom-scratch VGG-style CNN (src/plantdx/models/cnn.py): 4 blocks of [Conv3x3, BatchNorm, ReLU] x 2 then MaxPool, channels 32, 64, 128, 256, global average pooling, dense 256 with ReLU, linear 39. No dropout. 1,249,031 parameters, 1.69 GFLOPs per 128x128 image, 4.8 MB weights
TrainingFull training split (38,813 images), 128 px, moderate augmentation, Adam lr 1e-3, batch 64, cosine schedule over 40 epochs, early stopping on validation accuracy (patience 3, from epoch 20), bf16 mixed precision on an RTX 4090 Laptop GPU. Run cnn_full_aug_min20, best epoch 39, seed 42
How the configuration was chosen30-trial Optuna search on a 25% subset (report/tables/hpo_trials.csv), then full-data variants compared on validation accuracy and robustness (D-025, report/tables/model_selection.csv)
Comparison models (not the primary)ImageNet-pretrained ResNet18 and MobileNetV3-Large, fine-tuned at 224 px; ResNet18 with a frozen backbone. Offered in the app as labelled comparisons
InputRGB image of any size: shorter side resized to 128, centre-cropped to 128x128, normalised with training-split mean and std
OutputSoftmax over 39 classes; the app shows the top 5, a Grad-CAM heatmap and warnings
Low-confidence threshold0.83, chosen on the validation split as the lowest top-1 confidence at which shown predictions are 99.9% accurate (report/tables/threshold_cnn_full_aug_min20.json)
FrameworkPyTorch 2.14.1, torchvision 0.29.1, Python 3.12
LicenceCode MIT (as pyproject.toml). Weights released under the same terms; the training data is CC0 (see docs/data.md)

2. Intended use

  • Primary use: an educational demonstrator of a complete ML workflow, and a first-pass hint about a symptom on a single, well-lit leaf photographed against a plain background, for one of the 14 supported crops.
  • Users: module markers and students; hobby growers who want a hint before asking an expert; agronomists or extension workers only as a teaching aid.
  • Required disclaimer (shown in the app): PlantDx is a learning and decision-support tool, not agronomic or professional advice. It was trained on lab photos of single leaves and has not been validated on field photos. Consult an agronomist or extension worker before acting, especially before using pesticides.

3. Out-of-scope use

  • Field photos. Measured: on 2,578 real-world PlantDoc photos the model is right only 9.7% of the time (Section 6). Do not use it on photos of plants in the field, several leaves, fruit or whole plants.
  • Any treatment, pesticide, quarantine, crop-destruction, insurance or trading decision without an expert.
  • Crops or diseases outside the 39 labels: the model will still pick one of its labels.
  • Severity estimation, lesion localisation or several diseases on one leaf.
  • Any use involving people or personal data.

4. Factors

  • Crop and class: 14 crops with very different numbers of classes (Tomato 10, five crops 1) and a 36x class imbalance.
  • Image quality: blur, brightness, contrast, rotation, compression and resolution are tested (Section 5.3).
  • Capture conditions: all training images are lab photos of one leaf on a plain background. Field conditions are the main untested factor and are measured separately on PlantDoc (Section 6).
  • Not represented: geography, cultivar, growth stage, camera and season are not recorded in the data, so performance across them is unknown.

5. Quantitative analysis (held-out test split, 8,308 images, evaluated once)

Source: results/eval/eval_cnn_full_aug_min20/report.json and tables/.

5.1 Headline metrics against the requirements

RequirementTargetResultMet
R1 macro F1at least 0.950.9950Yes
R1 lowest class recallat least 0.850.948 (Corn: Cercospora leaf spot)Yes
R2 top-5 accuracyat least 0.991.000Yes
R3 worst accuracy drop over seven perturbations at moderate severityat most 5 points for each3.0 points (contrast x0.6)Yes
R5 CPU latency, 2 threadsmedian under 1 s11 ms median, 15 ms p95Yes
R6 background classdetectedprecision 1.000, recall 1.000Yes
R6 calibrationreport ECEECE 0.0033Reported
R7 same config and seed reproduces test accuracywithin 0.5 points0.01 points (rerun cnn_full_aug_full40_seed42)Yes

Overall test accuracy is 99.64% and weighted F1 0.9964. Across three training seeds trained for the full schedule, validation accuracy spread was 0.25 points; with early stopping able to fire on noisy epochs it was 0.79 points (D-024, D-025).

5.2 By crop (fairness proxy)

CropClassesTest imagesMacro F1Lowest class recall
Corn45780.9830.948
Potato33230.9890.957
Blueberry12250.9911.000
Apple44750.9930.979
Pepper (bell)23700.9940.987
Tomato102,7210.9960.987
Peach, Grape, Soybean, Orange1 to 42,5950.9990.994
Background, Cherry, Raspberry, Squash, Strawberry1 to 21,0211.0001.000

The weakest crop is Corn, where Cercospora (grey) leaf spot and Northern leaf blight are confused in both directions (3 test images each way). The smallest class, Potato healthy (23 test images), has recall 0.957. Blueberry healthy attracts a few Apple leaves. Differences between crops are small on lab data; they matter far more on field photos (Section 6).

5.3 Robustness (stratified 1,952-image test subset, 7 perturbations x 3 severities)

Worst drop at moderate severity over all seven perturbations (R3): 3.0 points, for contrast x0.6; blur, brightness and rotation each cost at most 0.9 points. The no-augmentation ablation, otherwise as accurate on clean images, drops up to 37.3 points, so augmentation is what makes the model robust. At the strongest severity JPEG quality 10 still costs 33.7 points. Full table: tables/robustness.csv; figure: report/figures/robustness_comparison.png.

5.4 Comparison models (same test split)

ModelTest accMacro F1CPU p50Size
CNN (primary)0.99640.995011 ms4.8 MB
ResNet18 fine-tuned0.99890.998524 ms42.8 MB
MobileNetV3-L fine-tuned0.99900.998110 ms16.3 MB
ResNet18 frozen backbone0.94910.939624 ms42.8 MB

6. Lab-to-field gap (out-of-distribution check)

All 2,578 PlantDoc photos (Singh et al., 2020; CC BY 4.0; geraldmc/plantdoc-full at revision bd2f049c) map to a PlantVillage class and none were used in training (report/tables/plantdoc.csv).

ModelTop-1Top-5Right cropCalled "no leaf"Warning shownMean confidence when wrong
CNN (primary)9.7%32.0%23.1%29.5%51.2%77.1%
ResNet18 fine-tuned14.3%42.2%26.5%37.6%14.9%76.5%
MobileNetV3-L fine-tuned15.6%45.9%27.3%37.7%39.3%80.5%

On field photos the model is close to useless. The safeguards help only partly: about half of the field photos trigger the low-confidence warning and almost 30% are labelled "no leaf", but the remaining predictions are still wrong about 90% of the time, often with high confidence. ImageNet pretraining helps a little but does not close the gap. This is the most important limitation of PlantDx and is stated in the app.

7. Training and evaluation data

  • Training: DScomp380/plant_village at revision 5ce680f8 (55,447 images, CC0), the Mendeley "without augmentation" release of PlantVillage. Group-aware stratified split 70/15/15 (seed 42) that keeps 677 near-duplicate groups within one split; a plain split would have leaked 530 duplicate pairs (D-020). See docs/data.md.
  • Evaluation: the held-out test split (8,308 images), and PlantDoc for field photos.

8. Ethical considerations and Responsible AI

  • Human oversight. Every result carries the disclaimer; diseased predictions tell the user to confirm with an expert; low-confidence and no-leaf results are shown as warnings with advice to retake the photo; users can report a wrong prediction.
  • Transparency. Top-5 probabilities are always shown, and a Grad-CAM heatmap shows which part of the image drove the prediction. Calibration on lab data is good (ECE 0.0033), but confidence is not trustworthy on field photos (Section 6).
  • Privacy. Photos are used only for the prediction. Gradio keeps a temporary copy of each upload and heatmap on the server's disk, which the app deletes within about 40 minutes (delete_cache=(600, 1800)). A photo is saved only if the user ticks a consent box and reports a prediction, under a server-generated file name with the model, prediction and user-supplied label; no other data is collected. Space storage is not persistent, so reports may be lost on restart.
  • Security. No secrets in the repository or Space; dependencies pinned; the flagging endpoint only stores processed images, never client-supplied paths (fixed after a security review).
  • Bias. Crops with one class (Soybean, Blueberry, Raspberry only healthy; Orange, Squash only diseased) cannot distinguish healthy from diseased leaves of that crop at all: a diseased Soybean leaf will be called healthy or another crop. Geographic and cultivar coverage are unknown.
  • Misuse and failure modes. Over-trust of a confident but wrong answer on a field photo is the main risk; mitigated by the disclaimer, warnings, the About tab and this card, but not eliminated.

9. Environmental impact

Measured with codecarbon (OfflineEmissionsTracker, UK grid) for every training run: 48 metered runs (search trials, baselines, final models, seed repeats, ablations), 4.12 GPU hours, 0.76 kWh, 0.181 kg CO2e. CPU power on this laptop is estimated from its TDP because RAPL is not available, and evaluation runs were not metered, so these are lower bounds. Choices that kept the cost down: prototyping on a 25% subset, median pruning that stopped 14 of 30 search trials early, early stopping, reusing results when the search repeated a configuration, a small model (1.25M parameters) and CPU-friendly 128 px inference.

10. Caveats and recommendations

  • Retrain or fine-tune on field photos (for example PlantDoc's training split) before any real-world use, and re-measure on a held-out field set.
  • Add an explicit out-of-distribution detector; the background class and the confidence threshold do not catch most field photos.
  • Collect metadata (location, cultivar, camera) to make fairness across growers measurable.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch · image-classification

Нельзя запустить

В репозитории нет config.json: не понять архитектуру модели.

Ревизия весов
9d0993d

0 моделей