structures
This sub-skill guides construction, conversion, transformation, and safe inspection of gradslam RGB-D and batched point-cloud structures.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- structures
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- This sub-skill guides construction, conversion, transformation, and safe inspection of gradslam RGB-D and batched point-cloud structures.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md9.3 KB
- 参考文档references/data-formats.md4.8 KB
- 参考文档references/troubleshooting.md8.8 KB
- 参考文档references/workflows.md3.0 KB
- 脚本scripts/structures_smoke.py3.6 KB
03 SKILL.md 正文
Structures operating guide
Use this sub-skill when a task must build or manipulate RGBDImages, build a
Pointclouds object, convert RGB-D frames to points, preserve tensor layout,
or prepare a non-interactive Open3D/Plotly representation. Keep the complete
API details in the linked references:
- API reference for signatures, properties, and mutation semantics.
- Data formats for shape, layout, depth, camera, and ragged-batch contracts.
- Workflows for construction, conversion, and device-safe recipes.
- Troubleshooting for failures and adapter limits.
- Tiny smoke helper for a deterministic, external-data-free check.
Route the request
- Identify whether the input is a sequence of RGB-D frames or an existing
point cloud. Record
B,L,H,W, representation (channels_firstor channels-last), device, depth units, and whether poses are available. - Normalize image tensors before construction. The RGB-D constructors accept PyTorch tensors only; NumPy conversion belongs at an input boundary. RGB is not automatically divided by 255 and depth is not rescaled.
- Choose one representation deliberately. Use channels-last for ordinary image inspection, Plotly RGB-D animation, and point-cloud conversion. Use channels-first only when the consumer explicitly requires it.
- Keep all constructor tensors on one device. Do not rely on an implicit cross-device copy to repair mixed inputs. Verify the selected destination after construction.
- For visual output, prefer
as_figure=Falsefirst so an adapter can be checked without opening a browser or GUI. Call.show()or Open3D drawing only in an explicitly interactive environment. - If the request is an RGB-D-to-point-cloud conversion, select a one-frame
object (
rgbd[:, frame]) before calling the helper; it requiresL == 1. Choose filtered ragged output or dense padded output deliberately. - Follow workflows for the concrete recipe and troubleshooting for constructor, cache, representation, device, conversion, and adapter errors before expanding a fixture or invoking external data.
Build RGBDImages
The constructor is:
RGBDImages(rgb_image, depth_image, intrinsics, poses=None,
channels_first=False, device=None, *, pixel_pos=None)
Supply five-dimensional RGB and depth tensors, a (B, 1, 4, 4) intrinsics
batch, and optionally (B, L, 4, 4) poses. Channels-last means
rgb=(B,L,H,W,3) and depth=(B,L,H,W,1); channels-first means
rgb=(B,L,3,H,W) and depth=(B,L,1,H,W). The object reports
shape == (B,L,H,W), exposes cdim as 4 or 2, and preserves the chosen
layout. A missing pose is valid: poses is None, has_poses is false, and
global maps fall back to copies of local maps.
After construction, inspect rgb_image, depth_image, intrinsics, poses,
valid_depth_mask, and has_poses before deriving geometry. Accessing
vertex_map, normal_map, global_vertex_map, or global_normal_map computes
and caches the result. Zero or negative depth is masked to zero in vertex maps;
normal maps are likewise zero at missing-depth pixels. Derived maps are in the
same channel layout as the object.
Use to_channels_last(copy=False) or to_channels_first(copy=False) for an
out-of-place conversion. These return the same object when already in the
requested layout unless copy=True; the underscore forms mutate in place.
Index only batch and sequence dimensions. Integer indexing retains singleton
batch/sequence dimensions, which is useful for downstream conversion.
Build and manipulate Pointclouds
Construct from either a list of ragged (N_b,3) tensors or an equally padded
(B,N,3) tensor. Optional normals and colors match point shapes; optional
features use (N_b,C) or (B,N,C) and share C across the batch. Attributes
must use the same list-versus-tensor representation as points. Pointclouds()
is a supported empty object; an empty list of points is not.
Use points_list and points_padded according to the consumer. List-backed
inputs are padded lazily with zero rows, and nonpad_mask plus
num_points_per_pointcloud identify real rows. The reverse list properties
remove padded rows. has_normals, has_colors, and has_features are the
presence checks; absent attributes remain None, not synthesized zeros.
For safe transformations, prefer out-of-place +, -, *, /, rotate,
transform, or pinhole_projection. Use the underscore variants only when
mutation is intended. Offset and scale affect points only; rotation and rigid
transformation affect points and normals; colors and features are unchanged.
Rotations accept (3,3) or (B,3,3), transformations (4,4) or (B,4,4),
and the batch dimension must match. pinhole_projection accepts (4,4) or
(B,4,4) intrinsics and places projected points on the z=1 plane.
Convert RGB-D to point clouds
Call pointclouds_from_rgbdimages(rgbd, global_coordinates=True, filter_missing_depths=True) only for an RGBDImages object with L == 1.
The conversion selects global or local vertex/normal maps, converts to
channels-last, and returns points, normals, and RGB colors. Filtering removes
pixels whose depth is not positive; disabling it preserves a dense flattened
cloud including zero-filled missing-depth rows. If poses are absent, global
coordinates intentionally equal local coordinates.
Copy, gradients, and devices
clone() makes independent tensor storage. detach() makes a cloned object
whose internal tensors do not require gradients. to(device, copy=False),
.cpu(), and .cuda() transfer internal tensors; copy=True forces a new
object when supported. Use torch.device(...) when comparing devices and
ensure operands of transforms and append_points are on the same device.
Property setters preserve the existing batch/point counts and validate the relevant shape. Padded setters also require the established device and zero padding; list setters clone values onto the object's device. Setting a list or padded representation invalidates the alternate representation in the intended API. Avoid mutating a returned list tensor in place when the padded cache may already exist; re-check both representations after structural edits.
Adapters and verification
Pointclouds.open3d(index, include_colors=True, max_num_points=None, include_normals=False)returns an Open3D point cloud. Colors are clamped to[0,1]and values above one are interpreted as 255-scale colors.Pointclouds.plotly(index, include_colors=True, max_num_points=200000, as_figure=True, point_size=2)returns a Plotly figure orScatter3d.RGBDImages.plotly(index, include_depth=True, as_figure=True, ms_per_frame=50)creates RGB/depth animation frames. Convert to channels-last first and do not assume this is a GUI-free display operation.- Adapter subsampling uses random permutations when a maximum is set; seed Torch if reproducibility matters.
Run the bundled helper for a tiny CPU fixture, then add focused assertions for any requested layout, pose, raggedness, missing-attribute, or adapter case. Do not replace this check with dataset downloads, notebook execution, GUI visualization, or a CUDA requirement.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).