Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Give up after 6 attempts. The last one raised <class 'huggingface_hub.errors.HfHubHTTPError'>
Error code:   UnexpectedError

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

id
string
image
string
width
int32
height
int32
polygons
list
labels
list
relations
dict
0000
images/train/0000.png
3,584
2,048
[ [ [ 3110.078125, 396.1240234375 ], [ 3143.3896484375, 395.5802001953125 ], [ 3146.490234375, 585.502685546875 ], [ 3113.1787109375, 586.0465087890625 ] ], [ [ 3112.977783203125, 869.7674560546875 ], [ 3...
[ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7...
{ "subject_index": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 293, 25, 26, 59, 60, 71, 290, 291, 292, 73, 74, 75, 76,...
0001
images/train/0001.png
6,400
6,912
[ [ [ 4603.5703125, 4227.81787109375 ], [ 4664.8935546875, 4206.99072265625 ], [ 4682.6923828125, 4259.39990234375 ], [ 4621.369140625, 4280.22705078125 ] ], [ [ 4690.384765625, 4197.86181640625 ], [ 4754...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
{ "subject_index": [ 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 0, 1, 2, 3, 4, 5, 6, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, ...
0011
images/train/0011.png
7,936
7,424
[[[1552.0831298828125,2470.8330078125],[1628.8482666015625,2416.6435546875],[4218.62548828125,6085.3(...TRUNCATED)
[30,30,30,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,(...TRUNCATED)
{"subject_index":[86,87,88,89,90,93,94,96,98,99,100,101,102,103,104,105,106,107,107,155,156,158,159,(...TRUNCATED)
0016
images/train/0016.png
2,560
3,072
[[[1250.19921875,903.1873168945312],[1263.16162109375,882.3550415039062],[1281.88134765625,894.00286(...TRUNCATED)
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 30, 41, 41, 39, 39, 39, 39, 39, 39, 2, 2, 2, 2, 2, 2, 2, 2 ]
{"subject_index":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,17,19,20,21,19,20,21,32,38,32,26,28(...TRUNCATED)
0019
images/train/0019.png
5,406
7,681
[[[2140.408447265625,489.3877868652344],[2151.020751953125,446.5306091308594],[2202.525634765625,459(...TRUNCATED)
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1(...TRUNCATED)
{"subject_index":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,28,29,30,31,36(...TRUNCATED)
0022
images/train/0022.png
6,041
3,971
[[[4489.412109375,679.0197143554688],[4527.94140625,666.1765747070312],[4539.01953125,699.4118041992(...TRUNCATED)
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1(...TRUNCATED)
{"subject_index":[0,1,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,3(...TRUNCATED)
0023
images/train/0023.png
3,293
4,083
[[[621.45654296875,1613.0819091796875],[979.0001220703125,1554.0540771484375],[1049.7611083984375,19(...TRUNCATED)
[22,22,44,44,44,44,44,44,44,44,44,44,44,44,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,45,45,45,11,(...TRUNCATED)
{"subject_index":[2,3,14,15,16,17,18,19,20,21,22,23,24,25,11,9,10,11,9,10,13,8,6,7],"object_index":[(...TRUNCATED)
0024
images/train/0024.png
9,781
5,469
[[[1733.396240234375,1728.125732421875],[2131.535888671875,1572.733642578125],[2271.472900390625,193(...TRUNCATED)
[22,22,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,10,10,10,10,10,10,10,10,10,10,10,(...TRUNCATED)
{"subject_index":[22,23,25,24,26,28,29,30,31,32,33,4,5,10,11,12,13,14,17,18,19,20,21,2,6,3,7,48,27,4(...TRUNCATED)
0025
images/train/0025.png
5,319
5,363
[[[3657.10546875,4516.13330078125],[4133.33349609375,4376.66650390625],[4226.22802734375,4693.866699(...TRUNCATED)
[ 22, 22, 10, 10, 10, 10, 10, 10, 10, 44, 44, 44, 44, 44, 45, 45, 45, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 ]
{"subject_index":[2,3,4,5,6,7,8,9,10,11,10,12,13,2,2,3,2,2,3,5,5,5,6,6,7,5,5,5,6,6,7,9,9,10],"object(...TRUNCATED)
0030
images/train/0030.png
5,376
5,120
[[[1690.2239990234375,538.1507568359375],[1958.2513427734375,479.1210021972656],[1969.8414306640625,(...TRUNCATED)
[31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,7,7,7,(...TRUNCATED)
{"subject_index":[0,1,2,4,466,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,7(...TRUNCATED)
End of preview.

STAR Relationship

STAR Relationship 是一个遥感场景图生成(Scene Graph Generation,SGG)数据集。仓库将原始大尺寸图片与结构化标注分开保存:

  • 图片以普通文件形式位于 images/
  • train、validation 和 test 的结构化标注以 Parquet 保存。
  • Dataset 中的 image 字段是图片相对于仓库根目录的路径,不包含图片字节,也不会自动解码为 PIL 对象。

完整仓库约为 127 GB。使用 snapshot_download() 下载完整仓库前,请确认本地有足够的磁盘空间。

仓库结构

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
  • widthheight:原图宽高。
  • polygons:对象 polygon 列表;每个点为 [x, y],保留原始坐标和顶点顺序。
  • labels:与 polygons 一一对应的对象类别。
  • relations.subject_index:关系主语在对象数组中的索引。
  • relations.object_index:关系宾语在对象数组中的索引。
  • relations.predicate:关系类别。

test split 只有图片,polygonslabels 和三个关系数组均为空。

下载并读取

repo_type="dataset"snapshot_download() 的参数;load_dataset() 直接使用仓库 ID,不需要传入 repo_type

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

from PIL import Image


with Image.open(image_path) as image:
    image.load()
    print(image.size)

使用 OpenCV

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:

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 标注与原始图片始终来自同一个仓库版本。

Downloads last month
21