PlantDoc-corrected / README.md
lugan's picture
README: add DOI 10.57967/hf/10678 badge
b187e12
|
Raw History Blame Contribute Delete
16.7 kB
---
license: cc-by-4.0
task_categories:
- object-detection
language:
- en
- zh
tags:
- plant-disease
- leaf-disease
- plantdoc
- agriculture
- precision-agriculture
- object-detection
- pascal-voc
- yolo
- keenforge
size_categories:
- 1K<n<10K
---
# PlantDoc-corrected
[![DOI](https://img.shields.io/badge/DOI-10.57967%2Fhf%2F10678-blue)](https://doi.org/10.57967/hf/10678)
**Plant leaf disease detection — cleaned and bounding-box standardized version of the PlantDoc object-detection dataset.**
**植物叶片病害检测 —— PlantDoc 目标检测数据集的目标检测清洗与边界框规整版。**
[English](#english) · [中文](#中文)
---
## English
### What is this?
A **cleaned and standardized object-detection version** of the **PlantDoc** dataset
(Singh, Jain, Jain, Kayal, Kumawat & Batra — *"PlantDoc: A Dataset for Visual Plant Disease Detection"*,
[ACM CoDS-COMAD 2020](https://doi.org/10.1145/3371158.3371196), [arXiv:1911.10317](https://arxiv.org/abs/1911.10317);
upstream detection repo: [pratikkayal/PlantDoc-Object-Detection-Dataset](https://github.com/pratikkayal/PlantDoc-Object-Detection-Dataset)).
The original release is a web-scraped, hand-annotated benchmark. It contains **train/test leakage**
(identical images present in both splits), images without annotations, annotations without images,
class names with inconsistent spelling and casing, filenames polluted with URL query strings,
images whose downloaded resolution does not match the annotation canvas, and no validation split.
This release removes the leakage and the unusable records, normalizes all 29 class names, repairs
every filename and image-orientation inconsistency, provides a reproducible **train/val/test** split,
and ships ready-to-train **YOLO TXT** + **Pascal VOC XML** annotations with configuration files.
> ✅ **Upstream license: Creative Commons Attribution 4.0 International (CC BY 4.0)**. This release maintains the same open license.
### Corrections vs. the official release
| # | Correction | Detail |
|---|---|---|
| 1 | **Removed train/test leakage** | 12 images were **byte-identical** copies present in *both* `TRAIN/` and `TEST/` (plus 16 further basename collisions). The duplicate training copy of each pair was removed, so the official test images are never seen during training. |
| 2 | **Normalized all 29 class names** | Upstream mixed styles: `Bell_pepper leaf` (underscore), `grape leaf` (lowercase), `Corn Gray leaf spot` (title case) and the typo `Soyabean leaf`. All names are now consistent Title Case (`Bell Pepper Leaf`, `Grape Leaf`, `Corn Gray Leaf Spot`, `Soybean Leaf`, …). |
| 3 | **Dropped 11 unannotated images** | Images present in the archive with **no** annotation XML at all (mostly thumbnails such as `...jpg?w=500&h=889`). |
| 4 | **Dropped 11 empty annotations** | Images whose XML contains **no** `<object>` — these carry no supervision and additionally break dataset indexing on Hugging Face. |
| 5 | **Dropped 4 unreconcilable images** | Downloaded as low-resolution thumbnails while annotated at original resolution, so their boxes lie outside the image frame (`Early-blight-example.ashx?mw=250`, `Fig 2b. GLS backlit copy`, `markjones-corn-001`, `powdery-mildew-on-squash-leaves.jpg?w=300&h=200`). Cannot be repaired without inventing coordinates. |
| 6 | **Removed 1 orphan annotation** | `TRAIN/NCLB.xml` has no matching image upstream (`NCLB.jpg` is absent from the archive). |
| 7 | **Filename hygiene** | 234 filenames contained URL encoding / query strings (`%20`, `+`, `?itok=`, `%253E`); 25 files had no extension at all and 12 carried web-script extensions (`.ashx`, `.aspx`, `.asp`, `.php`). All are percent-decoded, slugged to portable `[A-Za-z0-9._-]` names and given a correct `.jpg` / `.png`. Scraped SEO filenames running up to 215 characters (which break Windows checkout and are hostile everywhere) are truncated to ≤80 characters with an 8-hex-digit hash of the original name appended, so every renamed file stays traceable to its upstream name. |
| 8 | **EXIF orientation normalized** | 35 files carried an EXIF orientation tag while their annotations were authored against the *stored* pixel orientation. 30 had the orientation tag stripped **byte-level (pixels untouched)**; 5 whose annotations used the *EXIF-displayed* orientation had that rotation **baked into the pixels**. Result: the annotation canvas equals the stored pixel orientation for **every** loader (PIL, OpenCV, Ultralytics). |
| 9 | **Repaired `0×0` image sizes** | 4 VOC files declared `<width>0</width><height>0</height>`. The true pixel dimensions were written in, leaving coordinates untouched. |
| 10 | **Reproducible train/val/test split** | The official `TEST/` (236 images) is preserved as **test** for paper comparability; a stratified **10 %** validation set is carved out of `TRAIN/` (seed 42). |
| 11 | **Standard packaging** | Added `data.yaml`, `classes.txt`, synchronized dual-format annotations (`Annotations/` + `labels/`) and refreshed per-split CSV tables. |
All 8,887 bounding boxes are carried over unchanged — no coordinate was scaled, shifted or re-guessed.
### Dataset at a glance
| Property | Value |
|---|---|
| Images (total) | **2,565** |
| Classes | **29** across **13** host species |
| Bounding boxes | **8,887** |
| Formats | Pascal VOC XML · YOLO TXT |
| Split | train **2,096** / val **233** / test **236** |
| Boxes per split | train **7,672** / val **763** / test **452** |
**Boxes per class:**
`Blueberry Leaf` 848 · `Tomato Leaf Yellow Virus` 824 · `Peach Leaf` 620 · `Raspberry Leaf` 556 · `Strawberry Leaf` 492 · `Tomato Septoria Leaf Spot` 432 · `Tomato Leaf` 396 · `Corn Leaf Blight` 369 · `Potato Leaf Early Blight` 327 · `Bell Pepper Leaf` 323 · `Tomato Mold Leaf` 293 · `Tomato Leaf Bacterial Spot` 280 · `Soybean Leaf` 266 · `Bell Pepper Leaf Spot` 264 · `Tomato Leaf Mosaic Virus` 261 · `Squash Powdery Mildew Leaf` 254 · `Apple Leaf` 247 · `Potato Leaf Late Blight` 242 · `Cherry Leaf` 240 · `Tomato Leaf Late Blight` 221 · `Grape Leaf` 220 · `Tomato Early Blight Leaf` 214 · `Apple Rust Leaf` 179 · `Apple Scab Leaf` 171 · `Grape Leaf Black Rot` 133 · `Corn Rust Leaf` 126 · `Corn Gray Leaf Spot` 76 · `Potato Leaf` 11 · `Tomato Two Spotted Spider Mites Leaf` 2
**Host species:** Apple, Bell pepper, Blueberry, Cherry, Corn, Grape, Peach, Potato, Raspberry, Soybean, Squash, Strawberry, Tomato.
### Structure
```
PlantDoc-corrected/
├── images/
│ ├── train/ # 2,096 images
│ ├── val/ # 233 images
│ └── test/ # 236 images
├── labels/
│ ├── train/ # 2,096 YOLO TXT files
│ ├── val/ # 233 YOLO TXT files
│ └── test/ # 236 YOLO TXT files
├── Annotations/ # Pascal VOC XML annotations (2,565 files)
├── JPEGImages/ # Full image collection (2,565 images)
├── csv/
│ ├── train_labels.csv # filename,width,height,class,xmin,ymin,xmax,ymax
│ ├── val_labels.csv
│ └── test_labels.csv
├── classes.txt # 29 class names, one per line
├── data.yaml # Ultralytics YOLO configuration
├── LICENSE # CC BY 4.0 (upstream)
└── README.md
```
Every image has exactly one YOLO `.txt` and one VOC `.xml`; there are **no empty label files**.
### Quick Start (Ultralytics YOLO)
```bash
yolo detect train data=data.yaml model=yolov8n.pt epochs=100 imgsz=640
```
### Citation
**1. The original dataset — please always cite this.**
```bibtex
@inproceedings{singh2020plantdoc,
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},
isbn = {9781450377386},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3371158.3371196},
doi = {10.1145/3371158.3371196},
booktitle = {Proceedings of the 7th ACM IKDD CoDS and 25th COMAD},
pages = {249--253},
numpages = {5},
keywords = {Deep Learning, Object Detection, Image Classification},
location = {Hyderabad, India},
series = {CoDS COMAD 2020}
}
```
**2. This corrected release — please cite it as well.**
```bibtex
@misc{plantdoc_corrected,
author = {KeenForgeAI},
title = {PlantDoc-corrected: a cleaned and bounding-box standardized release of the PlantDoc object-detection dataset},
year = {2026},
version = {1.0},
publisher = {KeenForgeAI},
url = {https://huggingface.co/datasets/KeenForgeAI/PlantDoc-corrected},
note = {Curated by Lu Gan and Sam Li. Derived from Singh et al. (2020),
CoDS-COMAD, doi:10.1145/3371158.3371196. CC BY 4.0 licensed.}
}
```
**3. The annotation and quality inspection tool.**
```bibtex
@software{keenforge,
author = {KeenForgeAI},
title = {KeenForge: a local-first, offline image annotation and model-training desktop tool},
year = {2026},
publisher = {KeenForgeAI},
url = {https://github.com/KeenForgeAI/KeenForge},
note = {MIT licensed. Developed by Lu Gan and Sam Li.}
}
```
### License
**CC BY 4.0** — Creative Commons Attribution 4.0 International, matching the upstream repository's terms. Please also credit the original authors.
---
## 中文
### 这是什么?
**PlantDoc 植物病害数据集**(Singh 等,*ACM CoDS-COMAD 2020*,[arXiv:1911.10317](https://arxiv.org/abs/1911.10317))的**目标检测清洗与标准化重构版**。上游检测版仓库为 [pratikkayal/PlantDoc-Object-Detection-Dataset](https://github.com/pratikkayal/PlantDoc-Object-Detection-Dataset)。
原始版本由网络爬取图片人工标注而成,存在大量数据质量缺陷:**训练/测试集数据泄漏**(同一张图同时出现在两个划分中)、有图无标注、有标注无图、类别名称大小写与拼写不统一(如 `Bell_pepper leaf`、`grape leaf`、拼写错误的 `Soyabean`)、文件名混入 URL 查询串、图片下载分辨率与标注画布不一致,且没有验证集。
本版本清除数据泄漏与不可用样本,统一 29 个类别名称,修复全部文件名与图片方向不一致问题,提供可复现的**训练/验证/测试**划分,并附带开箱即用的 **YOLO TXT** 与 **Pascal VOC XML** 双格式标注及训练配置。
> ✅ **上游许可证:CC BY 4.0**。本版沿用同一开源协议。
### 相对官方版的修正
| # | 修正项 | 说明 |
|---|---|---|
| 1 | **消除训练/测试数据泄漏** | 有 **12 张图片逐字节完全相同**却同时存在于 `TRAIN/` 与 `TEST/`(另有 16 组同名冲突)。本版删除每对中重复的训练副本,确保官方测试图绝不参与训练。 |
| 2 | **统一 29 个类别名称** | 上游命名混乱:`Bell_pepper leaf`(下划线)、`grape leaf`(小写)、`Corn Gray leaf spot`(首字母大写)以及拼写错误的 `Soyabean leaf`。现全部统一为 Title Case(`Bell Pepper Leaf`、`Grape Leaf`、`Corn Gray Leaf Spot`、`Soybean Leaf` 等)。 |
| 3 | **剔除 11 张无标注图片** | 压缩包中存在但**完全没有**标注 XML 的图片(多为 `...jpg?w=500&h=889` 之类的缩略图)。 |
| 4 | **剔除 11 个空标注** | XML 中**不含任何 `<object>`** 的图片——既无监督信息,又会导致 Hugging Face 数据集索引失败。 |
| 5 | **剔除 4 张无法修复的图片** | 下载到的是低分辨率缩略图,而标注按原图分辨率绘制,标注框落在图像范围之外(`Early-blight-example.ashx?mw=250`、`Fig 2b. GLS backlit copy`、`markjones-corn-001`、`powdery-mildew-on-squash-leaves.jpg?w=300&h=200`)。若不臆造坐标则无法修复。 |
| 6 | **移除 1 个孤立标注** | `TRAIN/NCLB.xml` 在上游无对应图片(`NCLB.jpg` 缺失)。 |
| 7 | **文件名净化** | 234 个文件名含 URL 编码/查询串(`%20`、`+`、`?itok=`、`%253E`);25 个文件完全没有扩展名,另有 12 个带网页脚本扩展名(`.ashx`、`.aspx`、`.asp`、`.php`)。现全部百分号解码、规整为跨平台安全的 `[A-Za-z0-9._-]` 名称,并补上正确的 `.jpg` / `.png`。上游抓取网页留下的 SEO 长文件名最长可达 215 字符(会导致 Windows 检出失败,在任何平台都不友好),现统一截断至 ≤80 字符,并追加原文件名的 8 位十六进制哈希,确保每个改名文件仍可追溯到上游原名。 |
| 8 | **EXIF 方向归一化** | 35 个文件带有 EXIF 方向标签,而其标注是按**存储像素方向**绘制的。其中 30 个采用**字节级剥离方向标签(像素不变)**;5 个标注按**EXIF 显示方向**绘制的,则把该旋转**烘焙进像素**。最终无论用哪个框架读取(PIL / OpenCV / Ultralytics),标注画布都与存储像素方向一致。 |
| 9 | **修复 `0×0` 图像尺寸** | 4 个 VOC 文件声明 `<width>0</width><height>0</height>`,已写入真实像素尺寸,坐标保持不变。 |
| 10 | **可复现的训练/验证/测试划分** | 官方 `TEST/`(236 张)保留为 **test** 以便与论文对比;从 `TRAIN/` 中分层切出 **10%** 作为 **val**(随机种子 42)。 |
| 11 | **标准化打包** | 补充 `data.yaml`、`classes.txt`、双格式同步标注(`Annotations/` + `labels/`)以及按划分刷新的 CSV 表格。 |
全部 **8,887 个标注框**均为原样迁移——没有任何坐标被缩放、平移或重新臆测。
### 数据集概览
| 属性 | 值 |
|---|---|
| 图像总数 | **2,565** |
| 类别数 | **29** 类,覆盖 **13** 种作物 |
| 标注框总数 | **8,887** |
| 标注格式 | Pascal VOC XML · YOLO TXT |
| 划分集 | train **2,096** / val **233** / test **236** |
| 各集框数 | train **7,672** / val **763** / test **452** |
**各类框数:**
`Blueberry Leaf` 848 · `Tomato Leaf Yellow Virus` 824 · `Peach Leaf` 620 · `Raspberry Leaf` 556 · `Strawberry Leaf` 492 · `Tomato Septoria Leaf Spot` 432 · `Tomato Leaf` 396 · `Corn Leaf Blight` 369 · `Potato Leaf Early Blight` 327 · `Bell Pepper Leaf` 323 · `Tomato Mold Leaf` 293 · `Tomato Leaf Bacterial Spot` 280 · `Soybean Leaf` 266 · `Bell Pepper Leaf Spot` 264 · `Tomato Leaf Mosaic Virus` 261 · `Squash Powdery Mildew Leaf` 254 · `Apple Leaf` 247 · `Potato Leaf Late Blight` 242 · `Cherry Leaf` 240 · `Tomato Leaf Late Blight` 221 · `Grape Leaf` 220 · `Tomato Early Blight Leaf` 214 · `Apple Rust Leaf` 179 · `Apple Scab Leaf` 171 · `Grape Leaf Black Rot` 133 · `Corn Rust Leaf` 126 · `Corn Gray Leaf Spot` 76 · `Potato Leaf` 11 · `Tomato Two Spotted Spider Mites Leaf` 2
**作物种类:** 苹果、甜椒、蓝莓、樱桃、玉米、葡萄、桃、马铃薯、树莓、大豆、南瓜、草莓、番茄。
### 目录结构
```
PlantDoc-corrected/
├── images/
│ ├── train/ # 2,096 张图片
│ ├── val/ # 233 张图片
│ └── test/ # 236 张图片
├── labels/
│ ├── train/ # 2,096 个 YOLO TXT 标注文件
│ ├── val/ # 233 个 YOLO TXT 标注文件
│ └── test/ # 236 个 YOLO TXT 标注文件
├── Annotations/ # Pascal VOC XML 标注 (2,565 个文件)
├── JPEGImages/ # 完整图片集合 (2,565 张图片)
├── csv/
│ ├── train_labels.csv # filename,width,height,class,xmin,ymin,xmax,ymax
│ ├── val_labels.csv
│ └── test_labels.csv
├── classes.txt # 29 个类别名称,每行一个
├── data.yaml # Ultralytics YOLO 配置文件
├── LICENSE # CC BY 4.0(上游)
└── README.md
```
每张图片都有且仅有一个 YOLO `.txt` 与一个 VOC `.xml`,**不存在空标签文件**。
### 快速开始 (Ultralytics YOLO)
```bash
yolo detect train data=data.yaml model=yolov8n.pt epochs=100 imgsz=640
```
### 引用
**1. 原始数据集(请务必引用)** —— 见上方英文部分 `singh2020plantdoc`。
**2. 本修正版(请一并引用)** —— 见上方英文部分 `plantdoc_corrected`。
**3. 标注与质检工具(可选)** —— 见上方英文部分 `keenforge`。
### 许可证
**CC BY 4.0** —— 与上游 PlantDoc 数据集开源协议一致。请同时注明原作者与本整理版本。