MACE-Bench / benchmark /README.md
tirtho149's picture
MACE-Bench release: images, memory banks, captions, predictions, traces, code
c8e03af verified
|
Raw History Blame Contribute Delete
15.9 kB
metadata
license: cc-by-4.0
pretty_name: AgMEM-Bench
language:
  - en
task_categories:
  - image-classification
  - zero-shot-image-classification
tags:
  - agriculture
  - plant-disease
  - crop-disease
  - vision-language-model
  - retrieval-augmented
  - few-shot
  - benchmark
  - ood
size_categories:
  - 10K<n<100K
configs:
  - config_name: images
    default: true
    drop_labels: true
    data_files:
      - split: iid
        path: images/iid/**
      - split: ood_in_scope
        path: images/ood_in_scope/**
      - split: ood_out_of_scope
        path: images/ood_out_of_scope/**
      - split: probe_out_of_scope
        path: images/probe_out_of_scope/**
  - config_name: assignments
    data_files: splits/assignments.parquet
  - config_name: memory
    data_files: splits/memory.parquet
  - config_name: iid_folds
    data_files: splits/iid_5fold_3seed.parquet
  - config_name: ood_heldout_collection
    data_files: splits/ood_heldout_collection.parquet
  - config_name: collection_same_vs_other
    data_files: splits/collection_same_vs_other.parquet
  - config_name: metadata
    data_files: metadata/images.parquet

AgMEM-Bench

crops diseases images memory K near-copies splits license

AgMEM-Bench tests one claim: a frozen vision-language model that reads short text captions of labelled reference images (caption memory) can diagnose crop disease as well as an agent that opens the reference images themselves (agentic few-shot), at a fraction of the cost. A memory gain means little if the memory holds a near-copy of the test image, so the benchmark removes near-copies before any split and checks the guarantee on every fold.

At a glance

Crops 59, each with at least 2 disease classes
Disease classes 290, each with at least 15 distinct images
IID images 18,524 (per class: min 15, median 53, max 214)
IID test images per class per run min 9, median 31 (3 of 5 folds)
OOD in-scope images 2,420 from a held-out collection in 24 crops
OOD out-of-scope images 2,776 (1,563 held-out collection, 1,213 rare-class probes)
Same disease on two or more crops 37 diseases
Knowledge base every SAGE source-grounded entry for every class, with URL and verbatim quote

Example images per split

How it was built

Build pipeline

  1. Selection. Up to 300 images per (crop, disease) from tirtho149/SAGE, drawn with a fixed seed and round-robin over source collections so no single collection dominates a class.
  2. Copies and conflicts. Exact SHA-256 copies and pHash pairs within Hamming distance 8 collapse to one image. When copies carry different labels or crops, every copy is dropped (1,071 groups).
  3. Text and label noise. Apple Vision OCR reads every image. Images whose text names or describes a disease, pathogen or symptom, carries a caption, slide or document text, or that OpenCLIP rates as a slide or collage, are dropped (657 images). Images whose only text is a watermark, credit or ID stamp stay, flagged has_watermark. Near-identical images (OpenCLIP cosine >= 0.95) filed under different diseases of one crop, and same-disease images filed under two crops (cosine >= 0.90), are both dropped (4,012 images).
  4. Near-copy removal. SemDeDup (Abbas et al., 2023) on OpenCLIP ViT-B-32 (laion2b_s34b_b79k) embeddings, run exhaustively within each crop and disease: an image stays only if its cosine to every kept image is below 0.90 (18,794 images removed).
  5. Held-out collection. For each crop with several collections, one collection is held out by a fixed rule (the one covering the most diseases that keep at least 15 images elsewhere). It never enters memory.
  6. Eligibility. A disease needs at least 15 distinct in-distribution images; a crop needs at least 2 such diseases.

Guarantees (checked, see audit/leakage_guarantee.json)

Check Result
Highest same-disease cosine between a test image and any memory image, over all seeds and folds 0.9 (bound: below 0.90)
Highest cosine to any memory image, median / 99th percentile 0.8751 / 0.9281
Near-identical images with different labels in one crop none (all pairs >= 0.95 removed)
Images whose text names or describes a disease none (OCR on every image, 657 removed)
Same-disease near-copies across crops 0
Duplicate image IDs / duplicate file hashes 0 / 0

Train and test, explicitly

splits/assignments.parquet has one row per (seed, run, crop, image) and a split column. train is the labelled pool from which memory is chosen. Every other value is a test set. Per (seed, run):

split images per (seed, run) changes with run?
train 7,583 yes, 2 of the 5 folds (memory is chosen from these)
test_iid 10,941 yes, the other 3 folds
test_ood_in_scope 2,420 no, the held-out collection
test_ood_out_of_scope 1,563 no
test_probe 1,213 no

Run r of seed s uses folds r and r+1 (mod 5) as train and the other three as test, so every IID image is train in 2 runs and test in 3 runs of each seed. Seeds 0, 1, 2 times runs 0 to 4 give 15 runs. Train always comes from the same crop as the test image and never contains a test image or the crop's held-out collection.

Memory: K = 1, 2, 4, 8, 16 representatives per disease

Memory holds K labelled images per disease, K in {1, 2, 4, 8, 16}. In each (seed, run, crop, disease) the images are ordered by greedy facility location on OpenCLIP embeddings of that disease's train images: each step adds the image that best covers the train images not yet represented. The first K images of that order form the size-K memory, so the sets are nested (K = 4 contains K = 2) and the memory-size curve isolates the effect of adding memory. Ag-MEM retrieves 4 captions per test image and the agentic baseline views 4 images, the SAGE budget; K = 4 is the headline point. Diseases with fewer than K train images use all of them (the smallest has 6 per run; the median has 22).

splits/memory.parquet (one row per memory image and K; select K == k):

memory what it holds question it answers
mixed (default) K per disease from all train collections of the crop headline IID and OOD numbers
same_source K per disease from the test image's own collection only (test_collection) does memory help when it looks like the test image?
other_source K per disease with the test image's collection removed does memory transfer across collections?
mixed + noise25_class 25% of memory labels replaced by another disease robustness to label noise
mixed + shuffled_class all memory labels permuted does the model use the labels at all?

Memory images per (seed, run), mixed: K = 1: 290, K = 2: 580, K = 4: 1,160, K = 8: 2,297, K = 16: 4,019. Distinct images to caption over every variant and run: K = 4: 9,785; K = 16: 16,444.

Reproduce and verify. python code/verify.py re-checks every guarantee from the released files (hashes in LOCK.json, no train/test overlap, held-out collections absent from train, each IID image tested 3 times per seed, the 0.90 near-copy bound from the shipped OpenCLIP embeddings, the shuffle being a permutation). The last run is in audit/verify_output.txt. code/ rebuilds the release from SAGE with fixed seeds (meta.py, select_rows.py, fetch.py, embed_clip.py, build.py lock 0.90, finalize.py).

Protocols

Every (seed, run) defines the memories: K representatives per disease, chosen from that run's train folds. All seven protocols use that same memory, so their numbers compare directly. Report the mean and SD over the 15 runs, and pair conditions on identical test items.

Protocol Test Memory File
IID the 3 test folds of run r, seed s mixed memory, K per disease from the 2 train folds splits/assignments.parquet, splits/memory.parquet
OOD in-scope held-out collection, disease present in memory same fold memory splits/ood_heldout_collection.parquet (scope == in_scope)
OOD out-of-scope held-out collection or rare-class probe, disease absent from memory same fold memory ood_heldout_collection.parquet (scope == out_of_scope), splits/out_of_scope.json
Same disease, other crop IID test of a shared disease that disease's memory from another crop splits/same_disease_other_crop.json
Same vs other source 4,336 paired items per seed same_source vs other_source vs mixed splits/collection_same_vs_other.parquet, splits/memory.parquet
Label noise / shuffle IID test mixed with noise25_class or shuffled_class splits/memory.parquet

Out-of-scope items support two scorings: open_set (the disease is not in the class list) and in_list_no_memory (the disease is listed and has KB text, but no memory). Held-out collections: Bugwood (15 crops), PlantWild (2 crops), LeafNet (2 crops), Banana_Leaf (1 crops), Cauliflower (1 crops), Eggplant_Dis (1 crops), SBRD (1 crops), CDDM (1 crops).

Quick start

from datasets import load_dataset
import pandas as pd
from huggingface_hub import hf_hub_download

iid = load_dataset("tirtho149/agmem-bench", "images", split="iid")          # image + crop, disease, collection
asg = pd.read_parquet(hf_hub_download("tirtho149/agmem-bench", "splits/assignments.parquet", repo_type="dataset"))

seed, run, crop = 0, 0, "Corn"
a = asg[(asg.seed == seed) & (asg.run == run) & (asg.crop == crop)]
test_ids = set(a[a.split == "test_iid"].image_id)  # also test_ood_in_scope, test_ood_out_of_scope, test_probe
memory = pd.read_parquet(hf_hub_download("tirtho149/agmem-bench", "splits/memory.parquet", repo_type="dataset"))
mem = memory[(memory.seed == seed) & (memory.run == run) & (memory.crop == crop) & (memory.memory == "mixed") & (memory.K == 4)]
memory_ids = set(mem.image_id)                    # 4 per disease; caption these, agentic refs view 4 of the same

For a smaller budget, keep images with budget_rank < N (a fixed seeded order inside each disease).

Knowledge base

kb/<crop>/sage_kb.json lists, for every disease in the crop, each distinct SAGE knowledge entry (visual symptoms, pathogen, disease type, affected organ, source URL, verbatim quote) with its row count. Where the crop was in the SAGE WACV study, sage_wacv_internet.xlsx and sage_wacv_part_index.md hold that KB; soybean, corn and tomato also carry kb_corrected_v1.json. kb/all_sage_crops_kb.jsonl covers all 335 SAGE crops.

Per crop

Images and classes per crop

Table: all 59 crops
Crop Diseases IID images Held-out collection OOD in-scope Out-of-scope
Soybean 26 2,164 Bugwood 194 76
Corn 31 1,820 Bugwood 185 111
Tomato 20 1,358 CDDM 73 225
Wheat 7 993 Bugwood 196 68
Apple 8 718 Bugwood 75 59
Cucumber 8 699 Bugwood 227 82
Melon 11 551 - - 61
Cassava 4 547 - - -
Banana 7 512 Banana_Leaf 275 -
Grape 6 481 Bugwood 72 21
Pine 10 446 - - 82
Rice 8 437 SBRD 95 50
Mango 5 420 LeafNet 131 -
Strawberry 4 416 PlantWild 66 20
Peach 4 380 Bugwood 75 72
Squash 7 374 - - 57
Sugarcane 7 366 LeafNet 46 104
Potato 4 305 Bugwood 86 288
Rose 2 300 Bugwood 26 217
Cauliflower 4 278 Cauliflower 225 -
Lettuce 5 269 - - 78
Pumpkin 3 258 - - -
Vanilla 2 251 - - -
Zucchini 4 251 - - 7
Citrus 2 235 Bugwood 65 90
Bell Pepper 3 233 - - -
Bean 3 210 - - 45
Maple 4 207 - - 56
Oak 7 207 - - 136
Papaya 2 188 - - -
Blueberry 5 169 Bugwood 89 49
Garlic 2 169 - - -
Plum 5 167 Bugwood 29 65
Cashew 2 157 - - -
Coffee 3 153 PlantWild 91 46
Common Hop 3 152 - - 15
Cabbage 3 136 Bugwood 19 -
Cherry 2 131 Bugwood 13 30
Raspberry 4 116 - - 8
Tobacco 3 116 Bugwood 42 123
Carrot 2 113 - - -
Pepper 3 99 - - 5
Tea 2 88 - - -
Eggplant 2 84 Eggplant_Dis 25 49
Cedar 3 81 - - 14
Spruce 2 81 - - 34
Celery 2 61 - - -
Almond 2 59 - - -
Beech 2 56 - - 5
Beet 2 56 - - 43
Durian 2 56 - - -
Broccoli 2 55 - - -
Hickory 2 55 - - 6
Elm 2 52 - - 16
Onion 2 40 - - 121
Peanut 2 39 - - 17
Cabbage Kale 2 37 - - 71
Orange 2 37 - - -
Fir 2 35 - - 54

Layout

images/<split>/<crop>/<image_id>.jpg   longest side 512 px, JPEG q90; <split>/metadata.jsonl for the viewer
metadata/images.parquet                 one row per image: crop, disease, role, collection, SAGE shard/row, sha256, pHash, has_watermark
metadata/summary.json                   per-crop counts
splits/assignments.parquet              explicit train / test per (seed, run, crop, image)
splits/memory.parquet                   K = 1, 2, 4, 8, 16 per disease (nested): mixed / same_source / other_source, noise, shuffle
splits/                                 the seven protocols
kb/                                     knowledge base per crop
audit/                                  guarantees, removed images and why
code/                                   scripts that rebuild everything from SAGE
LICENSE.md                              CC BY 4.0 (data), MIT (code), third-party notes
LOCK.json                               SHA-256 of every file; splits fixed 2026-11-02

Versions

main is v2: 59 crops, at least 15 distinct images per disease. The earlier v1 (49 crops, up to 100 images per disease before near-copy removal) stays under the tag v1-49crops-cap100.

Citation

Images and the knowledge base come from SAGE. Please cite it:

@article{sage2026,
  title   = {SAGE: Scalable Agentic Grounded Evaluation for Crop Disease Diagnosis},
  author  = {Arshad, Muhammad Arbab and Roy, Tirtho and Shen, Yanben and Elango, Dinakaran and
             Chiranjeevi, Shivani and Singh, Asheesh K. and Ganapathysubramanian, Baskar and
             Hegde, Chinmay and Singh, Arti and Sarkar, Soumik},
  journal = {arXiv preprint arXiv:2605.09768},
  year    = {2026}
}

License

Data: CC BY 4.0, inherited from SAGE. Code in code/: MIT. Source collections and quoted knowledge-base pages keep their own terms; metadata/images.parquet traces every image to its collection and original filename. Labels were not re-verified by plant pathologists. Full terms: LICENSE.md.