SUN RGB-D 深度数据集#
SUN RGB-D 是一个真实世界室内场景理解基准,使用四种不同的 RGB-D 传感器采集:Intel RealSense、Asus Xtion,以及 Microsoft Kinect v1 和 v2。其多传感器设计使其成为真实室内深度多样性的重要来源,可用于单目深度估计。
探索 Ultralytics Platform 上的 SUN RGB-D,预览其 RGB-深度图像对、查看数据集统计信息,并克隆数据集以进行训练。
主要功能#
- 使用四种不同的 RGB-D 传感器采集(Intel RealSense、Asus Xtion、Microsoft Kinect v1 和 v2),提供真实的多传感器多样性。
- 涵盖各种真实的室内场景,可用于场景理解研究。
- 深度范围最高约 10 m,符合消费级室内 RGB-D 采集的典型范围。
- 由传感器生成的深度真值与 RGB 帧对齐。
- 为 Ultralytics 深度预训练数据混合提供真实的室内多传感器多样性。
数据集结构#
SUN RGB-D 深度数据集分为两个子集:
- Train:9,245 张图像及其配对深度图,用于训练。
- Val:1,090 张图像及其配对深度图,用于模型训练期间的验证。
每个样本包含一张 RGB 图像和一张配对的缩放 uint16 深度 PNG,遵循 Ultralytics 深度数据集格式。数据集 YAML 会下载源存档(~6.5 GB),并在首次使用时自动转换,深度值以毫米为单位,因此适用默认的 depth_scale: 1000。
在 YOLO26-Depth 中的作用#
SUN RGB-D 是 Ultralytics YOLO26-Depth 多数据集预训练混合中的一个训练来源,该混合约包含 2.19M 组图像-深度图像对。它提供真实的室内多传感器多样性,让模型接触来自多种不同消费级 RGB-D 设备的深度数据。生成的模型会在 NYU、KITTI、Make3D、ETH3D 和 iBims-1 标准基准上进行评估。
数据集 YAML#
数据集配置使用 YAML 文件定义,其中包含数据集路径、类别及其他相关信息。
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# SUN RGB-D dataset for monocular depth estimation — real indoor, multi-sensor RGB-D (RealSense/Xtion/Kinect), up to ~10 m
# Documentation: https://docs.ultralytics.com/datasets/depth/sunrgbd
# Example usage: yolo depth train data=depth-sunrgbd.yaml model=yolo26n-depth.pt
# parent
# ├── ultralytics
# └── datasets
# └── depth-sunrgbd ← downloads here (6.5 GB archive, ~14 GB converted)
# ├── images/{train,val} # RGB images
# └── depth/{train,val} # paired 16-bit *.png depth maps (images/ -> depth/)
# If an interrupted download leaves a partial dataset, delete the depth-sunrgbd dir and re-run to rebuild it.
path: depth-sunrgbd # dataset root dir (relative to Ultralytics settings 'datasets_dir')
train: images/train # train images (relative to 'path') 9245 images
val: images/val # val images (relative to 'path') 1090 images
nc: 1
names:
0: depth
channels: 3
# Download script/URL (optional)
download: |
import random
import shutil
from pathlib import Path
import cv2
import numpy as np
from ultralytics.data.utils import save_depth_png
from ultralytics.utils import TQDM
from ultralytics.utils.downloads import download
# Download and extract the official archive (~6.5 GB), then convert each of the 10335 scenes:
# refined depth_bfx PNGs decode via the SUN RGB-D bit-rotation (d>>3 | d<<13) to millimeters,
# clipped at 10 m; a deterministic random 1090-scene subset (seed 0) forms the val split
dir = Path(yaml["path"]) # dataset root dir
download(["https://rgbd.cs.princeton.edu/data/SUNRGBD.zip"], dir=dir / "source", delete=True, exist_ok=True)
for split in ("train", "val"):
(dir / "images" / split).mkdir(parents=True, exist_ok=True)
(dir / "depth" / split).mkdir(parents=True, exist_ok=True)
scenes = sorted(p.parent for p in (dir / "source" / "SUNRGBD").rglob("depth_bfx"))
names = ["_".join(s.relative_to(dir / "source" / "SUNRGBD").parts) for s in scenes]
val = set(random.Random(0).sample(names, k=1090))
for scene, name in TQDM(zip(scenes, names), total=len(scenes), desc="Converting"):
split = "val" if name in val else "train"
d = cv2.imread(str(next((scene / "depth_bfx").glob("*.png"))), cv2.IMREAD_ANYDEPTH)
d = (((d >> 3) | (d << 13)) / 1000.0).clip(max=10).astype(np.float32) # bit-rotated mm -> m
save_depth_png(dir / "depth" / split / f"{name}.png", d)
next((scene / "image").glob("*.jpg")).replace(dir / "images" / split / f"{name}.jpg")
shutil.rmtree(dir / "source")用法#
要使用 SUN RGB-D 数据集训练图像尺寸为 640 的 YOLO26n-depth 模型,可以使用以下代码片段。有关可用参数的完整列表,请参阅模型的训练页面。
from ultralytics import YOLO
# 加载模型
model = YOLO("yolo26n-depth.pt") # 加载预训练深度模型(推荐用于训练)
# 训练模型
results = model.train(data="depth-sunrgbd.yaml", epochs=100, imgsz=640)预训练模型#
YOLO26 深度模型系列使用广泛的多数据集深度预训练混合进行训练,SUN RGB-D 也是其中的一部分。这些模型会在首次使用时从 Ultralytics v8.4.0 资源发布版自动下载,例如 YOLO26x-depth,并提供多种尺寸,以满足不同的精度和资源需求。
引用与致谢#
如果你在研究或开发工作中使用 SUN RGB-D 数据集,请引用以下论文:
@inproceedings{song2015sunrgbd,
title={SUN RGB-D: A RGB-D Scene Understanding Benchmark Suite},
author={Song, Shuran and Lichtenberg, Samuel P. and Xiao, Jianxiong},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2015}
}我们感谢作者为计算机视觉社区创建并维护这一宝贵资源。
常见问题#
SUN RGB-D 是一个真实世界室内场景理解基准,使用四种 RGB-D 传感器采集:Intel RealSense、Asus Xtion,以及 Microsoft Kinect v1 和 v2。Ultralytics 配置提供 9,245 组训练图像-深度图像对和 1,090 组验证图像-深度图像对,深度范围最高约为 10 m。
每张 RGB 图像都配有一张以毫米为单位的 uint16 PNG,因此适用默认的
depth_scale: 1000,并遵循 Ultralytics 深度数据集格式。精简的 Depth8 测试数据集取样自 SUN RGB-D,并采用相同格式。运行
yolo depth train data=depth-sunrgbd.yaml model=yolo26n-depth.pt epochs=100 imgsz=640,或使用 Usage 部分中的 Python 示例。你也可以在 Ultralytics Platform 上浏览并克隆数据集。



