Dataset Viewer
Auto-converted to Parquet Duplicate
image
imagewidth (px)
427
4k
label
stringclasses
1 value
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
Healthy
End of preview. Expand in Data Studio

This is the dataset for my project of Plant Diagnosis Suite at here. You can check out to see a Disease Detector trained on this dataset

Vietnamese Rice Disease & Crop Recommendation Dataset

An agricultural AI dataset collected in Vietnam, containing 37,978 rice plant images across 21 classes (diseases, pests, nutrient deficiencies, healthy) — for image classification.


Dataset Summary

Component Type Samples Classes Task
Rice Disease Images Image (JPG) 37,978 21 Image Classification

Splits Available

Split Description Size
healthy Original healthy rice images 3,764 images
pests Original pest/insect images (9 classes) ~14,284 images
diseases Original rice disease images (8 classes) ~17,618 images
nutrition Original nutrient deficiency images (3 classes) 2,312 images
train Stratified training split (70%) 26,584 images
validation Stratified validation split (15%) 5,697 images
test Stratified test split (15%) 5,697 images

The train / validation / test splits draw from all 21 classes combined and are stratified — use these for model training. The four category splits (healthy, pests, diseases, nutrition) reflect the original folder structure of the raw collection.


Dataset Structure

Image Component — Fields

Field Type Description
image Image The rice plant photograph
label string English class label (see label list below)

Loading the Dataset

from datasets import load_dataset

# Load a specific split
ds = load_dataset("minhhungg/rice-disease-dataset", split="train")

# Load all splits
ds = load_dataset("minhhungg/rice-disease-dataset")

# Access train/val/test for model training
train = ds["train"]
val   = ds["validation"]
test  = ds["test"]

# Quick check
print(train[0])
# {'image': <PIL.JpegImagePlugin...>, 'label': 'Healthy'}

Label Definitions

Image Classes (21 total)

Healthy (1 class)

Label Vietnamese Name Count
Healthy Cây lúa khỏe mạnh 3,764

Pests / Insects (9 classes)

Label Vietnamese Name Approx. Count
Tungro Virus Tungro virus 3,480
Hispa Sâu gai 2,922
Rice Gall Midge Sâu năn (Muỗi hành) 1,582
Chilo Stem Borer Sâu đục thân (Sọc nâu) 1,490
Rice Leaf Folder Sâu cuốn lá nhỏ 1,210
Thrips Bọ trĩ 1,160
Rice Skipper Sâu cuốn lá lớn 950
Yellow Stem Borer Sâu đục thân (vàng) 910
Brown Plant Hopper Rầy nâu 580

Diseases (8 classes)

Label Vietnamese Name Approx. Count
Leaf Scald Bệnh cháy lá 3,340
Sheath Blight Bệnh đốm vằn / khô vằn 3,156
Brown Spot Bệnh đốm nâu 3,140
Bacterial Leaf Blight Bệnh bạc lá 2,950
Narrow Brown Spot Bệnh gạch nâu 2,832
Blast Bệnh đạo ôn lá và cổ bông 2,000
Bakanae Disease Bệnh lúa von (lúa đực) 100
False Smut Bệnh than vàng 100

Nutrient Deficiencies (3 classes)

Label Vietnamese Name Count
Nitrogen Deficiency Thiếu đạm (N) 880
Potassium Deficiency Thiếu kali (K) 766
Phosphorus Deficiency Thiếu lân (P) 666

Class Imbalance

The dataset has significant class imbalance across the image component:

Most common : Healthy           — 3,764 images
Least common: Bakanae Disease   —   100 images
Imbalance ratio: 37.6 ×

When training on the combined train split, we recommend using class weights or focal loss to account for this. The stratified split ensures proportional class representation across train/val/test.


Image Properties

Based on EDA of 1,050 sampled images (50 per class):

Property Value
Mean height 1,223 px
Mean width 1,053 px
Most common aspect ratio 1:1 (square)
Height range 217 – 4,301 px
Width range 201 – 4,364 px
Mean file size 282 KB
Mean brightness 149.5 / 255
Color channels RGB (3)
File format JPEG (.jpg / .JPG / .jpeg)

Images vary widely in resolution. All models trained on this dataset resized inputs to 224 × 224 using transforms.Resize((224, 224)).


Data Collection

  • Source: Field photographs collected across multiple sources on the Internet
  • Geographic scope: Vietnam (Mekong Delta and surrounding agricultural regions)

Geographic bias: Images were collected exclusively in Vietnam. Generalization to rice-growing regions with substantially different climate, rice varieties, or lighting conditions (e.g., South Asia, East Africa) has not been validated.


Dataset Creation

Preprocessing

Images were not resized or augmented in the raw splits — they are served at original resolution. The train split CSV was generated with a stratified 70/15/15 split using sklearn.model_selection.train_test_split(stratify=label) with random_state=42.

Recommended Preprocessing for Training

from torchvision import transforms

train_transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.RandomHorizontalFlip(p=0.5),
    transforms.RandomVerticalFlip(p=0.3),
    transforms.RandomRotation(30),
    transforms.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.2),
    transforms.RandomAffine(degrees=0, translate=(0.1, 0.1)),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406],
                         std=[0.229, 0.224, 0.225]),  # ImageNet stats
])

val_transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406],
                         std=[0.229, 0.224, 0.225]),
])

Usage Examples

Basic Classification with HuggingFace Trainer

from datasets import load_dataset
from transformers import AutoFeatureExtractor, AutoModelForImageClassification, TrainingArguments, Trainer
import numpy as np

ds = load_dataset("minhhungg/rice-disease-dataset")

# Get label list from train split
labels = sorted(set(ds["train"]["label"]))
label2id = {l: i for i, l in enumerate(labels)}
id2label = {i: l for l, i in label2id.items()}

model_name = "google/efficientnet-b0"
extractor  = AutoFeatureExtractor.from_pretrained(model_name)

def preprocess(batch):
    inputs = extractor(images=batch["image"], return_tensors="pt")
    inputs["labels"] = [label2id[l] for l in batch["label"]]
    return inputs

ds_processed = ds.map(preprocess, batched=True, remove_columns=["image", "label"])

model = AutoModelForImageClassification.from_pretrained(
    model_name,
    num_labels=len(labels),
    id2label=id2label,
    label2id=label2id,
    ignore_mismatched_sizes=True,
)

args = TrainingArguments(
    output_dir="rice-classifier",
    per_device_train_batch_size=32,
    num_train_epochs=20,
    evaluation_strategy="epoch",
    save_strategy="best",
    metric_for_best_model="accuracy",
)

def compute_metrics(eval_pred):
    logits, labels = eval_pred
    preds = np.argmax(logits, axis=1)
    return {"accuracy": (preds == labels).mean()}

trainer = Trainer(
    model=model,
    args=args,
    train_dataset=ds_processed["train"],
    eval_dataset=ds_processed["validation"],
    compute_metrics=compute_metrics,
)
trainer.train()

PyTorch DataLoader (direct)

from datasets import load_dataset
from torch.utils.data import DataLoader
from torchvision import transforms
from PIL import Image

ds = load_dataset("minhhungg/rice-disease-dataset", split="train")
labels = sorted(set(ds["label"]))
label2id = {l: i for i, l in enumerate(labels)}

transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
])

def collate_fn(batch):
    images = [transform(item["image"].convert("RGB")) for item in batch]
    labels_t = [label2id[item["label"]] for item in batch]
    import torch
    return torch.stack(images), torch.tensor(labels_t)

loader = DataLoader(ds, batch_size=32, shuffle=True, collate_fn=collate_fn)
images, labels_t = next(iter(loader))
print(images.shape)  # torch.Size([32, 3, 224, 224])

Filtering to a Single Category

# Work only with disease images
diseases = load_dataset("minhhungg/rice-disease-dataset", split="diseases")

# Or filter the combined train split
from datasets import load_dataset
train = load_dataset("minhhungg/rice-disease-dataset", split="train")
diseases_only = train.filter(lambda x: x["label"] in [
    "Leaf Scald", "Sheath Blight", "Brown Spot",
    "Bacterial Leaf Blight", "Narrow Brown Spot",
    "Blast", "Bakanae Disease", "False Smut"
])

Limitations & Biases

  • Geographic: Collected exclusively in Vietnam. Pest and disease appearance may vary under different climate zones, rice varieties, or soil types.
  • Class imbalance: 37× imbalance between the largest and smallest classes. Models trained without compensation may underperform on Bakanae Disease and False Smut (100 images each).
  • Image quality variability: Images range from 201px to 4,364px wide, captured under varying field lighting conditions (overcast, direct sunlight, shade). Resolution normalization is required before training.
  • Single crop: Only covers rice (Oryza sativa). Not applicable to other crops without retraining.
  • Annotation granularity: Nutrient deficiency labels (N, P, K) are assigned at the nutrient level, not by deficiency severity stage.
Downloads last month
134