File size: 10,780 Bytes
4694382 c33d624 | 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 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | ---
dataset_info:
features:
- name: id
dtype: string
- name: image
dtype: image
- name: panoptic_mask
dtype: image
- name: width
dtype: int32
- name: height
dtype: int32
- name: boxes
list:
list: float32
length: 4
- name: labels
list:
class_label:
names:
'0': __background__
'1': person
'2': bicycle
'3': car
'4': motorcycle
'5': airplane
'6': bus
'7': train
'8': truck
'9': boat
'10': traffic light
'11': fire hydrant
'12': stop sign
'13': parking meter
'14': bench
'15': bird
'16': cat
'17': dog
'18': horse
'19': sheep
'20': cow
'21': elephant
'22': bear
'23': zebra
'24': giraffe
'25': backpack
'26': umbrella
'27': handbag
'28': tie
'29': suitcase
'30': frisbee
'31': skis
'32': snowboard
'33': sports ball
'34': kite
'35': baseball bat
'36': baseball glove
'37': skateboard
'38': surfboard
'39': tennis racket
'40': bottle
'41': wine glass
'42': cup
'43': fork
'44': knife
'45': spoon
'46': bowl
'47': banana
'48': apple
'49': sandwich
'50': orange
'51': broccoli
'52': carrot
'53': hot dog
'54': pizza
'55': donut
'56': cake
'57': chair
'58': couch
'59': potted plant
'60': bed
'61': dining table
'62': toilet
'63': tv
'64': laptop
'65': mouse
'66': remote
'67': keyboard
'68': cell phone
'69': microwave
'70': oven
'71': toaster
'72': sink
'73': refrigerator
'74': book
'75': clock
'76': vase
'77': scissors
'78': teddy bear
'79': hair drier
'80': toothbrush
'81': banner
'82': blanket
'83': bridge
'84': cardboard
'85': counter
'86': curtain
'87': door-stuff
'88': floor-wood
'89': flower
'90': fruit
'91': gravel
'92': house
'93': light
'94': mirror-stuff
'95': net
'96': pillow
'97': platform
'98': playingfield
'99': railroad
'100': river
'101': road
'102': roof
'103': sand
'104': sea
'105': shelf
'106': snow
'107': stairs
'108': tent
'109': towel
'110': wall-brick
'111': wall-stone
'112': wall-tile
'113': wall-wood
'114': water-other
'115': window-blind
'116': window-other
'117': tree-merged
'118': fence-merged
'119': ceiling-merged
'120': sky-other-merged
'121': cabinet-merged
'122': table-merged
'123': floor-other-merged
'124': pavement-merged
'125': mountain-merged
'126': grass-merged
'127': dirt-merged
'128': paper-merged
'129': food-other-merged
'130': building-other-merged
'131': rock-merged
'132': wall-other-merged
'133': rug-merged
- name: segments
struct:
- name: id
list: int64
- name: area
list: int64
- name: iscrowd
list: bool
- name: isthing
list: bool
- name: relations
struct:
- name: subject_index
list: int64
- name: object_index
list: int64
- name: predicate
list:
class_label:
names:
'0': __background__
'1': over
'2': in front of
'3': beside
'4': 'on'
'5': in
'6': attached to
'7': hanging from
'8': on back of
'9': falling off
'10': going down
'11': painted on
'12': walking on
'13': running on
'14': crossing
'15': standing on
'16': lying on
'17': sitting on
'18': flying over
'19': jumping over
'20': jumping from
'21': wearing
'22': holding
'23': carrying
'24': looking at
'25': guiding
'26': kissing
'27': eating
'28': drinking
'29': feeding
'30': biting
'31': catching
'32': picking
'33': playing with
'34': chasing
'35': climbing
'36': cleaning
'37': playing
'38': touching
'39': pushing
'40': pulling
'41': opening
'42': cooking
'43': talking to
'44': throwing
'45': slicing
'46': driving
'47': riding
'48': parked on
'49': driving on
'50': about to hit
'51': kicking
'52': swinging
'53': entering
'54': exiting
'55': enclosing
'56': leaning on
splits:
- name: train
num_bytes: 8178055254
num_examples: 46563
- name: validation
num_bytes: 380822615
num_examples: 2186
download_size: 8560720927
dataset_size: 8558877869
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: validation
path: data/validation-*
---
# Panoptic Scene Graph
PSG(Panoptic Scene Graph)是面向全景场景图生成的数据集。每个场景图节点不仅包含对象类别和边界框,还通过 panoptic segmentation mask 与像素级区域对应。数据集同时覆盖 thing 和 stuff 类别。
本仓库将 RGB 图片和 panoptic PNG 直接嵌入 Parquet。通过 Hugging Face `Image` feature 加载后,两者都会解码为 Pillow 图像,不需要额外下载图片目录。
## 数据集规模
| Split | 样本 | 对象 / segments | 关系 |
| --- | ---: | ---: | ---: |
| `train` | 46,563 | 513,243 | 261,666 |
| `validation` | 2,186 | 24,910 | 13,705 |
| **总计** | **48,749** | **538,153** | **275,371** |
`validation` 对应完整 PSG 发布版中的官方 test split。完整发布版带有 test ground truth,因此这里保留其对象、mask 和关系标注,并改名为 Hugging Face 常用的 `validation`。部分样本没有关系,其关系数组为空。
PSG 中有少量不同样本引用同一张 COCO 图片;`id` 是 PSG 样本 ID,不应使用图片文件名替代。
## 加载
```python
from datasets import load_dataset
dataset = load_dataset("wliafe/PSG")
sample = dataset["train"][0]
image = sample["image"] # PIL.Image.Image
panoptic_mask = sample["panoptic_mask"] # PIL.Image.Image
print(sample["id"], image.size, panoptic_mask.size)
```
## 字段
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `id` | `string` | PSG 样本 ID |
| `image` | `Image` | 嵌入式 RGB 图片;源文件主要是 JPEG,少量 `.jpg` 实际为 PNG |
| `panoptic_mask` | `Image` | 嵌入式 RGB 编码 panoptic PNG |
| `width` / `height` | `int32` | 解码后 RGB 图片的实际像素尺寸 |
| `boxes` | `List[[float32; 4]]` | 与 segments 平行的 `[x1, y1, x2, y2]` 边界框 |
| `labels` | `List[ClassLabel]` | 与 segments 平行的对象类别 |
| `segments.id` | `List[int64]` | panoptic mask 中的 segment ID |
| `segments.area` | `List[int64]` | segment 的标注面积 |
| `segments.iscrowd` | `List[bool]` | COCO crowd 标记 |
| `segments.isthing` | `List[bool]` | thing/stuff 标记 |
| `relations.subject_index` | `List[int64]` | 主语在当前 segment 数组中的零基索引 |
| `relations.object_index` | `List[int64]` | 宾语在当前 segment 数组中的零基索引 |
| `relations.predicate` | `List[ClassLabel]` | 有向关系的谓词类别 |
`boxes`、`labels` 和四个 `segments` 数组长度相同。同一位置表示同一个场景图节点。三个 `relations` 数组长度也相同,同一位置共同表示一条有向关系。
## Panoptic mask
panoptic PNG 使用 RGB 三通道编码整数 segment ID:
```python
import numpy as np
rgb = np.asarray(sample["panoptic_mask"].convert("RGB"), dtype=np.int64)
segment_id_map = (
rgb[..., 0]
+ 256 * rgb[..., 1]
+ 256 * 256 * rgb[..., 2]
)
first_segment_id = sample["segments"]["id"][0]
first_segment_mask = segment_id_map == first_segment_id
print(first_segment_mask.sum())
```
mask 中的非零 segment ID 与 `segments.id` 对应。背景像素的 ID 为 0,这与 taxonomy 中保留的 `__background__` 类别编号是两个不同概念。
## 类别与关系
对象和谓词 taxonomy 都在索引 `0` 保留 `__background__`:
- 对象前景类别编号为 `1`–`133`,依次对应 80 个 thing 类和 53 个 stuff 类。
- 谓词前景类别编号为 `1`–`56`。
- `subject_index` 和 `object_index` 是样本内部 segment 数组的位置,不是类别 ID。
```python
features = dataset["train"].features
object_names = features["labels"].feature.names
predicate_names = features["relations"]["predicate"].feature.names
for subject, object_, predicate in zip(
sample["relations"]["subject_index"],
sample["relations"]["object_index"],
sample["relations"]["predicate"],
):
print(
object_names[sample["labels"][subject]],
predicate_names[predicate],
object_names[sample["labels"][object_]],
)
```
## 坐标约定
`boxes` 使用实际图片像素坐标下的 `[x1, y1, x2, y2]` 格式,并位于图片边界内。`width` 和 `height` 与解码后的 RGB 图片及 panoptic mask 尺寸一致。
## 使用限制
- 类别和谓词呈长尾分布,评估结果可能受高频类别主导。
- 场景图和分割标注可能包含遗漏、歧义或类别噪声。
- 本仓库不重新授予原始 COCO 图片版权;使用者应遵守 COCO 与 PSG 的许可和使用要求。
- 比较模型结果时,应确认采用相同 split、taxonomy 和 background 编号。
## 引用
```bibtex
@inproceedings{yang2022panoptic,
title={Panoptic Scene Graph Generation},
author={Yang, Jingkang and Ang, Yi Zhe and Guo, Zujin and Zhou, Kaiyang
and Zhang, Wayne and Liu, Ziwei},
booktitle={European Conference on Computer Vision},
year={2022}
}
```
|