File size: 8,026 Bytes
9158e93 6afd46a dae4d0c 6afd46a dae4d0c 6afd46a dae4d0c 6afd46a 9158e93 | 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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | ---
pretty_name: STAR Relationship
tags:
- scene-graph-generation
- remote-sensing
- polygon-annotation
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: validation
path: data/validation-*
- split: test
path: data/test-*
dataset_info:
features:
- name: id
dtype: string
- name: image
dtype: string
- name: width
dtype: int32
- name: height
dtype: int32
- name: polygons
list:
list:
list: float32
length: 2
- name: labels
list:
class_label:
names:
'0': __background__
'1': airplane
'2': apron
'3': arch_dam
'4': baseball_diamond
'5': basketball_court
'6': boarding_bridge
'7': boat
'8': breakwater
'9': bridge
'10': car
'11': car_parking
'12': cement_concrete_pavement
'13': chimney
'14': coal_yard
'15': containment_vessel
'16': cooling_tower
'17': crane
'18': dock
'19': engineering_vehicle
'20': flood_dam
'21': foundation_pit
'22': gas_station
'23': genset
'24': goods_yard
'25': gravity_dam
'26': ground_track_field
'27': intersection
'28': lattice_tower
'29': roundabout
'30': runway
'31': ship
'32': ship_lock
'33': smoke
'34': soccer_ball_field
'35': stadium
'36': storehouse
'37': substation
'38': tank
'39': taxiway
'40': tennis_court
'41': terminal
'42': toll_gate
'43': tower_crane
'44': truck
'45': truck_parking
'46': unfinished_building
'47': vapor
'48': wind_mill
- name: relations
struct:
- name: subject_index
list: int64
- name: object_index
list: int64
- name: predicate
list:
class_label:
names:
'0': __background__
'1': adjacent
'2': approach
'3': around
'4': away from
'5': co-storage with
'6': connect
'7': converge
'8': directly connected to
'9': directly transmit electricity to
'10': docked alongside with
'11': docking at the different dock with
'12': docking at the same breakwater with
'13': docking at the same dock with
'14': drive off
'15': drive toward
'16': driving alongside with
'17': driving in the different lane with
'18': driving in the opposite direction with
'19': driving in the same direction with
'20': driving in the same lane with
'21': exhaust to
'22': in the different parking with
'23': in the same parking with
'24': incorrectly parked on
'25': indirectly connected to
'26': indirectly transmit electricity to
'27': intersect
'28': isolatedly docked at
'29': isolatedly parked on
'30': not co-storage with
'31': not docked alongside with
'32': not parked alongside with
'33': not run along
'34': not working on
'35': over
'36': parallelly docked at
'37': parallelly parked on
'38': parked alongside with
'39': parking in the different apron with
'40': parking in the same apron with
'41': pass across
'42': pass through
'43': pass under
'44': randomly docked at
'45': randomly parked on
'46': run along
'47': running along the different runway with
'48': running along the different taxiway with
'49': running along the same taxiway with
'50': slightly emit
'51': supply to
'52': through
'53': violently emit
'54': within danger distance of
'55': within different line of
'56': within safe distance of
'57': within same line of
'58': working on
splits:
- name: train
num_bytes: 10717079
num_examples: 771
- name: validation
num_bytes: 4288100
num_examples: 238
- name: test
num_bytes: 15840
num_examples: 264
download_size: 14671494
dataset_size: 15021019
---
# STAR Relationship
STAR Relationship 是一个遥感场景图生成(Scene Graph Generation,SGG)数据集。仓库将原始大尺寸图片与结构化标注分开保存:
- 图片以普通文件形式位于 `images/`。
- train、validation 和 test 的结构化标注以 Parquet 保存。
- Dataset 中的 `image` 字段是图片相对于仓库根目录的路径,不包含图片字节,也不会自动解码为 PIL 对象。
完整仓库约为 127 GB。使用 `snapshot_download()` 下载完整仓库前,请确认本地有足够的磁盘空间。
## 仓库结构
```text
wliafe/star
├── README.md
├── images
│ ├── train
│ │ └── 0000.png
│ ├── validation
│ │ └── 0002.png
│ └── test
│ └── 0004.png
└── data
├── train-*.parquet
├── validation-*.parquet
└── test-*.parquet
```
本地源数据中的 `val` 在 Hugging Face Dataset 中命名为 `validation`。
## 数据字段
每行表示一张图片及其场景图标注:
- `id`:图片文件名去除扩展名后的样本 ID。
- `image`:仓库相对路径,例如 `images/train/0000.png`。
- `width`、`height`:原图宽高。
- `polygons`:对象 polygon 列表;每个点为 `[x, y]`,保留原始坐标和顶点顺序。
- `labels`:与 `polygons` 一一对应的对象类别。
- `relations.subject_index`:关系主语在对象数组中的索引。
- `relations.object_index`:关系宾语在对象数组中的索引。
- `relations.predicate`:关系类别。
test split 只有图片,`polygons`、`labels` 和三个关系数组均为空。
## 下载并读取
`repo_type="dataset"` 是 `snapshot_download()` 的参数;`load_dataset()` 直接使用仓库 ID,不需要传入 `repo_type`。
```python
from pathlib import Path
from datasets import load_dataset
from huggingface_hub import snapshot_download
repo_dir = Path(
snapshot_download(
repo_id="wliafe/star",
repo_type="dataset",
)
)
dataset = load_dataset("wliafe/star")
sample = dataset["train"][0]
image_path = repo_dir / sample["image"]
print(sample["id"])
print(sample["image"])
print(image_path)
assert image_path.is_file()
```
`snapshot_download()` 返回仓库快照根目录,因此将它与 `sample["image"]` 拼接即可得到本地图片路径。不要直接把相对路径解释为当前工作目录下的文件。
### 使用 Pillow
```python
from PIL import Image
with Image.open(image_path) as image:
image.load()
print(image.size)
```
### 使用 OpenCV
```python
import cv2
image = cv2.imread(str(image_path), cv2.IMREAD_UNCHANGED)
if image is None:
raise RuntimeError(f"无法读取图片:{image_path}")
print(image.shape)
```
## 固定数据版本
如果训练或评测需要可复现的数据版本,请为下载和 Dataset 加载指定同一个完整 commit revision:
```python
from pathlib import Path
from datasets import load_dataset
from huggingface_hub import snapshot_download
revision = "<full-commit-sha>"
repo_dir = Path(
snapshot_download(
repo_id="wliafe/star",
repo_type="dataset",
revision=revision,
)
)
dataset = load_dataset("wliafe/star", revision=revision)
image_path = repo_dir / dataset["train"][0]["image"]
```
这样 Parquet 标注与原始图片始终来自同一个仓库版本。
|