| --- |
| 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} |
| } |
| ``` |
|
|