vg
收藏资源简介:
该数据集是经过结构化处理的Visual Genome场景图数据集,可通过Hugging Face datasets库直接加载。它基于Visual Genome数据集,专门用于场景图生成、视觉关系检测等计算机视觉任务。数据集包含89,154张图像样本,划分为62,407个训练样本、8,915个验证样本和17,832个测试样本。每张图像都附有详细的场景图标注,包括对象边界框(格式为[x_min, y_min, x_max, y_max])、对象类别标签(采用VG150体系,包含150个前景对象类别,如airplane、animal、car等,以及一个__background__类别)、属性标签(200个前景属性类别,如颜色、大小、材质等描述性属性)以及对象间的关系(50个前景关系类别,如above、holding、sitting on等)。关系以三元组形式表示,包含主语索引、宾语索引和谓词。数据集的图像直接嵌入在Parquet文件中,加载时可解码为PIL图像对象。标注遵循特定约定,如边界框被裁剪到图像范围内,面积为零的对象被移除,关系端点引用当前对象数组的索引。该数据集适用于场景理解、视觉关系检测、图像描述生成等研究。
This dataset is a structured version of the Visual Genome scene graph dataset, which can be directly loaded via the Hugging Face datasets library. It is based on the Visual Genome dataset and is specifically designed for computer vision tasks such as scene graph generation and visual relationship detection. The dataset contains 89,154 image samples, divided into 62,407 training samples, 8,915 validation samples, and 17,832 test samples. Each image is accompanied by detailed scene graph annotations, including object bounding boxes (in the format [x_min, y_min, x_max, y_max]), object category labels (using the VG150 system, which includes 150 foreground object categories such as airplane, animal, car, etc., and one __background__ category), attribute labels (200 foreground attribute categories, such as color, size, material, and other descriptive attributes), and relationships between objects (50 foreground relationship categories, such as above, holding, sitting on, etc.). Relationships are represented as triplets, including subject index, object index, and predicate. The images are directly embedded in Parquet files and can be decoded into PIL image objects upon loading. The annotations follow specific conventions, such as bounding boxes being cropped to the image boundaries, zero-area objects being removed, and relationship endpoints referencing indices in the current object array. The dataset is suitable for research in scene understanding, visual relationship detection, image caption generation, and related areas.
Visual Genome 场景图数据集
数据集概述
该数据集为经过结构化处理的 Visual Genome 场景图数据集,可通过 Hugging Face datasets 库直接加载。数据采用 VG150 类别体系,包含 150 个前景对象类别、50 个前景关系类别和 200 个前景属性类别,每组类别均包含索引为 0 的 __background__ 类别。
数据规模
| 数据划分 | 样本数 |
|---|---|
| train | 62,407 |
| validation | 8,915 |
| test | 17,832 |
| 合计 | 89,154 |
数据集下载大小约为 12.7 GB,存储大小约为 12.86 GB。图片直接嵌入 Parquet 文件中,读取样本时 image 字段由 Hugging Face 解码为 PIL 图片对象。
字段说明
每行数据表示一张图片及其对应的场景图,包含以下字段:
- id:样本 ID。
- image:Hugging Face
Image字段,读取样本时返回 PIL 图片。 - width、height:图片的宽度和高度。
- boxes:对象边界框,格式为
[x_min, y_min, x_max, y_max]。 - labels:与
boxes一一对应的对象类别 ID。 - attributes:与对象一一对应的属性类别 ID 列表。
- relations.subject_index:关系主语在对象数组中的索引。
- relations.object_index:关系宾语在对象数组中的索引。
- relations.predicate:关系类别 ID。
对象、属性和关系均使用 ClassLabel 类型表示,可通过 Dataset 的 features 获取对应的类别名称列表。
数据加载示例
python from datasets import load_dataset
dataset = load_dataset("wliafe/vg") print(dataset)
sample = dataset["train"][0] print(sample["id"]) print(sample["image"].size) print(len(sample["boxes"])) print(len(sample["relations"]["predicate"]))
如需避免立即解码图片,可先将 image 字段转换为 decode=False。类别名称可通过以下方式读取:
python features = dataset["train"].features object_names = features["labels"].feature.names attribute_names = features["attributes"].feature.feature.names predicate_names = features["relations"]["predicate"].feature.names
标注约定
- 边界框会裁剪到图片范围内。
- 裁剪后面积为零的对象不会保留。
- 引用已删除对象的关系不会保留。
- 关系端点保存为当前对象数组的索引,而非 Visual Genome 的原始对象 ID。
boxes、labels和attributes使用相同的对象顺序。
引用信息
如果该数据集对你的研究有帮助,请引用 Visual Genome 原始论文:
bibtex @article{krishna2017visual, title={Visual Genome: Connecting Language and Vision Using Crowdsourced Dense Image Annotations}, author={Krishna, Ranjay and Zhu, Yuke and Groth, Oliver and Johnson, Justin and Hata, Kenji and Kravitz, Joshua and Chen, Stephanie and Kalantidis, Yannis and Li, Li-Jia and Shamma, David A. and Bernstein, Michael S. and Fei-Fei, Li}, journal={International Journal of Computer Vision}, volume={123}, pages={32--73}, year={2017} }
数据的使用许可和适用范围请以 Visual Genome 官方发布条款为准。




