Hello,
I am currently working on a project involving the simulation of a scene in which multiple assets are dropped into a bin. After that I individually make all objects invisible, with the exception of one, and then retrieve the instance segmentation data. However, I have observed that the replicator requires progressively more time after each iteration to render the objects invisible (see graph below).
I came across a discussion that addresses a similar issue:
Although the problem appeared to have been resolved in that discussion, I am encountering similar challenges.
In this graph you can see the time it takes to complete a certain function call. And the functions which use rep.modify for changing pose or visibility take increasing time to fulfill their task. Functions without it have constant processing times. In the function “Check Occlusion”, the function “change_visibility_assets()” is called several times and is responsible for the increasing processing times.
I use the following code for modifying the visibility of the assets:
def change_visibility_assets(self, mode, id=None):
"""
mode = 0 : make invisible
mode = 1 : make visible
"""
assert mode == 0 or mode == 1
if id is None:
for i in range(len(self.all_assets)):
_asset_path = str(self.all_assets[i].GetPath()) # self.all_assets contains all prims from the stage
_imageable = rep.get.prim_at_path(_asset_path)
with _imageable:
if mode == 0:
rep.modify.visibility([False]) # make object invisible
else:
rep.modify.visibility([True]) # make object visible
rep.orchestrator.step()
# bin
bin_path = "/World/KLT_Festo_low/BOX_VOL4"
if not self.turn_off_bin:
self.change_visibility_bin(mode)
else:
self.change_visibility_bin(mode=0)
else:
# Only specified object id
_asset_path = str(self.all_assets[id].GetPath())
_imageable = rep.get.prim_at_path(_asset_path)
with _imageable:
if mode == 0:
rep.modify.visibility([False])
rep.orchestrator.step()
else:
rep.modify.visibility([True])
rep.orchestrator.step()
rep.orchestrator.step()
simulation_app.update()
return True
And for changing the camera pose which is represented in the graph as “Modify Pose”, I use:
with self.camera_rep:
rep.modify.pose(
position=pose[0], rotation=pose[1], rotation_order="YXZ"
)
rep.orchestrator.step()
I need to render hundreds to thousands of scenes, but this is not possible with such high and increasing processing times. Do you have any suggestions for resolving this issue?
Thank you in advance.