File size: 9,925 Bytes
33b4649
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7b61643
 
 
 
 
 
 
33b4649
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7b61643
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
---
pretty_name: MM-LUCAS
license: apache-2.0
task_categories:
- image-text-to-text
- visual-question-answering
size_categories:
- 1K<n<10K
configs:
- config_name: default
  data_files:
  - split: train
    path: train-0000-of-0001.parquet
dataset_info:
  features:
  - name: images
    list:
    - name: bytes
      dtype: 'null'
    - name: path
      dtype: string
  - name: id
    dtype: string
  - name: messages
    list:
    - name: role
      dtype: string
    - name: content
      list:
      - name: type
        dtype: string
      - name: text
        dtype: string
  - name: raw_metadata
    dtype: string
  splits:
  - name: train
    num_bytes: 1603077956
    num_examples: 7136
  download_size: 1603077956
  dataset_size: 1603077956
tags:
- agriculture
- vqa
- vision-language
- agribench
- mm-lucas
- ag-vqa
---

# MM-LUCAS

![MM-LUCAS sample images](static/MM-LUCAS_sample.jpeg)

MM-LUCAS is the dataset of AgriBench, a benchmark for testing multimodal large language models on agriculture. AgriBench sorts agricultural tasks into five levels, from basic recognition to planning and suggestions that match human judgment, with 17 main tasks.

MM-LUCAS has 1,784 landscape photos taken in 2018 at eye height across 27 EU countries, as part of the EU's Land Use/Cover Area Frame Survey (LUCAS). Each photo comes with a segmentation mask with 34 classes such as sky, tree, crop field and road, a depth map, and survey details: location, country, date, land cover and land use labels. Quality and aesthetic scores were added with Q-Align, and the depth maps were made with Depth Anything V2. The questions were written by GPT-4o and cover four topics: land cover and land use as four-option multiple choice, and image quality and aesthetics as one-word answers.

The paper tested five models (GPT-4o, Gemini 1.0 Pro, Claude 3.5 Sonnet, InternVL2-26B and mPLUG-Owl2) on two example tasks and compared their answers by hand. It reports no scores.

- Paper: [AgriBench: A Hierarchical Agriculture Benchmark for Multimodal Large Language Models](https://arxiv.org/abs/2412.00465)
- Original dataset: [Yutong-Zhou-cv/AgriBench](https://github.com/Yutong-Zhou-cv/AgriBench)
- Photos and masks: [Semantic segmentation dataset of LUCAS rural landscape street view images](https://doi.org/10.1016/j.dib.2024.110394)

## Tasks

| Task | `source_file` | Rows | Format |
|---|---|---|---|
| Land cover | `5_land_cover.json` | 1,784 | 4 options |
| Land use | `5_land_use.json` | 1,784 | 4 options |
| Image aesthetics | `5_aesthetics_score.json` | 1,784 | One word (Poor, Fair, Good) |
| Image quality | `5_quality_score.json` | 1,784 | One word (Fair, Good, Excellent) |

Each photo has one question of each type, worded differently from photo to photo.

## Masks and depth maps

No question uses the masks or depth maps. They are packed with the photos, and each row links to its photo's files by hash in `raw_metadata`. They can be loaded from the same zip shards as the photos.

| `raw_metadata` key | Source folder | What it is |
|---|---|---|
| `segmentation_mask` | `2_seg` | Grayscale PNG, one class ID per pixel |
| `segmentation_mask_color` | `2_seg_color` | The same mask in color |
| `depth_map` | `3_depth` | Depth map from Depth Anything V2, saved as a color PNG |

The depth maps are model predictions, not measured depth. The class names in each photo are in the `Classes` field. The source does not include a table from mask class ID to class name, and the IDs in the masks run from 1 to 36, while the paper describes values from 0 to 33.

## Structure

```
train-0000-of-0001.parquet
images/
  image-train-000-of-001.zip
  path_to_shard.parquet
```

Each row has:

- `images`: list with one `{"bytes": null, "path": <sha256>}`, the photo. The path is the SHA256 of the image bytes and points into a zip shard through `images/path_to_shard.parquet`.
- `id`: `mm_lucas_train_<counter>`, for example `mm_lucas_train_0`.
- `messages`: one user turn (image, then question, with options for land cover and land use) and one assistant turn (answer).
- `raw_metadata`: JSON string with `source_file`, `raw_image_paths`, the photo's row from `4_mm_lucas.csv` (`Quality Score`, `Aesthetic Score`, `gps_long`, `gps_lat`, `date`, `nuts0`, `lc1`, `lc1_label`, `lu1`, `lu1_label`, `Classes`), and the hashes `segmentation_mask`, `segmentation_mask_color` and `depth_map`.

Example:

```json
{
  "images": [{"bytes": null, "path": "43603b3cd5a171bb6529ade45f2d05f00b3bff30e84f2d9231ebceed77eacc0c"}],
  "id": "mm_lucas_train_1784",
  "messages": [
    {"role": "user", "content": [
      {"type": "image", "text": null},
      {"type": "text", "text": "What is the primary land cover visible here?\nA. Other fresh vegetables\nB. Permanent industrial crops\nC. Sand\nD. Broadleaved woodland"}
    ]},
    {"role": "assistant", "content": [{"type": "text", "text": "A. Other fresh vegetables"}]}
  ],
  "raw_metadata": "{\"source_file\": \"5_land_cover.json\", \"raw_image_paths\": [\"26441764N.png\"], \"Quality Score\": \"4.22265625\", \"Aesthetic Score\": \"1.99609375\", \"gps_long\": \"-8.918611\", \"gps_lat\": \"37.07296\", \"date\": \"28/05/2018 12:00\", \"nuts0\": \"PT\", \"lc1\": \"B43\", \"lc1_label\": \"Other fresh vegetables\", \"lu1\": \"U113\", \"lu1_label\": \"Kitchen garden\", \"Classes\": \"Sky, Tree, Background, Terrain, Plant_Bush, Flowerfield, Earth_Ground\", \"segmentation_mask\": \"9cd7a330b5e5591bfcd3a52952b0b7ddfbfba09cbb14f938a9e5048b6d2eeaf0\", \"segmentation_mask_color\": \"b218854f7f2fb5c38692d66655dc3d78d725783093e0e01d6d29a4ff21017e2d\", \"depth_map\": \"c010ba9b3a045d5147acfb78413f0440afefbaf241d35d2d90da7b2092ec81dd\"}"
}
```

### Changes from the original data

- Built from the four QA files. Rows follow the files in alphabetical order (aesthetics, land cover, land use, quality), each in its source order, so all 7,136 questions are kept. The source has no split, so all rows are in one `train` split.
- Land cover and land use options are added to the question as lines like `A. text`. The answer letter is combined with its option text, for example `A. Other fresh vegetables`. Aesthetics and quality answers are kept as written.
- The QA files name each photo as `<id>.png`, while the photo is stored as `<id>.jpg` in `1_images`. The name as written is kept in `raw_image_paths`.
- The CSV row of each photo is added to `raw_metadata` with its values kept as written, including the numeric quality and aesthetic scores.
- `segmentation_mask`, `segmentation_mask_color` and `depth_map` are added to `raw_metadata`. They are not source fields: they hold the hashes of the files with the same name in `2_seg`, `2_seg_color` and `3_depth`.
- All 7,136 files in the four folders are packed (1,784 each). Files are stored once, deduplicated by SHA256, which leaves 7,086 unique files, because some masks of different photos are identical.

## Usage

```python
from agml import loadImageTextToTextDataset

dataset = loadImageTextToTextDataset("Project-AgML/MM-LUCAS")

sample = dataset["train"][0]
sample["images"]    # list of PIL images
sample["messages"]
```

### Loading the masks and depth maps

The loader only decodes the photo, because the masks and depth maps are not part of the conversation. They sit in the same downloaded zip shards, and the dataset's `store` reads any of them by the hash in `raw_metadata`:

```python
import io, json
import numpy as np
from PIL import Image
from agml import loadImageTextToTextDataset

dataset = loadImageTextToTextDataset("Project-AgML/AgriBench")
store = dataset.store                                       # reads any file in images/ by its hash

def load_file(file_hash):
    return Image.open(io.BytesIO(store.getBytes(file_hash)))

sample = dataset["train"][0]
meta = json.loads(sample["raw_metadata"])

photo = sample["images"][0]                                 # the photo, decoded by the loader
mask = np.array(load_file(meta["segmentation_mask"]))       # (1200, 1600) uint8, one class ID per pixel
mask_color = load_file(meta["segmentation_mask_color"])     # same mask in color
depth = load_file(meta["depth_map"])                        # Depth Anything V2 output, color PNG

print(np.unique(mask))   # class IDs in this photo, e.g. [ 7  8  9 16 18 22 30]
print(meta["Classes"])   # class names in this photo, e.g. "Sky, Tree, Background, Terrain, Plant_Bush, Flowerfield, Earth_Ground"
```

## Citation

```bibtex
@article{zhou2024agribench,
  title={AgriBench: A Hierarchical Agriculture Benchmark for Multimodal Large Language Models},
  author={Zhou, Yutong and Ryo, Masahiro},
  journal={arXiv preprint arXiv:2412.00465},
  year={2024}
}

@article{martinez2024semantic,
  title={Semantic segmentation dataset of Land Use/Cover Area frame Survey (LUCAS) rural landscape Street View Images},
  author={Martinez-Sanchez, Laura and Hufkens, Koen and Kearsley, Elizabeth and Naydenov, Dimitar and Cz{\'u}cz, B{\'a}lint and van de Velde, Marijn},
  journal={Data in Brief},
  volume={54},
  pages={110394},
  year={2024},
  publisher={Elsevier}
}

@article{d2020harmonised,
  title={Harmonised LUCAS in-situ land cover and use database for field surveys from 2006 to 2018 in the European Union},
  author={d'Andrimont, Rapha{\"e}l and Yordanov, Momchil and Martinez-Sanchez, Laura and Eiselt, Beatrice and Palmieri, Alessandra and Dominici, Paolo and Gallego, Javier and Reuter, Hannes Isaak and Joebges, Christian and Lemoine, Guido and others},
  journal={Scientific data},
  volume={7},
  number={1},
  pages={352},
  year={2020},
  publisher={Nature Publishing Group UK London}
}
```

This dataset is indexed and structured on https://project-agml.github.io/ as part of Project AgML @ UC Davis. This dataset was reformatted from its original format to match HuggingFace's Imagefolder standards but requires an external module (agml) that processes and returns a HF Dataset object faster than HF module functions.