Offline data generation error

Hi, I am using the “offline_generation.py” file to generate synthetic data. The code works for the default environment “full_warehouse.usd”. However, when I change the stage to “simple_room.usd”:

STAGE = “/Isaac/Environments/Simple_Room/simple_room.usd”

And corresponding changes in camera pose and target:

I get the following error in the run_orchestrator part:

And data is not generated. Do you know what is the problem and how it can be solved?

Hi there,

I have tried out the script and it seems to work, here are some tips for testing:

  • /Isaac/Environments/Simple_Room/simple_room.usd is not annotated by default, so if you want instance segmentation etc. make sure you annotate the scene.

  • the look_at should be /Replicator/Ref_Xform/Ref/table_low_327

  • the best way to debug such scenes, especially for getting the paths is by using the Script Editor

    • this snippet would set up the stage for you, you can then check the prim path for the look_atattribute:
import carb
import os
import omni.replicator.core as rep
from omni.isaac.core.utils.nucleus import get_assets_root_path

# Find the Isaac asset server
def prefix_with_isaac_asset_server(relative_path):
    assets_root_path = get_assets_root_path()
    if assets_root_path is None:
        carb.log_error("Could not find Isaac Sim assets folder")
        return
    return assets_root_path + relative_path

STAGE = "/Isaac/Environments/Simple_Room/simple_room.usd"

with rep.new_layer():
    print("Loading Stage")
    env = rep.create.from_usd(prefix_with_isaac_asset_server(STAGE))
  • whereas this would also run the writer:
import carb
import os
from omni.isaac.core.utils.nucleus import get_assets_root_path

# Find the Isaac asset server
def prefix_with_isaac_asset_server(relative_path):
    assets_root_path = get_assets_root_path()
    if assets_root_path is None:
        carb.log_error("Could not find Isaac Sim assets folder")
        return
    return assets_root_path + relative_path

import omni.replicator.core as rep

STAGE = "/Isaac/Environments/Simple_Room/simple_room.usd"

with rep.new_layer():
    print("Loading Stage")
    env = rep.create.from_usd(prefix_with_isaac_asset_server(STAGE))

    camera = rep.create.camera(position=(-2.5, 1.2, 2.5), clipping_range=(0.01, 10000.0))
    render_product = rep.create.render_product(camera, (512, 512))

    with rep.trigger.on_frame(num_frames=10):
        with camera:
            rep.modify.pose(
                position=rep.distribution.uniform((-1, -1.0, 0.2), (1, 1, 0.5)),
                look_at="/Replicator/Ref_Xform/Ref/table_low_327",
            )

    # Initialize and attach writer
    writer = rep.WriterRegistry.get("BasicWriter")
    output_directory = os.getcwd() + "/_output_headless"
    print("Outputting data to ", output_directory)
    writer.initialize(
        output_dir=output_directory,
        rgb=True,
        instance_segmentation=True,
    )

    writer.attach([render_product])

    rep.orchestrator.run()

If you are then happy with the setup, you can migrate your changes to the application script.

Cheers,
Andrei

1 Like

Hi Andrei,

Thanks a lot for your tips and snippet. That basically solved my problem. The main issue was that the scene was not annotated.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.