技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
datasets【数据与研究】Loads TUM, ICL-NUIM, and ScanNet RGB-D sequences into deterministic batched tensors, with preprocessing, pose association, semantic labels, and RGBDImages handoff guidance.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task needs one of the repository's dataset adapters,
its file/sequence conventions, RGB-D preprocessing, trajectory association,
semantic labels, or a DataLoader batch ready for RGBDImages. The adapters
consume data already present on disk. They do not download, extract, or repair
datasets.
Keep the detailed contracts in the bundled references:
DataLoader handoff.TUM expects timestamp lists and optional quaternion ground truth, ICL
expects TUM-compatible associations plus a block-matrix trajectory, and
Scannet expects sequence-association metadata that points into scene
extraction directories.seqlen, dilation, stride, start, end, output resolution,
image layout, color normalization, and return flags deliberately. Record
B, L, H, W, whether labels are requested, and whether poses are
available before handing the batch to a structure.Import directly from the dataset modules:
from gradslam.datasets.tum import TUM
from gradslam.datasets.icl import ICL
from gradslam.datasets.scannet import Scannet
The default return configuration asks for every output that the adapter can
provide. That means TUM returns color, depth, intrinsics, normalized poses,
relative transforms, names, and timestamps; ICL returns the same except for
TUM timestamps; ScanNet returns those RGB-D/pose fields plus names and labels.
Return flags remove fields from the tuple rather than inserting None values,
so unpack only the fields enabled by the configuration. See the API reference
for exact order.
Use a tuple for an explicit selection of sequences, trajectories, or scenes.
A string is interpreted as a split-file path only when it exists; it is not a
single sequence name. None means all discoverable items for TUM and ICL; for
ScanNet it means all sequence metadata files. Lists are rejected by the
adapter constructors.
For a first inspection, prefer a small seqlen and reduced height/width,
keep shuffle=False, and request only fields needed by the next operation.
DataLoader is ordinary PyTorch collation: with batch_size=B, each image
field gains a leading batch dimension and names/timestamps are collated as a
sequence of strings (commonly a list).
[0, 255] scale; normalize_color=True converts it to
approximately [0, 1].5000.0 for TUM and ICL,
1000.0 for ScanNet. The resulting depth is in the adapter's meter-like
convention.channels_first=False yields (L,H,W,3) color and (L,H,W,1) depth;
channels_first=True yields (L,3,H,W) and (L,1,H,W). A collated batch
therefore has (B,L,...). Intrinsics and poses remain (B,1,4,4) and
(B,L,4,4).height/480 and width/640.
Scale fx and cx by the width ratio, and fy and cy by the height
ratio. Do not rescale a matrix twice.return_pose or
return_transform requires them. Each sequence is normalized to the first
pose; its first normalized pose and first relative transform are identity.RGBDImagesFor an ordinary channels-last batch with all required fields:
from torch.utils.data import DataLoader
from gradslam.structures.rgbdimages import RGBDImages
loader = DataLoader(dataset, batch_size=2, shuffle=False)
colors, depths, intrinsics, poses, transforms, names = next(iter(loader))[:6]
rgbd = RGBDImages(colors, depths, intrinsics, poses, channels_first=False)
The exact slice above is appropriate for ICL; TUM has a seventh timestamp
field and ScanNet has a seventh label field. The transforms, names,
timestamps, and labels are not constructor arguments for RGBDImages; retain
them separately. If channels_first=True, pass that same flag to
RGBDImages. Do not silently omit intrinsics or replace absent poses with an
identity tensor: a caller that needs geometry must request/provide them.
For ScanNet labels, keep the label tensor separate from RGB-D geometry. Labels
are resized with nearest-neighbor interpolation and returned with a singleton
last channel by the implementation, so a collated batch is typically
(B,L,H,W,1) even when channels_first=True; older prose may describe it as
(L,H,W). Use seg_classes="nyu40" to retain the source indexing, or
seg_classes="scannet20" to remap the supported source ids to the contiguous
20-class palette. Use get_color_encoding and
datautils.create_label_image only when a visualization or colorized label
image is explicitly needed, and verify the palette representation against the
installed release.
This skill does not promise that any external dataset is present, that a split
file names valid items, or that all referenced image/pose files are readable.
The checker reports path existence only; adapter construction and one small
__getitem__ are the next data-dependent verification step. Do not run
network downloads, full native dataset tests, GPU flows, GUI visualization, or
notebook execution while drafting or when only a layout check was requested.
The deterministic CPU utility coverage is the strongest data-independent signal. TUM, ICL, and ScanNet adapter tests/examples are not guaranteed without their external data and prepared extraction metadata. Keep that status explicit in reports and handoffs.