| --- |
| license: mit |
| task_categories: |
| - image-classification |
| - image-to-text |
| language: |
| - en |
| tags: |
| - agriculture |
| - plant-disease |
| - crop-disease |
| - nepal |
| - sharegpt |
| - multimodal |
| pretty_name: Nepali Crop Disease Dataset |
| size_categories: |
| - 10K<n<100K |
| --- |
| |
| # Nepali Crop Disease Dataset |
|
|
| A consolidated image dataset for crop identification and plant disease |
| detection, merged from multiple public sources and organized by crop, with |
| an accompanying **ShareGPT-format** conversational dataset for |
| vision-language model finetuning. |
|
|
| ## Dataset Summary |
|
|
| Images are grouped **one folder per crop** (e.g. `tomato/`, `apple/`, |
| `maize/`), each labeled with both a **crop** and a **disease** (or |
| `healthy`). The corpus is **class-balanced by design**: |
|
|
| - Crops with fewer than 300 images were dropped entirely (9 crops kept out |
| of 17 detected in the source pool). |
| - Every kept crop is capped at the **same per-class quota** (equal counts |
| across crops — no crop dominates the dataset). |
| - Within each crop, images are sampled **round-robin across disease |
| labels**, so a single disease can't dominate that crop's folder. |
| - Final split per crop: **4,443 train / 666 val / 666 test**, for |
| **47,489 images total** across 9 crops. |
|
|
| Labels come from two sources, tracked per-image via a `label_source` field: |
|
|
| - `metadata` — parsed from existing `.jsonl`/`.csv`/`.json` annotation files |
| shipped with a source dataset (higher precision). |
| - `foldername` — inferred by keyword-matching the original folder/file path |
| when no structured metadata was available. |
|
|
| ## Source Datasets |
|
|
| This dataset merges images from: |
|
|
| | Source | Link | |
| |---|---| |
| | Kaggle — Crop Disease Detection Dataset | https://www.kaggle.com/datasets/snikhilrao/crop-disease-detection-dataset | |
| | GitHub — PlantDoc-Dataset | https://github.com/pratikkayal/PlantDoc-Dataset | |
| | Hugging Face — bd-crop-vegetable-plant-disease-dataset | https://huggingface.co/datasets/Saon110/bd-crop-vegetable-plant-disease-dataset | |
|
|
| > Mendeley Data (`6243z8r6t6`) was originally scoped for inclusion but was |
| > dropped from this build. |
|
|
| **Please refer to each original source for its own license and citation |
| requirements** — this dataset does not override or supersede those terms. |
| If you are a maintainer of one of the source datasets and have concerns |
| about inclusion or attribution, please open a discussion on this repo. |
|
|
| ## Dataset Structure |
|
|
| ``` |
| train/<crop>/*.jpg |
| val/<crop>/*.jpg |
| test/<crop>/*.jpg |
| labels_registry.jsonl |
| sharegpt.jsonl |
| zips/dataset_part_*.zip # full archive, for bulk download |
| ``` |
|
|
| ### `labels_registry.jsonl` |
| |
| One row per image: |
| |
| ```json |
| {"image": "train/tomato/abc123.jpg", "split": "train", "crop": "tomato", "disease": "early blight", "label_source": "metadata"} |
| ``` |
| |
| ### `sharegpt.jsonl` |
| |
| One conversation per image, formatted for VLM instruction finetuning: |
| |
| ```json |
| { |
| "id": "0000001", |
| "image": "train/tomato/abc123.jpg", |
| "conversations": [ |
| {"from": "human", "value": "<image>\nWhat crop is shown in this image, and does it have any disease? If so, name the disease."}, |
| {"from": "gpt", "value": "This is a Tomato leaf affected by early blight."} |
| ] |
| } |
| ``` |
| |
| Healthy images get an explicit no-disease answer; images where the disease |
| label couldn't be confidently determined are marked as such rather than |
| guessed. |
|
|
| ## How to Load |
|
|
| ### As an image folder (classification) |
|
|
| ```python |
| from datasets import load_dataset |
| |
| ds = load_dataset( |
| "imagefolder", |
| data_dir="train", # or point at an extracted local copy |
| ) |
| ``` |
|
|
| ### As ShareGPT conversations (VLM finetuning) |
|
|
| ```python |
| from datasets import load_dataset |
| |
| ds = load_dataset( |
| "json", |
| data_files="sharegpt.jsonl", |
| ) |
| ``` |
|
|
| Note: `image` paths in `sharegpt.jsonl` are relative to the repo root |
| (e.g. `train/tomato/abc123.jpg`) — resolve them against your local copy of |
| the `train/val/test` folders (or the extracted `zips/` archive) before |
| loading images. |
|
|
| ### From the zipped archive |
|
|
| ```python |
| from huggingface_hub import hf_hub_download |
| import zipfile |
| |
| local_zip = hf_hub_download( |
| repo_id="w4ashabii/nepali_crop_data", |
| repo_type="dataset", |
| filename="zips/dataset_part_000.zip", |
| ) |
| with zipfile.ZipFile(local_zip) as zf: |
| zf.extractall("training_data") |
| ``` |
|
|
| ## Known Limitations |
|
|
| - Crop and disease labels are extracted via keyword matching where source |
| metadata wasn't available (`label_source: "foldername"`) — these may |
| contain classification errors and should be spot-checked before use in |
| high-stakes applications. |
| - Crops with fewer than 300 available images were dropped to keep the |
| balancing meaningful — this dataset does **not** cover every crop present |
| in the original source datasets, only the 9 that had enough images. |
| - Balancing is enforced at the **crop** level (equal images per crop) and |
| approximately at the **disease** level within each crop (round-robin |
| sampling) — it is not a strict guarantee of equal counts per individual |
| disease across the whole dataset. Check `labels_registry.jsonl` if you |
| need exact per-disease counts. |
| - Image quality, resolution, and photographic conditions vary across the |
| source datasets. |
|
|
| ## Citation |
|
|
| If you use this dataset, please cite the original source datasets listed |
| above in addition to this repository. |