PlantDoctor SegFormer B4
precise plant disease analysis
2 min read
The PlantDoctor SegFormer B4 model tackles semantic segmentation (pixel-level image classification into classes) and automated detection of crop pathologies. The system outputs a mask of damaged areas, calculates the percentage of affected and healthy leaf surface, and determines the overall disease severity level across 116 disease classes. The architecture relies on a SegFormer B4 encoder pretrained on ImageNet and contains 64.1 million parameters. This solution leads the PlantDoctor benchmark, outperforming classical U-Net networks and smaller SegFormer versions. The tool will be useful for agricultural researchers and field monitoring system developers.
Key features
- 116 disease classes: detailed classification of plant pathologies and background.
- Leading accuracy: first place in the PlantDoctor benchmark with an mIoU of 46.13 and mDice of 59.51.
- Optimized architecture: based on a SegFormer B4 encoder with 64.1M parameters.
- Automated report: calculation of the percentage of affected leaf area and estimation of damage severity.
What you can do
- Integrate the model into a mobile application or chatbot for rapid leaf photo disease diagnostics.
- Use it in monitoring scripts for batch processing of images from cameras or drones.
- Build detailed visual damage masks for scientific research in plant protection.
Example
import torch
from PIL import Image
from transformers import SegformerForSemanticSegmentation, SegformerImageProcessor
repo = "aungthuhein-dev/plantdoctor-segformer-b4"
model = SegformerForSemanticSegmentation.from_pretrained(repo).eval()
proc = SegformerImageProcessor(size={"height": 512, "width": 512})
img = Image.open("leaf.jpg").convert("RGB")
Read more
DetailsMetrics (PlantSeg test): mIoU 46.13, mDice 59.51, disease detection accuracy 78.65%
Hardware and speed: latency 17.0 ms (bf16) on NVIDIA H200 MIG 3g.71gb, inference memory ~3.9 GB
Training: 50 epochs, batch 16, AdamW, cross-entropy and Dice loss, bf16
License: CC BY-NC 4.0 (non-commercial use due to the dataset)










Comments