RSReasoner / README.md
RicardoString's picture
Upload RSReasoner
ab48bb2 verified
|
Raw History Blame Contribute Delete
3.83 kB
---
license: apache-2.0
configs:
- config_name: default
data_files:
- split: train
path: train/*.tar
- split: validation
path: validation/*.tar
dataset_info:
features:
- name: __key__
dtype: string
- name: __url__
dtype: string
- name: png
dtype: image
- name: json
dtype: string
splits:
- name: train
num_examples: 95150
- name: validation
num_examples: 5660
---
# RSReasoner
RSReasoner is a large-scale dataset for geospatial reasoning segmentation, constructed from aerial imagery and OpenStreetMap (OSM) semantics. This repository contains the training and validation splits; the held-out test set is released separately as [RSReasoner-Bench](https://huggingface.co/datasets/RicardoString/RSReasoner-Bench).
## Data scale
| Item | Train | Validation | Total |
|---|---:|---:|---:|
| Targets / images / masks | 95,150 each | 5,660 each | 100,810 each |
| Total query-mask pairs | 190,300 | 11,320 | 201,620 |
| Text answers | 95,150 | 5,660 | 100,810 |
| Area / non-area targets | 48,523 / 46,627 | 2,689 / 2,971 | 51,212 / 49,598 |
| With / without same-category competitors | 27,542 / 67,608 | 2,717 / 2,943 | 30,259 / 70,551 |
All images are RGB PNG files with a resolution of 448 × 448 pixels.
## Fields
Each JSON file describes one target and contains two query types: explicit-inferential (EI) and implicit-inferential (II). Both refer to the same target mask and share one reference answer.
| Field | Type | Description |
|---|---|---|
| `id` | integer | Unique target identifier. |
| `patch_id` | integer | Source image-patch identifier. |
| `file_name` | string | Image path inside the TAR shard, such as `images/000001.png`. |
| `type` | string | Target geometry: `area` or `non-area`. |
| `has_same_category_instance` | integer | `1` if another instance of the same category is present in the image; otherwise `0`. |
| `main_tag` | string | Normalized main OSM tag, expressed as `key=value`. |
| `full_tag` | object | Original OSM key-value dictionary; keys and values are strings. |
| `mask_rle` | object | COCO compressed RLE: `size` is `[height, width]`, and `counts` is a string. |
| `bbox` | array | Target bounding box in pixels: `[x, y, width, height]`. |
| `ei_query` | string | Explicit-inferential query. |
| `ii_query` | string | Implicit-inferential query. |
| `answer` | string | Reference reasoning answer shared by the EI and II queries. |
Original OSM tag values, including multilingual names, are preserved.
## Reading a target
```text
RSReasoner/
├── README.md
├── train/
│ ├── train-000000.tar
│ └── ...
└── validation/
├── validation-000000.tar
└── ...
```
Data is stored in WebDataset TAR shards. Each target is represented by an image and a JSON record with the same filename stem, such as `images/000001.png` and `images/000001.json`.
The following example reads one target and loads its image, segmentation mask, and bounding box. Set `root` to your local dataset directory. Reading requires `webdataset`, `Pillow`, and `pycocotools`.
```python
from pathlib import Path
import webdataset as wds
from pycocotools import mask as mask_utils
root = Path("RSReasoner")
split = root / "train" # Use "validation" for the validation split.
files = sorted(str(p) for p in split.glob("*.tar"))
dataset = wds.WebDataset(files, shardshuffle=False).decode("pil")
item = next(iter(dataset))
image = item["png"]
sample = item["json"]
rle = sample["mask_rle"]
mask = mask_utils.decode({
"size": rle["size"],
"counts": rle["counts"].encode("ascii"),
}) # 1 = target, 0 = background
bbox = sample["bbox"] # [x, y, width, height] in pixels
print(sample["id"], sample["ei_query"], sample["ii_query"])
print(image.size, mask.shape) # (448, 448), (448, 448)
print(bbox)
```