uchandar29 commited on
Commit
33b4649
·
verified ·
1 Parent(s): 8738246

Uploading MM-LUCAS dataset with image shards and metadata files in Zip Shard Format

Browse files
README.md ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: MM-LUCAS
3
+ license: apache-2.0
4
+ task_categories:
5
+ - image-text-to-text
6
+ - visual-question-answering
7
+ size_categories:
8
+ - 1K<n<10K
9
+ configs:
10
+ - config_name: default
11
+ data_files:
12
+ - split: train
13
+ path: train-0000-of-0001.parquet
14
+ dataset_info:
15
+ features:
16
+ - name: images
17
+ list:
18
+ - name: bytes
19
+ dtype: 'null'
20
+ - name: path
21
+ dtype: string
22
+ - name: id
23
+ dtype: string
24
+ - name: messages
25
+ list:
26
+ - name: role
27
+ dtype: string
28
+ - name: content
29
+ list:
30
+ - name: type
31
+ dtype: string
32
+ - name: text
33
+ dtype: string
34
+ - name: raw_metadata
35
+ dtype: string
36
+ splits:
37
+ - name: train
38
+ num_bytes: 1603077956
39
+ num_examples: 7136
40
+ download_size: 1603077956
41
+ dataset_size: 1603077956
42
+ ---
43
+
44
+ # MM-LUCAS
45
+
46
+ ![MM-LUCAS sample images](static/MM-LUCAS_sample.jpeg)
47
+
48
+ 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.
49
+
50
+ 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.
51
+
52
+ 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.
53
+
54
+ - Paper: [AgriBench: A Hierarchical Agriculture Benchmark for Multimodal Large Language Models](https://arxiv.org/abs/2412.00465)
55
+ - Original dataset: [Yutong-Zhou-cv/AgriBench](https://github.com/Yutong-Zhou-cv/AgriBench)
56
+ - Photos and masks: [Semantic segmentation dataset of LUCAS rural landscape street view images](https://doi.org/10.1016/j.dib.2024.110394)
57
+
58
+ ## Tasks
59
+
60
+ | Task | `source_file` | Rows | Format |
61
+ |---|---|---|---|
62
+ | Land cover | `5_land_cover.json` | 1,784 | 4 options |
63
+ | Land use | `5_land_use.json` | 1,784 | 4 options |
64
+ | Image aesthetics | `5_aesthetics_score.json` | 1,784 | One word (Poor, Fair, Good) |
65
+ | Image quality | `5_quality_score.json` | 1,784 | One word (Fair, Good, Excellent) |
66
+
67
+ Each photo has one question of each type, worded differently from photo to photo.
68
+
69
+ ## Masks and depth maps
70
+
71
+ 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.
72
+
73
+ | `raw_metadata` key | Source folder | What it is |
74
+ |---|---|---|
75
+ | `segmentation_mask` | `2_seg` | Grayscale PNG, one class ID per pixel |
76
+ | `segmentation_mask_color` | `2_seg_color` | The same mask in color |
77
+ | `depth_map` | `3_depth` | Depth map from Depth Anything V2, saved as a color PNG |
78
+
79
+ 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.
80
+
81
+ ## Structure
82
+
83
+ ```
84
+ train-0000-of-0001.parquet
85
+ images/
86
+ image-train-000-of-001.zip
87
+ path_to_shard.parquet
88
+ ```
89
+
90
+ Each row has:
91
+
92
+ - `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`.
93
+ - `id`: `mm_lucas_train_<counter>`, for example `mm_lucas_train_0`.
94
+ - `messages`: one user turn (image, then question, with options for land cover and land use) and one assistant turn (answer).
95
+ - `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`.
96
+
97
+ Example:
98
+
99
+ ```json
100
+ {
101
+ "images": [{"bytes": null, "path": "43603b3cd5a171bb6529ade45f2d05f00b3bff30e84f2d9231ebceed77eacc0c"}],
102
+ "id": "mm_lucas_train_1784",
103
+ "messages": [
104
+ {"role": "user", "content": [
105
+ {"type": "image", "text": null},
106
+ {"type": "text", "text": "What is the primary land cover visible here?\nA. Other fresh vegetables\nB. Permanent industrial crops\nC. Sand\nD. Broadleaved woodland"}
107
+ ]},
108
+ {"role": "assistant", "content": [{"type": "text", "text": "A. Other fresh vegetables"}]}
109
+ ],
110
+ "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\"}"
111
+ }
112
+ ```
113
+
114
+ ### Changes from the original data
115
+
116
+ - 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.
117
+ - 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.
118
+ - 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`.
119
+ - The CSV row of each photo is added to `raw_metadata` with its values kept as written, including the numeric quality and aesthetic scores.
120
+ - `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`.
121
+ - 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.
122
+
123
+ ## Usage
124
+
125
+ ```python
126
+ from agml import loadImageTextToTextDataset
127
+
128
+ dataset = loadImageTextToTextDataset("Project-AgML/MM-LUCAS")
129
+
130
+ sample = dataset["train"][0]
131
+ sample["images"] # list of PIL images
132
+ sample["messages"]
133
+ ```
134
+
135
+ ### Loading the masks and depth maps
136
+
137
+ 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`:
138
+
139
+ ```python
140
+ import io, json
141
+ import numpy as np
142
+ from PIL import Image
143
+ from agml import loadImageTextToTextDataset
144
+
145
+ dataset = loadImageTextToTextDataset("Project-AgML/AgriBench")
146
+ store = dataset.store # reads any file in images/ by its hash
147
+
148
+ def load_file(file_hash):
149
+ return Image.open(io.BytesIO(store.getBytes(file_hash)))
150
+
151
+ sample = dataset["train"][0]
152
+ meta = json.loads(sample["raw_metadata"])
153
+
154
+ photo = sample["images"][0] # the photo, decoded by the loader
155
+ mask = np.array(load_file(meta["segmentation_mask"])) # (1200, 1600) uint8, one class ID per pixel
156
+ mask_color = load_file(meta["segmentation_mask_color"]) # same mask in color
157
+ depth = load_file(meta["depth_map"]) # Depth Anything V2 output, color PNG
158
+
159
+ print(np.unique(mask)) # class IDs in this photo, e.g. [ 7 8 9 16 18 22 30]
160
+ print(meta["Classes"]) # class names in this photo, e.g. "Sky, Tree, Background, Terrain, Plant_Bush, Flowerfield, Earth_Ground"
161
+ ```
162
+
163
+ ## Citation
164
+
165
+ ```bibtex
166
+ @article{zhou2024agribench,
167
+ title={AgriBench: A Hierarchical Agriculture Benchmark for Multimodal Large Language Models},
168
+ author={Zhou, Yutong and Ryo, Masahiro},
169
+ journal={arXiv preprint arXiv:2412.00465},
170
+ year={2024}
171
+ }
172
+
173
+ @article{martinez2024semantic,
174
+ title={Semantic segmentation dataset of Land Use/Cover Area frame Survey (LUCAS) rural landscape Street View Images},
175
+ 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},
176
+ journal={Data in Brief},
177
+ volume={54},
178
+ pages={110394},
179
+ year={2024},
180
+ publisher={Elsevier}
181
+ }
182
+
183
+ @article{d2020harmonised,
184
+ title={Harmonised LUCAS in-situ land cover and use database for field surveys from 2006 to 2018 in the European Union},
185
+ 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},
186
+ journal={Scientific data},
187
+ volume={7},
188
+ number={1},
189
+ pages={352},
190
+ year={2020},
191
+ publisher={Nature Publishing Group UK London}
192
+ }
193
+ ```
194
+
195
+ 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.
images/image-train-000-of-001.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d0fd5868c1a1c722bd17f78ea27b917e253fdc7b06205e74d91fbbf8a56b6f3
3
+ size 1600292086
images/path_to_shard.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3590cbb765aefad4c86509fda76d89cf6ee5da8e35ae97ce32a606e84e8966ec
3
+ size 450467
static/MM-LUCAS_sample.jpeg ADDED

Git LFS Details

  • SHA256: 84b2e649a1c2b65486489fa7eecc65f071912a26199a2a062dc0a1f7ca7146a7
  • Pointer size: 131 Bytes
  • Size of remote file: 435 kB
train-0000-of-0001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7883f1201cb77013ec31a8fe4e4c6b4e596e6dd195a9ea4635a9a84c0f680251
3
+ size 2335403