Project structure
rep/
|__->assets/
| |___>Shrub/*.usd (flat only USD files)
|
|__->output/
|__->sample.py
I’ve been trying to run headless replicator script that imports USD assets from local file system and random scatters them in scene
import omni.replicator.core as rep
import pathlib
with rep.new_layer():
asset_path = pathlib.Path(__file__).parent.absolute() / "assets"
GRASS = asset_path / 'Grass_Short_C.usd'
VEG = asset_path / 'Shrub'
TERRAIN = asset_path / 'Terrains'
log_file = open("/_output/logs.txt", "w", encoding="utf-8")
sphere_light = rep.create.light(
light_type="Sphere",
temperature=rep.distribution.normal(6500, 500),
intensity=rep.distribution.normal(35000, 5000),
position=rep.distribution.uniform((-300, -300, -300), (300, 300, 300)),
scale=rep.distribution.uniform(50, 100),
count=2
)
def load_and_place_shrubs(num_inst=50):
veg_files = rep.utils.get_usd_files(str(VEG))
plants = rep.randomizer.instantiate(veg_files, mode='point_instance', size=num_inst)
with plants:
rep.modify.pose(
position=rep.distribution.uniform((-500, 0, -500), (500, 0, 500)),
rotation=rep.distribution.uniform((-90,-180, 0), (-90, 180, 0)),
)
return plants.node
rep.randomizer.register(load_and_place_shrubs)
# Setup camera and attach it to render product
camera = rep.create.camera(
focus_distance=800,
f_stop=0.5
)
render_product = rep.create.render_product(camera, resolution=(1920, 1080))
# Initialize and attach writer
writer = rep.WriterRegistry.get("BasicWriter")
writer.initialize( output_dir="/root/_output/output", rgb=True, bounding_box_2d_tight=True)
writer.attach([render_product])
with rep.trigger.on_frame(num_frames=10):
# rep.randomizer.create_ground_plane()
rep.randomizer.load_and_place_shrubs(75)
# rep.randomizer.load_and_place_grass()
with camera:
rep.modify.pose(position=rep.distribution.uniform((-500, 200, 1000), (500, 500, 1500)), look_at=(0, 0, 0))
rep.orchestrator.run()
log_file.close()
Running Docker
docker run --gpus all --entrypoint /bin/bash -it -v $HOME/replicator/:/_output/ nvcr.io/nvidia/omniverse-replicator:1.4.7-r1
Inside docker
./startup.sh --allow-root --no-window --/omni/replicator/script=/_output/sample.py
But I get a bunch of errors and no synthetic data output
logs
log.txt (208.1 KB)
Can someone help me interpret the bug and logs?