Skip to content

Commit 5f7b3fa

Browse files
authored
Moves segmentation workaround to base Camera class (#2243)
# Description Moves segmentation workaround to base Camera class as the bug on instanceable assets was also affecting the non-tiled cameras. ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - Bug fix (non-breaking change which fixes an issue) ## Screenshots Please attach before and after screenshots of the change if applicable. <!-- Example: | Before | After | | ------ | ----- | | _gif/png before_ | _gif/png after_ | To upload images to a PR -- simply drag and drop an image while in edit mode and it should upload the image directly. You can then paste that source into the above before/after sections. --> ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task -->
1 parent 4156249 commit 5f7b3fa

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

docs/source/refs/release_notes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@ Breaking Changes
274274
.. attention::
275275

276276
We have identified a breaking feature for semantic segmentation and instance segmentation when using
277-
``TiledCamera`` with instanceable assets. Since the Isaac Sim 4.5 / Isaac Lab 2.0 release, semantic and instance
277+
``Camera`` and ``TiledCamera`` with instanceable assets. Since the Isaac Sim 4.5 / Isaac Lab 2.0 release, semantic and instance
278278
segmentation outputs only render the first tile correctly and produces blank outputs for the remaining tiles.
279279
We will be introducing a workaround for this fix to remove scene instancing if semantic segmentation or instance
280-
segmentation is required for ``TiledCamera`` until we receive a proper fix from Omniverse as part of the next Isaac Sim release.
280+
segmentation is required for ``Camera`` and ``TiledCamera`` until we receive a proper fix from Omniverse as part of the next Isaac Sim release.
281281

282282
Migration Guide
283283
---------------

source/isaaclab/docs/CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Changed
104104
Fixed
105105
^^^^^
106106

107-
* Fixed issue in :class:`~isaaclab.sensors.TiledCamera` where segmentation outputs only display the first tile
107+
* Fixed issue in :class:`~isaaclab.sensors.TiledCamera` and :class:`~isaaclab.sensors.Camera` where segmentation outputs only display the first tile
108108
when scene instancing is enabled. A workaround is added for now to disable instancing when segmentation
109109
outputs are requested.
110110

source/isaaclab/isaaclab/sensors/camera/camera.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
import omni.kit.commands
1818
import omni.usd
1919
from isaacsim.core.prims import XFormPrim
20-
from pxr import UsdGeom
20+
from isaacsim.core.version import get_version
21+
from pxr import Sdf, UsdGeom
2122

2223
import isaaclab.sim as sim_utils
2324
from isaaclab.utils import to_camel_case
@@ -141,6 +142,22 @@ def __init__(self, cfg: CameraCfg):
141142
# Create empty variables for storing output data
142143
self._data = CameraData()
143144

145+
# HACK: we need to disable instancing for semantic_segmentation and instance_segmentation_fast to work
146+
isaac_sim_version = get_version()
147+
# checks for Isaac Sim v4.5 as this issue exists there
148+
if int(isaac_sim_version[2]) == 4 and int(isaac_sim_version[3]) == 5:
149+
if "semantic_segmentation" in self.cfg.data_types or "instance_segmentation_fast" in self.cfg.data_types:
150+
omni.log.warn(
151+
"Isaac Sim 4.5 introduced a bug in Camera and TiledCamera when outputting instance and semantic"
152+
" segmentation outputs for instanceable assets. As a workaround, the instanceable flag on assets"
153+
" will be disabled in the current workflow and may lead to longer load times and increased memory"
154+
" usage."
155+
)
156+
stage = omni.usd.get_context().get_stage()
157+
with Sdf.ChangeBlock():
158+
for prim in stage.Traverse():
159+
prim.SetInstanceable(False)
160+
144161
def __del__(self):
145162
"""Unsubscribes from callbacks and detach from the replicator registry."""
146163
# unsubscribe callbacks

source/isaaclab/isaaclab/sensors/camera/tiled_camera.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import warp as wp
1818
from isaacsim.core.prims import XFormPrim
1919
from isaacsim.core.version import get_version
20-
from pxr import Sdf, UsdGeom
20+
from pxr import UsdGeom
2121

2222
from isaaclab.utils.warp.kernels import reshape_tiled_image
2323

@@ -93,21 +93,6 @@ def __init__(self, cfg: TiledCameraCfg):
9393
)
9494
super().__init__(cfg)
9595

96-
# HACK: we need to disable instancing for semantic_segmentation and instance_segmentation_fast to work
97-
isaac_sim_version = get_version()
98-
# checks for Isaac Sim v4.5 as this issue exists there
99-
if int(isaac_sim_version[2]) == 4 and int(isaac_sim_version[3]) == 5:
100-
if "semantic_segmentation" in self.cfg.data_types or "instance_segmentation_fast" in self.cfg.data_types:
101-
omni.log.warn(
102-
"Isaac Sim 4.5 introduced a bug in TiledCamera when outputting instance and semantic segmentation"
103-
" outputs for instanceable assets. As a workaround, the instanceable flag on assets will be"
104-
" disabled in the current workflow and may lead to longer load times and increased memory usage."
105-
)
106-
stage = omni.usd.get_context().get_stage()
107-
with Sdf.ChangeBlock():
108-
for prim in stage.Traverse():
109-
prim.SetInstanceable(False)
110-
11196
def __del__(self):
11297
"""Unsubscribes from callbacks and detach from the replicator registry."""
11398
# unsubscribe from callbacks

0 commit comments

Comments
 (0)