ovrtx: expose semantic segmentation idToLabels#6385
Conversation
Greptile SummaryThis PR brings the OVRTX renderer's
Confidence Score: 4/5Safe to merge for the feature goal; the three issues flagged are hardening and performance concerns rather than conditions that break existing callers. The new ovrtx_annotator_utils.py has a label-bounds check that uses the full buffer size instead of excluding the 4-byte trailing count, and a dict merge order that lets decoded entries overwrite the well-known BACKGROUND/UNLABELLED reserved labels if the OVRTX runtime ever includes IDs 0/1 in the SemanticIdMap. Neither condition is triggered by the current runtime, but both are straightforward to fix. The per-frame GPU kernel + sync for color-key computation is unnecessary overhead since semantic IDs are stable across frames. The kernel fix, the new colorize flag, and the idToLabels wiring are all correct. source/isaaclab_ov/isaaclab_ov/renderers/ovrtx_annotator_utils.py — the bounds check and merge order both warrant a second look before shipping. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant R as OVRTXRenderer.render()
participant IDMap as frame.render_vars[SemanticIdMap]
participant Utils as ovrtx_annotator_utils
participant RD as OVRTXRenderData.renderer_info
participant RO as OVRTXRenderer.read_output()
participant CD as camera_data.info
R->>IDMap: "map(device=CPU)"
IDMap-->>Utils: np.ndarray (raw bytes)
Utils->>Utils: decode_semantic_id_map()
Utils->>Utils: build_semantic_id_to_labels()
Note over Utils: colorize=True → semantic_color_keys()<br/>(Warp kernel + host-device sync)
Utils-->>RD: "renderer_info[semantic_segmentation] = idToLabels"
R->>RO: read_output(render_data, camera_data)
RO->>CD: "camera_data.info[semantic_segmentation] = renderer_info value"
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant R as OVRTXRenderer.render()
participant IDMap as frame.render_vars[SemanticIdMap]
participant Utils as ovrtx_annotator_utils
participant RD as OVRTXRenderData.renderer_info
participant RO as OVRTXRenderer.read_output()
participant CD as camera_data.info
R->>IDMap: "map(device=CPU)"
IDMap-->>Utils: np.ndarray (raw bytes)
Utils->>Utils: decode_semantic_id_map()
Utils->>Utils: build_semantic_id_to_labels()
Note over Utils: colorize=True → semantic_color_keys()<br/>(Warp kernel + host-device sync)
Utils-->>RD: "renderer_info[semantic_segmentation] = idToLabels"
R->>RO: read_output(render_data, camera_data)
RO->>CD: "camera_data.info[semantic_segmentation] = renderer_info value"
Reviews (1): Last reviewed commit: "ovrtx: expose semantic segmentation idTo..." | Re-trigger Greptile |
Decode the OVRTX SemanticIdMap render var into
camera.data.info["semantic_segmentation"]["idToLabels"], matching the
Isaac RTX / Replicator contract (BACKGROUND/UNLABELLED always present,
values as {type: label} dicts). Move the parsing/decoding into
ovrtx_annotator_utils.py.
Add colorize_semantic_segmentation to OVRTXRendererCfg for parity with
Isaac RTX, selecting colorized RGBA (uint8) or raw int32 IDs, and
populate read_output accordingly.
Fix the colorization hash to use 32-bit wraparound arithmetic; widening
to uint64 changed the hashed bits, so colorized IDs did not match the
colors produced by omni.replicator / the Isaac RTX renderer.
Re-generated relevant golden images.
Extend the kitless rendering-correctness tests to validate idToLabels
against Isaac RTX ground truth for the cartpole and shadow_hand scenes.
9581ce2 to
35766b5
Compare
Description
This PR brings our ovrtx renderer integration's
semantic_segmentationannotator to full parity with Isaac RTX's. This involves building the idToLabels dict mapping the semantic ID or color to the corresponding labels - which IsaacRTX supplies through Replicator.A new
ovrtx_annotator_utils.pyis introduced encapsulating the logic of decoding ovrtx SemanticIdMap raw array of C++ structs. In the future we can remove this implementation in favor of logic exposed natively in ovrtx or through ovannotators.While adding the tests to validate the consistency of idToLabels output - I also noticed that the IsaacRTX's pseudo-random colors generated from the semantic IDs was slightly different than ovrtx's. So that's been fixed and golden images regenerated.
Type of change
Screenshots
See golden images update
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there