Wqm Zzl Swin Tiny Tomato Disease
Fine-tuned Swin Tiny model for tomato disease classification based on the PlantVillage dataset.
Fuente del modelo
- Tipo
- Other
- Tamaño del archivo
- 105 MB
- Modelo base
- microsoft/swin-tiny-patch4-window7-224
- Versión
- vRevision fb708d2
- Actualizado
- 22 oct 2026
- Descargas
- 9
- Fuente
- Hugging Face
Descripción de la fuente
🍅 Swin Tiny for Tomato Disease Classification (10 Classes)
Fine-tuned Swin Tiny model for tomato disease classification based on the PlantVillage dataset.
Language / 语言
中文
模型简介
本模型基于 microsoft/swin-tiny-patch4-window7-224 进行全参数微调(Full Fine-tuning),用于番茄叶片病虫害分类,共支持 10 个类别。
模型基于 PlantVillage Tomato Disease Dataset 训练,并采用严格的数据集划分,最终结果使用完全未参与训练的独立测试集进行评测,确保 Zero Data Leakage(零数据泄漏)。
模型信息
| 项目 | 内容 |
|---|---|
| 基座模型 | microsoft/swin-tiny-patch4-window7-224 |
| 模型结构 | Swin Transformer Tiny |
| 参数量 | 28M |
| 输入尺寸 | 224 × 224 |
| 输出类别 | 10 |
| 微调方式 | Full Fine-tuning |
数据集
PlantVillage Tomato Disease Dataset
数据共 16,011 张图像。
| 数据划分 | 数量 | 说明 |
|---|---|---|
| Training Set | 800 | 模型训练(每类80张) |
| Validation Set | 200 | 训练过程验证(每类20张) |
| Independent Test Set | 15,011 | 最终评测(完全未参与训练) |
最终 97.4% Accuracy 仅在 15,011 张独立测试集 上获得。
训练配置
| 项目 | 配置 |
|---|---|
| Optimizer | AdamW |
| Learning Rate | 1e-4 |
| Scheduler | CosineAnnealingLR |
| Epochs | 20 |
模型性能
| Metric | Value |
|---|---|
| Overall Accuracy | 97.4% |
| Lowest Class Accuracy | Early Blight (94.3%) |
| Highest Class Accuracy | Tomato Mosaic Virus (100%) |
支持类别
| ID | English |
|---|---|
| 0 | Bacterial Spot |
| 1 | Early Blight |
| 2 | Late Blight |
| 3 | Leaf Mold |
| 4 | Septoria Leaf Spot |
| 5 | Spider Mites |
| 6 | Target Spot |
| 7 | Tomato Yellow Leaf Curl Virus |
| 8 | Tomato Mosaic Virus |
| 9 | Healthy |
使用方法
from transformers import AutoImageProcessor
from transformers import AutoModelForImageClassification
from PIL import Image
processor = AutoImageProcessor.from_pretrained(
"wqm-zyl/wqm-zzl-swin-tiny-tomato-disease"
)
model = AutoModelForImageClassification.from_pretrained(
"wqm-zyl/wqm-zzl-swin-tiny-tomato-disease"
)
image = Image.open("tomato_leaf.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
outputs = model(**inputs)
predicted_id = outputs.logits.argmax(-1).item()
predicted_label = model.config.id2label[predicted_id]
confidence = outputs.logits.softmax(-1)[0, predicted_id].item()
print(predicted_label, confidence)
局限性
模型训练数据来自 PlantVillage 实验室环境。
在真实田间环境中(复杂背景、自然光照、手机拍摄等)准确率可能下降。
建议使用真实农业场景数据继续微调后再部署。
English
Model Overview
This repository provides a fully fine-tuned Swin Tiny model for Tomato Disease Classification.
The model is built upon microsoft/swin-tiny-patch4-window7-224 and supports 10 tomato disease categories.
The reported results are evaluated on an independent held-out test set with zero data leakage.
Dataset
The dataset contains 16,011 images.
| Split | Images | Purpose |
|---|---|---|
| Training | 800 | Model training |
| Validation | 200 | Validation during training |
| Independent Test | 15,011 | Final evaluation |
The reported 97.4% accuracy is obtained exclusively on the independent test set.
Training Configuration
- Base Model: microsoft/swin-tiny-patch4-window7-224
- Fine-tuning: Full Fine-tuning
- Parameters: 28M
- Optimizer: AdamW
- Learning Rate: 1e-4
- Scheduler: CosineAnnealingLR
- Epochs: 20
Performance
- Overall Accuracy: 97.4%
- Lowest Class: Early Blight (94.3%)
- Highest Class: Tomato Mosaic Virus (100%)
Usage
See the Python example above.
Limitations
The model is trained on PlantVillage laboratory images.
Performance may degrade on real-world images with complex backgrounds, natural lighting or mobile phone photography.
Further fine-tuning on field-collected data is recommended before deployment.
Authors
This project was completed collaboratively by:
-
Wang Qimeng
Hugging Face: https://huggingface.co/mengjoyful -
Zhu Zilong
Hugging Face: https://huggingface.co/yanjuhuahuo
Contributions
Wang Qimeng
- Model training
- Full fine-tuning
- Hyperparameter optimization
- Hugging Face deployment
- Documentation
Zhu Zilong
- Dataset preparation
- Data preprocessing
- Model evaluation
- Experimental validation
- Documentation
Citation
@misc{swin-tiny-tomato-disease,
author = {Wang Qimeng and Zhu Zilong},
title = {Swin Tiny for Tomato Disease Classification},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/wqm-zyl/wqm-zzl-swin-tiny-tomato-disease}
}
Fuentes
1 fuente
Fuentes
1 fuenteVerificado 22 oct
Artefactos del modelo
1 artefacto
Artefactos del modelo
1 artefactoExtractos de fuentes
3 extractos
Extractos de fuentes
3 extractos--- license: mit language: - en - zh library_name: transformers pipeline_tag: image-classification base_model: microsoft/swin-tiny-patch4-window7-224 tags: - swin - image-classification - computer-vision - tomato - plant-disease - agriculture --- # 🍅 Swin Tiny for Tomato Disease Classification (10 Classes) Fine-tuned Swin Tiny model for tomato disease classification based on the PlantVillage dataset. **Language / 语言** - 🇺🇸 [English](#english) - 🇨🇳 [中文](#中文) --- # 中文 ## 模型简介 本模型基于 **microsoft/swin-tiny-patch4-window7-224** 进行**全参数微调(Full Fine-tuning)**,用于番茄叶片病虫害分类,共支持 **10 个类别**。 模型基于 **PlantVillage Tomato Disease Dataset** 训练,并采用严格的数据集划分,最终结果使用完全未参与训练的独立测试集进行评测,确保 **Zero Data Leakage(零数据泄漏)**。 --- ## 模型信息 | 项目 | 内容 | |------|------| | 基座模型 | microsoft/swin-tiny-patch4-window7-224 | | 模型结构 | Swin Transformer Tiny | | 参数量 | 28M | | 输入尺寸 | 224 × 224 | | 输出类别 | 10 | | 微调方式 | Full Fine-tuning | --- ## 数据集 PlantVillage Tomato Disease Dataset 数据共 **16,011 张图像**。 | 数据划分 | 数量 | 说明 | |------|------:|------| | Training Set | 800 | 模型训练(每类80张) | | Validation Set | 200 | 训练过程验证(每类20张) | | Independent Test Set | 15,011 | 最终评测(完全未参与训练) | 最终 **97.4% Accuracy** 仅在 **15,011 张独立测试集** 上获得。 --- ## 训练配置 | 项目 | 配置 | |------|------| | Optimizer | AdamW | | Learning Rate | 1e-4 | | Scheduler | CosineAnnealingLR | | Epochs | 20 | --- ## 模型性能 | Metric | Value | |------|------| | Overall Accuracy | **97.4%** | | Lowest Class Accuracy | Early Blight (94.3%) | | Highest Class Accuracy | Tomato Mosaic Virus (100%) | --- ## 支持类别 | ID | English | |----|----------| | 0 | Bacterial Spot | | 1 | Early Blight | | 2 | Late Blight | | 3 | Leaf Mold | | 4 | Septoria Leaf Spot | | 5 | Spider Mites | | 6 | Target Spot | | 7 | Tomato Yellow Leaf Curl Virus | | 8 | Tomato Mosaic Virus | | 9 | Healthy | --- ## 使用方法 ```python from transformers import AutoImageProcessor from transformers import AutoModelForImageClassification from PIL import Image processor = AutoImageProcessor.from_pretrained( "wqm-zyl/wqm-zzl-swin-tiny-tomato-disease" ) model = AutoModelForImageClassification.from_pretrained( "wqm-zyl/wqm-zzl-swin-tiny-tomato-disease" ) image = Image.open("tomato_leaf.jpg").convert("RGB") inputs = processor(images=image, return_tensors="pt") outputs = model(**inputs) predicted_id = outputs.logits.argmax(-1).item() predicted_label = model.config.id2...
Source context: 9 downloads · 2 likes · Pipeline image-classification · Library transformers · Repo wqm-zyl/wqm-zzl-swin-tiny-tomato-disease
Source context: 86 downloads · 2 likes · Pipeline image-classification · Library transformers · Repo wqm-zyl/wqm-zzl-swin-tiny-tomato-disease
