I have a USD scene with a pre-built camera. I need to access the information of the bounding_box_2d_loose
for primitives based on the perspective of the camera to obtain occlusion information for these primitives.
The code I’m using is supposed to retrieve the bbox_loose data of an object, but in the initial few runs, it returns empty data along with some error messages. However, after running it multiple times, it eventually executes successfully and retrieves the data I need. I would like to know how to troubleshoot the errors and ensure that I can consistently obtain the required data every time.
The code i used:
from pxr import Usd
import omni.usd
import omni.replicator.core as rep
import omni.syntheticdata as sd
stage = omni.usd.get_context().get_stage()
sd.SyntheticData.Get().set_instance_mapping_semantic_filter("class:*")
cam = stage.GetPrimAtPath("/World/Camera")
rp = rep.create.render_product(str(cam.GetPrimPath()), (1024, 1024))
# Acess the data through annotators
bbox_loose = rep.AnnotatorRegistry.get_annotator("bounding_box_2d_loose")
bbox_loose.attach(rp)
async def get_bbox_loose_data():
global bbox_loose
await rep.orchestrator.step_async()
data = bbox_loose.get_data()
print(data)
import asyncio
asyncio.ensure_future(get_bbox_loose_data())
The error messages:
2023-10-02 14:45:24 [99,052ms] [Info] [omni.replicator.core.scripts.annotators] Attaching bounding_box_2d_loose to render product(s) ['/Render/RenderProduct_Replicator']
2023-10-02 14:45:24 [99,107ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:bboxIds of type uint[]
2023-10-02 14:45:24 [99,107ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:bufferSize of type uint
2023-10-02 14:45:24 [99,107ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:data of type uchar[]
2023-10-02 14:45:24 [99,108ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:exec of type uint (execution)
2023-10-02 14:45:24 [99,108ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:height of type uint
2023-10-02 14:45:24 [99,108ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:ids of type uint[]
2023-10-02 14:45:24 [99,108ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:labels of type token[]
2023-10-02 14:45:24 [99,108ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:primPaths of type token[]
2023-10-02 14:45:24 [99,108ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:swhFrameNumber of type uint64
2023-10-02 14:45:24 [99,108ms] [Error] [omni.graph.core.plugin] Failed to get USD Attribute for /Render/PostProcess/SDGPipeline/RenderProduct_Replicator_bounding_box_2d_loose.inputs:width of type uint
2023-10-02 14:45:24 [99,121ms] [Info] [omni.replicator.core.scripts.orchestrator] Replicator Step
2023-10-02 14:45:24 [99,125ms] [Warning] [carb.flatcache.plugin] UsdRelationship /Render/RenderProduct_Replicator.orderedVars has multiple targets, which is not supported
2023-10-02 14:45:24 [99,133ms] [Warning] [omni.hydra] Disabling DLSS Frame Generation for at least one view due to incompatible render outputs and OmniGraph postprocessing being active
2023-10-02 14:45:24 [99,137ms] [Info] [rtx.multigpumanager.plugin] View 0 (/Render/RenderProduct_omni_kit_widget_viewport_ViewportTexture_0) assigned to device 0
2023-10-02 14:45:24 [99,137ms] [Info] [rtx.multigpumanager.plugin] View 0 (/Render/RenderProduct_omni_kit_widget_viewport_ViewportTexture_0) switching to 1x1 layout
2023-10-02 14:45:24 [99,137ms] [Info] [rtx.multigpumanager.plugin] View 1 (/Render/RenderProduct_Replicator) assigned to device 0
2023-10-02 14:45:24 [99,137ms] [Info] [rtx.multigpumanager.plugin] View 1 (/Render/RenderProduct_Replicator) switching to 1x1 layout
2023-10-02 14:45:25 [100,124ms] [Info] [omni.kit.menu.utils.scripts.utils] omni.kit.menu.utils.rebuild_menus
2023-10-02 14:45:25 [100,160ms] [Info] [omni.kit.menu.utils.scripts.utils] omni.kit.menu.utils.rebuild_menus
2023-10-02 14:45:25 [100,217ms] [Info] [omni.kit.menu.utils.scripts.utils] omni.kit.menu.utils.rebuild_menus
2023-10-02 14:45:26 [100,275ms] [Info] [omni.kit.app._impl] [py stdout]: {'data': array([],
dtype=[('semanticId', '<u4'), ('x_min', '<i4'), ('y_min', '<i4'), ('x_max', '<i4'), ('y_max', '<i4'), ('occlusionRatio', '<f4')]), 'info': {'bboxIds': array([], dtype=uint32), 'idToLabels': {}, 'primPaths': []}}
2023-10-02 14:45:28 [102,640ms] [Info] [omni.meshraycast.plugin] Start refresh data for BVH
2023-10-02 14:45:28 [102,640ms] [Info] [omni.meshraycast.plugin] End refresh data for BVH early. Only refit is needed
2023-10-02 14:45:28 [102,640ms] [Info] [omni.meshraycast.plugin] End refresh data for BVH
get_bbox_loose_data_USD.zip (4.0 KB)