PYTHON API

Core Functions

omni.replicator.core.new_layer(name: str = None)

Create a new authoring layer context. Use new_layer to keep replicator changes into a contained layer. If a layer of the same name already exists, the layer will be cleared before new changes are applied.

Parameters

name – Name of the layer to be created. If ommitted, the name “Replicator” is used.

Example

>>> import omni.replicator.core as rep
>>> with rep.new_layer():
>>>     rep.create.cone(count=100, position=rep.distribution.uniform((-100,-100,-100),(100,100,100)))
omni.replicator.core.set_global_seed(seed: int)

Set a global seed.

Parameters

seed – Seed to use as initialization for the pseudo-random number generator. Seed is expected to be a non-negative integer.

omni.replicator.core.get_global_seed()

Return global seed value

Returns

(int)seed value

Create

omni.replicator.core.create.group(items: List[Union[ReplicatorItem, str, Path]], semantics: List[Tuple[str, str]] = None) ReplicatorItem

Group assets into a common node. Grouping assets makes it easier and faster to apply randomizations to multiple assets simultaneously.

Parameters
  • items – Assets to be grouped together.

  • semantics – List of semantic type-label pairs.

Example

>>> import omni.replicator.core as rep
>>> cones = [rep.create.cone() for _ in range(100)]
>>> group = rep.create.group(cones, semantics=[("class", "cone")])
omni.replicator.core.create.light(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, light_type: str = 'Distant', color: Union[ReplicatorItem, Tuple[float, float, float]] = (1.0, 1.0, 1.0), intensity: Union[ReplicatorItem, float] = 1000.0, exposure: Union[ReplicatorItem, float] = None, temperature: Union[ReplicatorItem, float] = 6500, texture: Union[ReplicatorItem, str] = None, count: int = 1, name: str = None) ReplicatorItem

Create a light

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value. Ignored for dome and distant light types.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value. Ignored for dome and distant light types.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • light_type – Light type. Select from [“cylinder”, “disk”, “distant”, “dome”, “rect”, “sphere”]

  • color – Light color in RGB colorspace.

  • intensity – Light intensity. Scales the power of the light linearly.

  • exposure – Scales the power of the light exponentially as a power of 2. The result is multiplied with intensity.

  • temperature – Color temperature in degrees Kelvin indicating the white point. Lower values are warmer, higher values are cooler. Valid range [1000, 10000].

  • texture – Image texture to use for dome light such as an HDR (High Dynamic Range) intended for IBL (Image Based Lighting). Ignored for other light types.

  • count – Number of objects to create.

  • name – Name of the light.

Examples

>>> import omni.replicator.core as rep
>>> distance_light = rep.create.light(
... rotation=rep.distribution.uniform((0,-180,-180), (0,180,180)),
... intensity=rep.distribution.normal(10000, 1000),
... temperature=rep.distribution.normal(6500, 1000),
... light_type="distant")
>>> dome_light = rep.create.light(
... rotation=rep.distribution.uniform((0,-180,-180), (0,180,180)),
... texture=rep.distribution.choice(rep.example.TEXTURES),
... light_type="dome")
omni.replicator.core.create.material_omnipbr(diffuse: Tuple[float] = None, diffuse_texture: str = None, roughness: float = None, roughness_texture: str = None, metallic: float = None, metallic_texture: str = None, specular: float = None, emissive_color: Tuple[float] = None, emissive_texture: str = None, emissive_intensity: float = 0.0, project_uvw: bool = False, semantics: List[Tuple[str, str]] = None, count: int = 1) ReplicatorItem

Create an OmniPBR Material

Parameters
  • diffuse – Diffuse/albedo color in RGB colorspace

  • diffuse_texture – Path to diffuse texture

  • roughness – Material roughness in the range [0, 1]

  • roughness_texture – Path to roughness texture

  • metallic – Material metallic value in the range [0, 1]. Typically, metallic is assigned either 0.0 or 1.0

  • metallic_texture – Path to metallic texture

  • specular – Intensity of specular reflections in the range [0, 1]

  • emissive_color – Color of emissive light emanating from material in RGB colorspace

  • emissive_texture – Path to emissive texture

  • emissive_intensity – Emissive intensity of the material. Setting to 0.0 (default) disables emission.

  • project_uvw – When True, UV coordinates will be generated by projecting them from a coordinate system.

  • semantics – Assign semantics to material

  • count – Number of objects to create.

Example

>>> import omni.replicator.core as rep
>>> mat1 = rep.create.material_omnipbr(
...    diffuse=rep.distribution.uniform((0, 0, 0), (1, 1, 1)),
...    roughness=rep.distribution.uniform(0, 1),
...    metallic=rep.distribution.choice([0, 1]),
...    emissive_color=rep.distribution.uniform((0, 0, 0.5), (0, 0, 1)),
...    emissive_intensity=rep.distribution.uniform(0, 1000),
... )
>>> mat2 = rep.create.material_omnipbr(
...    diffuse_texture=rep.distribution.choice(rep.example.TEXTURES),
...    roughness_texture=rep.distribution.choice(rep.example.TEXTURES),
...    metallic_texture=rep.distribution.choice(rep.example.TEXTURES),
...    emissive_texture=rep.distribution.choice(rep.example.TEXTURES),
...    emissive_intensity=rep.distribution.uniform(0, 1000),
... )
>>> cone = rep.create.cone(material=mat1)
>>> torus = rep.create.torus(material=mat2)
omni.replicator.core.create.render_product(camera: Union[ReplicatorItem, str, List[str], Path, List[Path]], resolution: Tuple[int, int], force_new: bool = False) ReplicatorItem

Create a render product A RenderProduct describes images or other file-like artifacts produced by a render, such as rgb (LdrColor), normals, depth, etc. Render products attached to the default “Perspective” camera are considered as available to be re-used if their resolution matches the target resolution. If no available render products are found or if force_new is set to True, a new render product is created.

Note: Viewports are not generated to draw the render product on screen.

Parameters
  • camera – The camera to attach to the render product.

  • resolution – (width, height) resolution of the render product

  • force_new – If True, force creation of a new render product. If False, existing render products will be re-used if currently assigned to the default (/OmniveriseKit_Persp) camera.

Example

>>> import omni.replicator.core as rep
>>> render_product = rep.create.render_product(rep.create.camera(), resolution=(1024, 1024))
omni.replicator.core.create.register(fn: Callable[[...], Union[ReplicatorItem, Node]], override: bool = True) None

Register a new function under omni.replicator.core.create. Extend the default capabilities of omni.replicator.core.create by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

Example

>>> import omni.replicator.core as rep
>>> def light_cluster(num_lights: int = 10):
...     lights = rep.create.light(
...         light_type="sphere",
...         count=num_lights,
...         position=rep.distribution.uniform((-500, -500, -500), (500, 500, 500)),
...         intensity=rep.distribution.uniform(10000, 20000),
...         temperature=rep.distribution.uniform(1000, 10000),
...     )
...     return lights
>>> rep.create.register(light_cluster)
>>> lights = rep.create.light_cluster(50)

Cameras

omni.replicator.core.create.camera(position: Union[ReplicatorItem, float, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, focal_length: Union[ReplicatorItem, float] = 24.0, focus_distance: Union[ReplicatorItem, float] = 400.0, f_stop: Union[ReplicatorItem, float] = 0.0, horizontal_aperture: Union[ReplicatorItem, float] = 20.955, horizontal_aperture_offset: Union[ReplicatorItem, float] = 0.0, vertical_aperture_offset: Union[ReplicatorItem, float] = 0.0, clipping_range: Union[ReplicatorItem, Tuple[float, float]] = (1.0, 1000000.0), projection_type: Union[ReplicatorItem, str] = 'pinhole', fisheye_nominal_width: Union[ReplicatorItem, float] = 1936.0, fisheye_nominal_height: Union[ReplicatorItem, float] = 1216.0, fisheye_optical_centre_x: Union[ReplicatorItem, float] = 970.94244, fisheye_optical_centre_y: Union[ReplicatorItem, float] = 600.37482, fisheye_max_fov: Union[ReplicatorItem, float] = 200.0, fisheye_polynomial_a: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_b: Union[ReplicatorItem, float] = 0.00245, fisheye_polynomial_c: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_d: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_e: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_f: Union[ReplicatorItem, float] = 0.0, fisheye_p0: Union[ReplicatorItem, float] = - 0.00037, fisheye_p1: Union[ReplicatorItem, float] = - 0.00074, fisheye_s0: Union[ReplicatorItem, float] = - 0.00058, fisheye_s1: Union[ReplicatorItem, float] = - 0.00022, fisheye_s2: Union[ReplicatorItem, float] = 0.00019, fisheye_s3: Union[ReplicatorItem, float] = - 0.0002, count: int = 1, parent: ReplicatorItem = None, name: str = None) ReplicatorItem

Create a camera

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • focal_length – Physical focal length of the camera in units equal to 0.1 * world units.

  • focus_distance – Distance from the camera to the focus plane in world units.

  • f_stop – Lens aperture. Default 0.0 turns off focusing.

  • horizontal_aperture – Horizontal aperture in units equal to 0.1 * world units. Default simulates a 35mm spherical projection aperture.

  • horizontal_aperture_offset – Horizontal aperture offset in units equal to 0.1 * world units.

  • vertical_aperture_offset – Vertical aperture offset in units equal to 0.1 * world units.

  • clipping_range – (Near, Far) clipping distances of the camera in world units.

  • projection_type – Camera projection model. Select from [pinhole, fisheye_polynomial, “fisheyeOrthographic”, “fisheyeEquidistant”, “fisheyeEquisolid”, “fisheyeSpherical”, “fisheyeKannalaBrandtK3”, “fisheyeRadTanThinPrism”].

  • fisheye_nominal_width – Nominal width of fisheye lens model.

  • fisheye_nominal_height – Nominal height of fisheye lens model.

  • fisheye_optical_centre_x – Horizontal optical centre position of fisheye lens model.

  • fisheye_optical_centre_y – Vertical optical centre position of fisheye lens model.

  • fisheye_max_fov – Maximum field of view of fisheye lens model.

  • fisheye_polynomial_a – First polynomial coefficient of fisheye camera.

  • fisheye_polynomial_b – Second polynomial coefficient of fisheye camera.

  • fisheye_polynomial_c – Third polynomial coefficient of fisheye camera.

  • fisheye_polynomial_d – Fourth polynomial coefficient of fisheye camera.

  • fisheye_polynomial_e – Fifth polynomial coefficient of fisheye camera.

  • fisheye_polynomial_f – Sixth polynomial coefficient of fisheye camera.

  • fisheye_p0 – Distortion coefficient to calculate tangential distortion for rad tan thin prism camera.

  • fisheye_p1 – Distortion coefficient to calculate tangential distortion for rad tan thin prism camera.

  • fisheye_s0 – Distortion coefficient to calculate thin prism distortion for rad tan thin prism camera.

  • fisheye_s1 – Distortion coefficient to calculate thin prism distortion for rad tan thin prism camera.

  • fisheye_s2 – Distortion coefficient to calculate thin prism distortion for rad tan thin prism camera.

  • fisheye_s3 – Distortion coefficient to calculate thin prism distortion for rad tan thin prism camera.,

  • count – Number of objects to create.

  • parent – Optional parent prim path. The camera will be created as a child of this prim.

  • name – Name of the camera

Example

>>> import omni.replicator.core as rep
>>> # Create camera
>>> camera = rep.create.camera(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     rotation=(45, 45, 0),
...     focus_distance=rep.distribution.normal(400.0, 100),
...     f_stop=1.8,
... )
>>> # Attach camera to render product
>>> render_product = rep.create.render_product(camera, resolution=(1024, 1024))
omni.replicator.core.create.stereo_camera(stereo_baseline: Union[ReplicatorItem, float], position: Optional[Union[ReplicatorItem, float, Tuple[float]]] = None, rotation: Optional[Union[ReplicatorItem, float, Tuple[float]]] = None, look_at: Optional[Union[ReplicatorItem, str, Path, Tuple[float, float, float]]] = None, look_at_up_axis: Optional[Union[ReplicatorItem, Tuple[float]]] = None, focal_length: Union[ReplicatorItem, float] = 24.0, focus_distance: Union[ReplicatorItem, float] = 400.0, f_stop: Union[ReplicatorItem, float] = 0.0, horizontal_aperture: Union[ReplicatorItem, float] = 20.955, horizontal_aperture_offset: Union[ReplicatorItem, float] = 0.0, vertical_aperture_offset: Union[ReplicatorItem, float] = 0.0, clipping_range: Union[ReplicatorItem, Tuple[float, float]] = (1.0, 1000000.0), projection_type: Union[ReplicatorItem, str] = 'pinhole', fisheye_nominal_width: Union[ReplicatorItem, float] = 1936.0, fisheye_nominal_height: Union[ReplicatorItem, float] = 1216.0, fisheye_optical_centre_x: Union[ReplicatorItem, float] = 970.94244, fisheye_optical_centre_y: Union[ReplicatorItem, float] = 600.37482, fisheye_max_fov: Union[ReplicatorItem, float] = 200.0, fisheye_polynomial_a: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_b: Union[ReplicatorItem, float] = 0.00245, fisheye_polynomial_c: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_d: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_e: Union[ReplicatorItem, float] = 0.0, fisheye_polynomial_f: Union[ReplicatorItem, float] = 0.0, fisheye_p0: Union[ReplicatorItem, float] = - 0.00037, fisheye_p1: Union[ReplicatorItem, float] = - 0.00074, fisheye_s0: Union[ReplicatorItem, float] = - 0.00058, fisheye_s1: Union[ReplicatorItem, float] = - 0.00022, fisheye_s2: Union[ReplicatorItem, float] = 0.00019, fisheye_s3: Union[ReplicatorItem, float] = - 0.0002, count: int = 1, name: Optional[str] = None) ReplicatorItem

Create a stereo camera pair.

Args:

stereo_baseline: Distance between stereo camera pairs. position: XYZ coordinates in world space. If a single value is provided, all axes will be set to that value. rotation: Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value. look_at: Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions. look_at_up_axis: Look-at up axis of the created prim. focal_length: Physical focal length of the camera in units equal to 0.1 * world units. focus_distance: Distance from the camera to the focus plane in world units. f_stop: Lens aperture. Default 0.0 turns off focusing. horizontal_aperture: Horizontal aperture in units equal to 0.1 * world units. Default simulates a 35mm spherical projection aperture. horizontal_aperture_offset: Horizontal aperture offset in units equal to 0.1 * world units. vertical_aperture_offset: Vertical aperture offset in units equal to 0.1 * world units. clipping_range: (Near, Far) clipping distances of the camera in world units. projection_type: Camera projection model. Select from [pinhole, fisheye_polynomial]. fisheye_nominal_width: Nominal width of fisheye lens model. fisheye_nominal_height: Nominal height of fisheye lens model. fisheye_optical_centre_x: Horizontal optical centre position of fisheye lens model. fisheye_optical_centre_y: Vertical optical centre position of fisheye lens model. fisheye_max_fov: Maximum field of view of fisheye lens model. fisheye_polynomial_a: First component of fisheye polynomial (only valid for fisheye_polynomial projection type). fisheye_polynomial_b: Second component of fisheye polynomial (only valid for fisheye_polynomial projection type). fisheye_polynomial_c: Third component of fisheye polynomial (only valid for fisheye_polynomial projection type). fisheye_polynomial_d: Fourth component of fisheye polynomial (only valid for fisheye_polynomial projection type). fisheye_polynomial_e: Fifth component of fisheye polynomial (only valid for fisheye_polynomial projection type). count: Number of objects to create. name: Basename of the cameras. _L and _R will be appended for Left and Right, respectively.

Example

>>> import omni.replicator.core as rep
>>> # Create stereo camera
>>> stereo_camera_pair = rep.create.stereo_camera(
...     stereo_baseline=10,
...     position=(10, 10, 10),
...     rotation=(45, 45, 0),
...     focus_distance=rep.distribution.normal(400.0, 100),
...     f_stop=1.8,
... )
>>> # Attach camera to render product
>>> render_product = rep.create.render_product(stereo_camera_pair, resolution=(1024, 1024))

Shapes

omni.replicator.core.create.cone(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, as_mesh: bool = True, count: int = 1, name: str = None) ReplicatorItem

Create a cone

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the cone.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • as_mesh – If false, create a Usd.Cone prim. If true, create a mesh.

  • count – Number of objects to create.

  • name – Name of the object.

Example

>>> import omni.replicator.core as rep
>>> cone = rep.create.cone(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "cone")],
... )
omni.replicator.core.create.cube(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, as_mesh: bool = True, count: int = 1, name: str = None) ReplicatorItem

Create a cube

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the cube.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • as_mesh – If false, create a Usd.Cube prim. If true, create a mesh.

  • count – Number of objects to create.

  • name – Name of the object

Example

>>> import omni.replicator.core as rep
>>> cube = rep.create.cube(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "cube")],
... )
omni.replicator.core.create.cylinder(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, as_mesh: bool = True, count: int = 1, name: str = None) ReplicatorItem

Create a cylinder

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the cylinder.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • as_mesh – If false, create a Usd.Cylinder prim. If true, create a mesh.

  • count – Number of objects to create.

  • name – Name of the object

Example

>>> import omni.replicator.core as rep
>>> cylinder = rep.create.cylinder(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "cylinder")],
... )
omni.replicator.core.create.disk(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, count: int = 1, name: str = None) ReplicatorItem

Create a disk

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the disk.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • count – Number of objects to create.

  • name – Name of the object.

Example

>>> import omni.replicator.core as rep
>>> disk = rep.create.disk(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "disk")],
... )
omni.replicator.core.create.plane(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, count: int = 1, name: str = None) ReplicatorItem

Create a plane

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the plane.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • count – Number of objects to create.

  • name – Name of the object

Example

>>> import omni.replicator.core as rep
>>> plane = rep.create.plane(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "plane")],
... )
omni.replicator.core.create.sphere(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, as_mesh: bool = True, count: int = 1, name: str = None) ReplicatorItem

Create a sphere

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the sphere.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • as_mesh – If false, create a Usd.Sphere prim. If true, create a mesh.

  • count – Number of objects to create.

  • name – Name of the object.

Example

>>> import omni.replicator.core as rep
>>> sphere = rep.create.sphere(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "sphere")],
... )
omni.replicator.core.create.torus(position: Union[ReplicatorItem, float, Tuple[float]] = None, scale: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, look_at: Union[ReplicatorItem, str, Path, Tuple[float, float, float]] = None, look_at_up_axis: Union[ReplicatorItem, Tuple[float]] = None, semantics: List[Tuple[str, str]] = None, material: Union[ReplicatorItem, Prim] = None, visible: bool = True, count: int = 1, name: str = None) ReplicatorItem

Create a torus

Parameters
  • position – XYZ coordinates in world space. If a single value is provided, all axes will be set to that value.

  • scale – Scaling factors for XYZ axes. If a single value is provided, all axes will be set to that value.

  • pivot – Pivot that sets the center point of translate and rotate operation. Pivot values are normalized between [-1, 1] for each axis based on the prim’s axis aligned extents.

  • rotation – Euler angles in degrees in XYZ order. If a single value is provided, all axes will be set to that value.

  • look_at – Look-at target, specified either as a ReplicatorItem, a prim path or as coordinates. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – Look-at up axis of the created prim.

  • semantics – List of semantic type-label pairs.

  • material – Material to attach to the torus.

  • visible – If false, the prim will be invisible. This is often useful when creating prims to use as bounds with other randomizers.

  • count – Number of objects to create.

  • name – Name of the object

Example

>>> import omni.replicator.core as rep
>>> torus = rep.create.torus(
...     position=rep.distribution.uniform((0,0,0), (100, 100, 100)),
...     scale=2,
...     rotation=(45, 45, 0),
...     semantics=[("class", "torus")],
... )

USD

omni.replicator.core.create.from_dir(dir_path: str, recursive: bool = False, path_filter: Optional[str] = None, semantics: Optional[List[Tuple[str, str]]] = None) ReplicatorItem

Create a group of assets from the USD files found in dir_path

Parameters
  • dir_path – The root path to search from.

  • recursive – If True, search through sub-folders.

  • path_filter – A Regular Expression (RegEx) string to filter paths with.

  • semantics – List of semantic type-label pairs.

Example

>>> import omni.replicator.core as rep
>>> asset_path = rep.example.ASSETS_DIR
>>> asset = rep.create.from_dir(asset_path, path_filter="rocket")
omni.replicator.core.create.from_usd(usd: str, semantics: List[Tuple[str, str]] = None, count: int = 1) ReplicatorItem

Reference a USD into the current USD stage.

Parameters
  • usd – Path to a usd file (*.usd, *.usdc, *.usda)

  • semantics – List of semantic type-label pairs.

Example

>>> import omni.replicator.core as rep
>>> usd_path = rep.example.ASSETS[0]
>>> asset = rep.create.from_usd(usd_path, semantics=[("class", "example")])

Get

get methods are helpers to get objects from the USD stage, either by path or by semantic label.

get.prims is very broad with its regex matching on the USD stage, so individual helper methods are provided to narrow the search field to differnt USD types (mesh, light, etc.)

omni.replicator.core.get.prims(path_pattern: str = None, path_match: str = None, path_pattern_exclusion: str = None, prim_types: Union[str, List[str]] = None, prim_types_exclusion: Union[str, List[str]] = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True, ignore_case: bool = True) ReplicatorItem

Get prims based on specified constraints.

Search the stage for stage paths with matches to the specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_match – Python string matching. Faster than regex matching.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • prim_types – List of prim types to include

  • prim_types_exclusion – List of prim types to ignore

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

  • ignore_case – Case-insensitive regex matching

omni.replicator.core.get.prim_at_path(path: Union[str, List[str], ReplicatorItem]) ReplicatorItem

Get the prim at the exact path

Parameters

path – USD path to the desired prim. Defaults to None.

omni.replicator.core.get.camera(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd ‘camera’ types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.curve(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd ‘curve’ types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.geomsubset(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd ‘geomsubset’ types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.graph(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get all ‘graph’ types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.light(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem
Get Usd ‘light’ types based on specified constraints.

Matches types RectLight, SphereLight, CylinderLight, DiskLight, DistantLight, SphereLight

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.listener(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd listener types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.material(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd material types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.mesh(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd mesh types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.physics(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get physics/physicsscene types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.renderproduct(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd renderproduct types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.rendervar(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd rendervar types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.scope(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd ‘scope’ types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.shader(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd ‘shader’ types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.shape(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem
Get Usd ‘shape’ types based on specified constraints.

Includes Capsule, Cone, Cube, Cylinder, Plane, Sphere

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.sound(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd ‘sound’ types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.xform(path_pattern: str = None, path_pattern_exclusion: str = None, semantics: Union[List[Tuple[str, str]], Tuple[str, str]] = None, semantics_exclusion: Union[List[Tuple[str, str]], Tuple[str, str]] = None, cache_result: bool = True) ReplicatorItem

Get Usd ‘xform’ types based on specified constraints.

Parameters
  • path_pattern – The RegEx (Regular Expression) path pattern to match.

  • path_pattern_exclusion – The RegEx (Regular Expression) path pattern to ignore.

  • semantics – Semantic type-value pairs of semantics to include

  • semantics_exclusion – Semantic type-value pairs of semantics to ignore

  • cache_result – Run get prims a single time, then return the cached result

omni.replicator.core.get.register(fn, override=True) None

Register a new function under omni.replicator.core.get. Extend the default capabilities of omni.replicator.core.get by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

Distribution

omni.replicator.core.distribution.choice(choices: List[str], weights: List[float] = None, num_samples: Union[ReplicatorItem, int] = 1, seed: Optional[int] = - 1, with_replacements: bool = True, name: Optional[str] = None) ReplicatorItem

Provides sampling from a list of values

Parameters
  • choices – Values in the distribution to choose from.

  • weights – Matching list of weights for each choice.

  • num_samples – The number of times to sample.

  • seed (optional) – A seed to use for the sampling.

  • with_replacements – If True, allow re-sampling the same element. If False, each element can only be sampled once. Note that in this case, the size of the elements being sampled must be larger than the sampling size. Default is True.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

omni.replicator.core.distribution.combine(distributions: List[Union[ReplicatorItem, Tuple[ReplicatorItem]]], name: Optional[str] = None) ReplicatorItem

Combine input from different distributions.

Parameters
  • distributions – List of Replicator distribution nodes or numbers.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

omni.replicator.core.distribution.log_uniform(lower: Tuple, upper: Tuple, num_samples: int = 1, seed: Optional[int] = None, name: Optional[str] = None) ReplicatorItem

Provides sampling with a log uniform distribution

Parameters
  • lower – Lower end of the distribution.

  • upper – Upper end of the distribution.

  • num_samples – The number of times to sample.

  • seed (optional) – A seed to use for the sampling.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

omni.replicator.core.distribution.normal(mean: Tuple, std: Tuple, num_samples: int = 1, seed: Optional[int] = None, name: Optional[str] = None) ReplicatorItem

Provides sampling with a normal distribution

Parameters
  • mean – Average value for the distribution.

  • std – Standard deviation value for the distribution.

  • num_samples – The number of times to sample.

  • seed (optional) – A seed to use for the sampling.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

omni.replicator.core.distribution.sequence(items: Union[List, ReplicatorItem], ordered: Optional[bool] = True, seed: Optional[int] = - 1, name: Optional[str] = None) ReplicatorItem

Provides sampling sequentially

Parameters
  • items – Ordered list of items to sample sequentially.

  • ordered – Whether to return item in order.

  • seed (optional) – A seed to use for the sampling.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

Example

>>> import omni.replicator.core as rep
>>> cube = rep.create.cube(count=1)
>>> with cube:
...     rep.modify.pose(position=rep.distribution.sequence([(0.0, 0.0, 200.0), (0.0, 200.0, 0.0), (200.0, 0.0, 0.0)]))
omni.replicator.core.distribution.sequence
omni.replicator.core.distribution.uniform(lower: Tuple, upper: Tuple, num_samples: int = 1, seed: Optional[int] = None, name: Optional[str] = None) ReplicatorItem

Provides sampling with a uniform distribution

Parameters
  • lower – Lower end of the distribution.

  • upper – Upper end of the distribution.

  • num_samples – The number of times to sample.

  • seed (optional) – A seed to use for the sampling.

  • name (optional) – A name for the given distribution. Named distributions will have their values available to the Writer.

omni.replicator.core.distribution.register(fn: Callable[[...], Union[ReplicatorItem, Node]], override: bool = True) None

Register a new function under omni.replicator.core.distribution. Extend the default capabilities of omni.replicator.core.distribution by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

Modify

omni.replicator.core.modify.attribute(name: str, value: Union[Any, ReplicatorItem], attribute_type: str = None, input_prims: Union[ReplicatorItem, List[str]] = None) ReplicatorItem

Modify the attribute of the prims specified in input_prims.

Parameters
  • name – The name of the attribute to modify.

  • value – The value to set the attribute to.

  • attribute_type – The data type of the attribute. This parameter is required if the attribute specified does not already exist and must be created.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> sphere = rep.create.sphere(as_mesh=False)
>>> with sphere:
...     rep.modify.attribute("radius", rep.distribution.uniform(1, 5))
omni.replicator.core.modify.attribute
omni.replicator.core.modify.pose(position: Union[ReplicatorItem, float, Tuple[float]] = None, position_x: Union[ReplicatorItem, float] = None, position_y: Union[ReplicatorItem, float] = None, position_z: Union[ReplicatorItem, float] = None, rotation: Union[ReplicatorItem, float, Tuple[float]] = None, rotation_x: Union[ReplicatorItem, float] = None, rotation_y: Union[ReplicatorItem, float] = None, rotation_z: Union[ReplicatorItem, float] = None, rotation_order: str = 'XYZ', scale: Union[ReplicatorItem, float, Tuple[float]] = None, size: Union[ReplicatorItem, float, Tuple[float]] = None, pivot: Union[ReplicatorItem, Tuple[float]] = None, look_at: Union[ReplicatorItem, List[Union[Path, str]]] = None, look_at_up_axis: Union[str, Tuple[float, float, float]] = None, input_prims: Union[ReplicatorItem, List[str]] = None) ReplicatorItem

Modify the position, rotation, scale, and/or look-at target of the prims specified in input_prims.

NOTE: position and any of (position_x, position_y and position_z) cannot both be specified.

NOTE: position and (position_x or position_y or position_z) cannot both be specified.

NOTE: rotation and look_at cannot both be specified.

NOTE: size and scale cannot both be specified.

NOTE: size is converted to scale based on the prim’s current axis-aligned bounding box size. If a scale is already applied, it might not be able to reflect the true size of the prim.

Parameters
  • position – XYZ coordinates in world space.

  • position_x – coordinates value along the x axis.

  • position_y – coordinates value along the y axis.

  • position_z – coordinates value along the z axis.

  • rotation – Rotation in degrees for the axes specified in rotation_order.

  • rotation_x – Rotation in degrees for the X axis.

  • rotation_y – Rotation in degrees for the Y axis.

  • rotation_z – Rotation in degrees for the Z axis.

  • rotation_order – Order of rotation. Select from [XYZ, XZY, YXZ, YZX, ZXY, ZYX]

  • scale – Scale factor for each of XYZ axes.

  • size – Desired size of the input prims. Each input prim is scaled to match the specified size extents in each of the XYZ axes.

  • pivot – Pivot that sets the center point of translate and rotate operation.

  • look_at – The look at target to orient towards. If multiple prims are set, the target point will be the mean of their positions.

  • look_at_up_axis – The up axis used in look_at function

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.modify.pose(position=rep.distribution.uniform((0, 0, 0), (100, 100, 100)),
...                     scale=rep.distribution.uniform(0.1, 10),
...                     look_at=(0, 0, 0))
omni.replicator.core.modify.pose
omni.replicator.core.modify.pose_camera_relative(camera: Union[ReplicatorItem, List[str]], render_product: ReplicatorItem, distance: float, horizontal_location: float = 0, vertical_location: float = 0, input_prims=None) ReplicatorItem

Modify the positions of the prim relative to a camera.

Parameters
  • camera – Camera that the prim is relative to.

  • horizontal_location – Horizontal location in the camera space, which is in the range (-1, 1).

  • vertical_location – Vertical location in the camera space, which is in the range (-1, 1).

  • distance – Distance from the prim to the camera.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> camera = rep.create.camera()
>>> render_product = rep.create.render_product(camera, (1024, 512))
>>> with rep.create.cube():
...     rep.modify.pose_camera_relative(camera, render_product, distance=500, horizontal_location=0, vertical_location=0)
omni.replicator.core.modify.pose_camera_relative
omni.replicator.core.modify.semantics(semantics: List[Tuple[str, str]] = None, input_prims: Union[ReplicatorItem, List[str]] = None) ReplicatorItem

Add semantics to the target prims

Parameters
  • semantics – Semantic type-value pairs of semantics to include. (Ex: (‘class’, ‘sphere’))

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.sphere():
...     rep.modify.semantics([("class", "sphere")])
omni.replicator.core.modify.semantics
omni.replicator.core.modify.visibility(value: Union[ReplicatorItem, List[bool]] = None, input_prims: Union[ReplicatorItem, List[str]] = None) ReplicatorItem
omni.replicator.core.modify.register(fn, override=True) None

Register a new function under omni.replicator.core.modify. Extend the default capabilities of omni.replicator.core.modify by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

Time

omni.replicator.core.modify.time(value: Union[float, ReplicatorItem]) ReplicatorItem

Set the timeline time value (in seconds).

Parameters

value – The value to set the time to.

Example

>>> import omni.replicator.core as rep
>>> with rep.trigger.on_frame(num_frames=10):
...     rep.modify.time(rep.distribution.uniform(0, 500))
omni.replicator.core.modify.time
omni.replicator.core.modify.timeline(value: Union[float, ReplicatorItem], modify_type: str = None) ReplicatorItem

Modify the timeline by frame number or time value (in seconds).

Parameters
  • value – The value to set the frame number or time to.

  • modify_type – The method with which to modify the timeline by.

Example

>>> import omni.replicator.core as rep
>>> with rep.trigger.on_frame(num_frames=10):
...     rep.modify.timeline(rep.distribution.uniform(0, 500), "frame")
omni.replicator.core.modify.timeline

Randomizer

omni.replicator.core.randomizer.color(colors: Union[ReplicatorItem, List[Tuple[float]]], per_sub_mesh: bool = False, seed: int = None, input_prims: Union[ReplicatorItem, List[str]] = None) ReplicatorItem

Randomize colors Creates and binds an OmniPBR material to each prim in input_prims and randomizes colors.

Parameters
  • colors – List of colors, or a ReplicatorItem that outputs a list of colors. If supplied as a list, a choice sampler is automatically created to sample from the supplied color list.

  • per_sub_mesh – If True, bind a color to each mesh and geom_subset. If False, a color is bound only to the specified prim.

  • seed – If colors is specified as a list, optionally provide seed for color sampler. Unused if colors is a ReplicatorItem.

  • input_prims – List of input_prims. If constructing using with structure, set to None to bind input_prims to the current context.

Example

>>> import omni.replicator.core as rep
>>> cones = rep.create.cone(position=rep.distribution.uniform((-100,-100,-100),(100,100,100)), count=100)
>>> with cones:
...     rep.randomizer.color(colors=rep.distribution.uniform((0, 0, 0), (1, 1, 1)))
omni.replicator.core.randomizer.color
omni.replicator.core.randomizer.instantiate(paths: Union[ReplicatorItem, List[str]], size: Union[ReplicatorItem, int], weights: List[float] = None, mode: str = 'scene_instance', with_replacements=True, seed: int = None, use_cache: bool = True) ReplicatorItem

Sample size number of prims from the paths provided.

Parameters
  • paths – The list of USD paths pointing to the assets to sample from.

  • size – The number of samples to sample. NOTE: if the paths is a ReplicatorItem, size will be ignored.

  • weights – The weights to use for sampling. If provided, the length of weights must match the length of paths. If omitted, uniform sampling will be used. NOTE: if the paths is a ReplicatorItem, weights will be ignored.

  • mode – The instantiation mode. Choose from [scene_instance, point_instance, reference]. Defaults to scene_instance. Scene Instance creates a prototype in the cache, and new instances reference the prototype. Point Instances are best suited for situations requiring a very large number of samples, but only pose attributes can be modified per instance. Reference mode is used for asset references that need to be modified (WARNING: this mode has known material loading issue.)

  • with_replacements – When False, avoids duplicates when sampling. Default True. NOTE: if the paths is a ReplicatorItem, with_replacements will be ignored.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used. NOTE: if the paths is a ReplicatorItem, seed will be ignored.

  • use_cache – If True, cache the assets in paths to speed up randomization. Set to False if the size of the population is too large to be cached. Default: True.

Example

>>> import omni.replicator.core as rep
>>> usds = rep.utils.get_usd_files(rep.example.ASSETS_DIR)
>>> with rep.randomizer.instantiate(usds, size=100):
...     rep.modify.pose(position=rep.distribution.uniform((-50,-50,-50),(50,50,50)))
omni.replicator.core.modify.pose
omni.replicator.core.randomizer.materials(materials: Union[ReplicatorItem, List[str]], seed: int = None, input_prims=None) ReplicatorItem

Sample materials from provided materials and bind to the input_prims.

Note that binding materials is a relatively expensive operation. It is generally more efficient to modify materials already bound to prims.

Parameters
  • materials – The list of materials to sample from and bind to the input prims. The materials can be prim paths, MDL paths or a ReplicatorItem.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> mats = rep.create.material_omnipbr(diffuse=rep.distribution.uniform((0,0,0), (1,1,1)), count=100)
>>> spheres = rep.create.sphere(
...     scale=0.2,
...     position=rep.distribution.uniform((-100,-100,-100), (100,100,100)),
...     count=100
... )
>>> with spheres:
...     rep.randomizer.materials(mats)
omni.replicator.core.randomizer.materials
omni.replicator.core.randomizer.rotation(min_angle: Tuple[float, float, float] = (- 180.0, - 180.0, - 180.0), max_angle: Tuple[float, float, float] = (180.0, 180.0, 180.0), seed: int = None, input_prims: Union[ReplicatorItem, List[str]] = None) ReplicatorItem

Randomize the rotation of the input prims

This randomizer produces a truly uniformly distributed rotations to the input prims. In contrast, rotations are not truly uniformly distributed when simply sampling uniformly for each rotation axis.

Parameters
  • min_angle – Minimum value for Euler angles in XYZ form (degrees)

  • max_angle – Maximum value for Euler angles in XYZ form (degrees)

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> cubes = rep.create.cube(position=rep.distribution.uniform((-100,-100,-100),(100,100,100)), count=100)
>>> with cubes:
...     rep.randomizer.rotation()
omni.replicator.core.randomizer.rotation
omni.replicator.core.randomizer.scatter_2d(surface_prims: Union[ReplicatorItem, List[str]], no_coll_prims: Union[ReplicatorItem, List[str]] = None, min_samp: Tuple[float, float, float] = (None, None, None), max_samp: Tuple[float, float, float] = (None, None, None), seed: int = None, offset: int = 0, check_for_collisions: bool = False, input_prims: Union[ReplicatorItem, List[str]] = None) ReplicatorItem

Scatter input prims across the surface of the specified surface prims.

Parameters
  • surface_prims – The prims across which to scatter the input prims. These can be meshes or GeomSubsets which specify a subset of a mesh’s polygons on which to scatter.

  • no_coll_prims – Existing prim(s) to prevent collisions with - if any prims are passed they will be checked for collisions which may slow down compute, regardless if check_for_collisions is True/False.

  • min_samp – The minimum position in global space to sample from.

  • max_samp – The maximum position in global space to sample from.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • offset – The distance the prims should be offset along the normal of the surface of the mesh.

  • check_for_collisions – Whether the scatter operation should ensure that objects are not intersecting.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> spheres = rep.create.sphere(count=100)
>>> surface_prim = rep.create.torus(scale=20, visible=False)
>>> with spheres:
...     rep.randomizer.scatter_2d(surface_prim)
omni.replicator.core.randomizer.scatter_2d
omni.replicator.core.randomizer.scatter_3d(volume_prims: Union[ReplicatorItem, List[str]] = None, no_coll_prims: Union[ReplicatorItem, List[str]] = None, volume_excl_prims: Union[ReplicatorItem, List[str]] = None, min_samp: Tuple[float, float, float] = (None, None, None), max_samp: Tuple[float, float, float] = (None, None, None), resolution_scaling: float = 1.0, voxel_size: float = 0.0, check_for_collisions: bool = False, prevent_vol_overlap: bool = True, seed: int = None, input_prims: Union[ReplicatorItem, List[str]] = None) ReplicatorItem

Scatter input prims within the bounds of the specified volume prims.

Parameters
  • volume_prims – The prims within which to scatter the input prims. Currently, only meshes are supported, and they must be watertight. If no prims are provided, you must specify min_samp and max_samp bounds.

  • no_coll_prims – Existing prim(s) to prevent collisions with - if any prims are passed they will be checked for collisions using rejection sampling. This may slow down compute, regardless if check_for_collisions is True/False.

  • volume_excl_prims – Prim(s) from which to exclude from sampling. Must have watertight meshes. Similar effect to no_coll_prims, but more efficient and less accurate. Rather than performing rejection sampling based on collision with the provided volume (as no_coll_prims does), this prunes off the voxelized sampling space enclosed by volume_excl_prims so the rejection rate is 0 because it never tires to sample in the excluded space. However, some objects may get sampled very close to the edge of a mesh in volume_excl_prims, where the sampled root point is outside volume_excl_prims but parts of the mesh extend to overlap the space. To get the best of both worlds, you can pass the same volume prim to both no_coll_prims and to volume_excl_prims, providing a high accuracy and a low rejection rate.

  • min_samp – The minimum position in global space to sample from.

  • max_samp – The maximum position in global space to sample from.

  • resolution_scaling – Amount the default voxel resolution used in sampling should be scaled. More complex meshes may require higher resolution. Default voxel resolution is 30 for the longest side of the mean sized volumePrim mesh provided. Higher values will ensure more fine-grained voxels, but will come at the cost of performance.

  • voxel_size – Voxel size used to compute the resolution. If this is provided, then resolution_scaling is ignored, otherwise (if it is zero by default) resolution_scaling is used.

  • check_for_collisions – Whether the scatter operation should ensure that sampled objects are not intersecting.

  • prevent_vol_overlap – If true, prevents double sampling even when multiple enclosing volumes overlap, so that the entire enclosed volume is sampled uniformly. If false, it allows overlapped sampling with higher density in overlapping areas.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> spheres = rep.create.sphere(count=100)
>>> volume_prim = rep.create.torus(scale=20, visible=False)
>>> with spheres:
...     rep.randomizer.scatter_3d(volume_prim)
omni.replicator.core.randomizer.scatter_3d
omni.replicator.core.randomizer.texture(textures: Union[ReplicatorItem, List[str]], texture_scale: Union[ReplicatorItem, List[Tuple[float, float]]] = None, texture_rotate: Union[ReplicatorItem, List[int]] = None, per_sub_mesh: bool = False, project_uvw: bool = False, seed: int = None, input_prims: Union[ReplicatorItem, List[str]] = None) ReplicatorItem

Randomize texture Creates and binds an OmniPBR material to each prim in input_prims and modifies textures.

Parameters
  • textures – List of texture paths, or a ReplicatorItem that outputs a list of texture paths. If a list of texture paths is provided, they will be sampled uniformly using the global seed.

  • texture_scale – List of texture scales in (X, Y) represented by positive floats. Larger values will make the texture appear smaller on the asset.

  • texture_rotate – Rotation in degrees of the texture.

  • per_sub_mesh – If True, bind a material to each mesh and geom_subset. If False, a material is bound only to the specified prim.

  • project_uvw – When True, UV coordinates will be generated by projecting them from a coordinate system.

  • seed – Seed to use as initialization for the pseudo-random number generator. If not specified, the global seed will be used.

  • input_prims – List of input_prims. If constructing using with structure, set to None to bind input_prims to the current context.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cone(position=rep.distribution.uniform((-100,-100,-100),(100,100,100)), count=100):
...     rep.randomizer.texture(textures=rep.example.TEXTURES, texture_scale=[(0.5, 0.5)], texture_rotate=[45])
omni.replicator.core.randomizer.texture
omni.replicator.core.randomizer.register(fn: Callable[[...], Union[ReplicatorItem, Node]], override: bool = True) None

Register a new function under omni.replicator.core.randomizer. Extend the default capabilities of omni.replicator.core.randomizer by registering new functionality. New functions must return a ReplicatorItem or an OmniGraph node.

Parameters
  • fn – A function that returns a ReplicatorItem or an OmniGraph node.

  • override – If True, will override existing functions of the same name. If false, an error is raised.

Example

>>> import omni.replicator.core as rep
>>> def scatter_points(points):
...     return rep.modify.pose(position=rep.distribution.choice(points))
>>> rep.randomizer.register(scatter_points)
>>> with rep.create.cone():
...     rep.randomizer.scatter_points([(0, 0, 0), (0, 0, 100), (0, 0, 200)])
omni.replicator.core.randomizer.scatter_points

Physics

omni.replicator.core.physics.collider(approximation_shape: str = 'convexHull', contact_offset: float = None, rest_offset: float = None, input_prims: Union[ReplicatorItem, List] = None) None

Applies the Physx Collision API to the prims specified in input_prims.

Parameters
  • approximation_shape – The approximation used in the collider (by default, convex hull). Other approximations include “convexDecomposition”, “boundingSphere”, “boundingCube”, “meshSimplification”, and “none”. “none” will just use default mesh geometry.

  • contact_offset – Offset used when generating contact points. If it is None, it will determined by scene’s current meters_per_unit. Default: None.

  • rest_offset – Offset used when generating rest contact points. If it is None, it will determined by scene’s current meters_per_unit. Default: None.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.physics.collider()
omni.replicator.core.physics.collider
omni.replicator.core.physics.drive_properties(stiffness: Union[ReplicatorItem, float] = 0.0, damping: Union[ReplicatorItem, float] = 0.0, input_prims: Union[ReplicatorItem, List] = None) None
Applies the Drive API to the prims specified in input_prims, if necessary. Prims must be either revolute or

prismatic joints. For D6 joint randomization, please refer to omni.replicator.core.modify.attribute and provide the exact attribute name of the drive parameter to be randomized.

Parameters
  • stiffness – The stiffness of the drive (unitless).

  • damping – The damping of the drive (unitless).

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

omni.replicator.core.physics.mass(mass: Optional[float] = None, density: Optional[float] = None, center_of_mass: Optional[List] = None, diagonal_inertia: Optional[List] = None, principal_axes: Optional[List] = None, input_prims: Union[ReplicatorItem, List] = None) None
Applies the Physx Mass API to the prims specified in input_prims, if necessary. This function sets up randomization

parameters for various mass-related properties in the mass API.

Parameters
  • mass – The mass of the prim. By default mass is derived from the volume of the collision geometry multiplied by a density.

  • density – The density of the prim.

  • center_of_mass – Center of the mass of the prim in local coordinates.

  • diagonal_inertia – Constructs a diagonalized inertia tensor along the principal axes.

  • principal_axes – A quaternion (wxyz) representing the orientation of the principal axes in the local coordinate frame.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.physics.mass(mass=rep.distribution.uniform(1.0, 50.0))
omni.replicator.core.physics.mass
omni.replicator.core.physics.physics_material(static_friction: Union[ReplicatorItem, float] = None, dynamic_friction: Union[ReplicatorItem, float] = None, restitution: Union[ReplicatorItem, float] = None, input_prims: Union[ReplicatorItem, List] = None) None
If input prim is a material, the physics material API will be applied if necessary. Otherwise, if the prim has a

bound material, then randomizations will be made on this material (where once again, with the physics material API being bound if necessary). If the prim does not have a bound material, then a physics material will be created at <prim_path>/PhysicsMaterial and bound at the prim.

Parameters
  • static_friction – Static friction coefficient (unitless).

  • dynamic_friction – Dynamic friction coefficient (unitless).

  • restitution – Restitution coefficient (unitless).

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.physics.physics_material(
...         static_friction=rep.distribution.uniform(0.0, 1.0),
...         dynamic_friction=rep.distribution.uniform(0.0, 1.0),
...         restitution=rep.distribution.uniform(0.0, 1.0)
...     )
omni.replicator.core.physics.physics_material
omni.replicator.core.physics.rigid_body(velocity: Union[ReplicatorItem, Tuple[float, float, float]] = (0.0, 0.0, 0.0), angular_velocity: Union[ReplicatorItem, Tuple[float, float, float]] = (0.0, 0.0, 0.0), contact_offset: float = None, rest_offset: float = None, input_prims: Union[ReplicatorItem, List] = None) None
Randomizes the velocity and angular velocity of the prims specified in input_prims. If they do not have

the RigidBody API then one will be created for the prim.

Parameters
  • velocity – The velocity of the prim.

  • angular_velocty – The angular velocity of the prim (degrees / time).

  • contact_offset – Offset used when generating contact points. If it is None, it will determined by scene’s current meters_per_unit. Default: None.

  • rest_offset – Offset used when generating rest contact points. If it is None, it will determined by scene’s current meters_per_unit. Default: None.

  • input_prims – The prims to be modified. If using with syntax, this argument can be omitted.

Example

>>> import omni.replicator.core as rep
>>> with rep.create.cube():
...     rep.physics.rigid_body(
...         velocity=rep.distribution.uniform((0, 0, 0), (100, 100, 100)),
...         angular_velocity=rep.distribution.uniform((30, 30, 30), (300, 300, 300))
...     )
omni.replicator.core.physics.rigid_body

Annotators

class omni.replicator.core.scripts.annotators.AnnotatorParams(template, data_type, num_elems, is_2d_array, is_gpu_enabled, hidden, documentation)
data_type

Alias for field number 1

documentation

Alias for field number 6

hidden

Alias for field number 5

is_2d_array

Alias for field number 3

is_gpu_enabled

Alias for field number 4

num_elems

Alias for field number 2

template

Alias for field number 0

exception omni.replicator.core.scripts.annotators.AnnotatorRegistryError(msg=None)

Base exception for errors raised by the annotator registry

__init__(msg=None)
exception omni.replicator.core.scripts.annotators.AnnotatorError(msg=None)

Base exception for errors raised by annotator

__init__(msg=None)
exception omni.replicator.core.scripts.annotators.AugmentationError(msg=None)

Base exception for errors raised by augmentation

__init__(msg=None)
class omni.replicator.core.scripts.annotators.Augmentation(node_type_id: str, data_out_shape: Optional[Tuple[int]] = None, **kwargs)

Augmentation class

Augmentations are defined by a python function or warp kernel which manipulates the array held in a required

data_in argument. Augmentations can be applied to any annotator which outputs a data attribute along with corresponding width and height attributes.

Parameters
  • augmentation

    Python function or Warp kernel describing the augmentation operation. Details on required and supported optional arguments as follows:

    • data_in: Required by both python and warp augmentations and is populated with the input data array

    • data_out: Required by warp functions, holds the output array. Not supported in conjunction with python functions.

    • data_out_shape: Required for warp functions if the shape of the output array does not match that of the input array. An axis value of -1 indicate that the axis matches the input’s axis dimension.

    • seed: Optional argument that can be used with both python and warp functions. If set to None or < 0, will use Replicator’s global seed together with the node identifier to produce a repeatable unique seed.

  • data_out_shape – Specifies the shape of the output array if the augmentation is specified as a warp kernel and the output array is a different shape than that of the input array. An axis value of -1 indicates that the axis is the same size of the corresponding axis in the input array.

  • kwargs – Optional parameters specifying the parameters to initialize the augmentation with

Example

>>> import omni.replicator.core as rep
>>> import warp as wp
>>> @wp.kernel
... def rgba_to_rgb(data_in: wp.array3d(dtype=wp.uint8), data_out: wp.array3d(dtype=wp.uint8)):
...    i, j = wp.tid()
...    data_out[i, j, 0] = data_in[i, j, 0]
...    data_out[i, j, 1] = data_in[i, j, 1]
...    data_out[i, j, 2] = data_in[i, j, 2]
>>> augmentation = rep.annotators.Augmentation.from_function(rgba_to_rgb, data_out_shape=(-1, -1, 3))
__init__(node_type_id: str, data_out_shape: Optional[Tuple[int]] = None, **kwargs)
static from_node(node_type_id: str, attributes_mapping: Optional[Dict] = None, data_out_shape: Optional[Tuple[int]] = None, **kwargs) Augmentation

Create an augmentation from an existing OmniGraph node

When applied to an annotator, corresponding attributes between the annotator and the augmentation node will be automatically connected to one another.

Parameters
  • node_type_id – Node type ID

  • attributes_mapping – Optional attribute mapping to connect non-matching attributes between the augmentation and the annotator to which it’s applied.

  • data_out_shape – Specifies the shape of the output array if the augmentation is specified as a warp kernel and the output array is a different shape than that of the input array. An axis value of -1 indicates that the axis is the same size of the corresponding axis in the input array.

  • kwargs – Optional parameters specifying the parameters to initialize the augmentation with

Example

>>> import omni.replicator.core as rep
>>> augmentation = rep.annotators.Augmentation.from_node("omni.replicator.core.CameraParams")
>>> anno = rep.annotators.get("PostProcessRenderProductCamera").augment(augmentation)
static from_function(augmentation: Union[Callable, warp.context.Kernel], data_out_shape: Optional[Tuple[int]] = None, **kwargs) Augmentation

Create an augmentation from a python function or warp kernel

Create an augmentation defined from a python function or warp kernel which manipulates the array held in a

data_in argument. Augmentations can be applied to any annotator which outputs a data attribute along with corresponding width and height attributes.

Parameters
  • augmentation

    Python function or Warp kernel describing the augmentation operation. Details on required and supported optional arguments as follows:

    • data_in: Required by both python and warp augmentations and is populated with the input data array

    • data_out: Required by warp functions, holds the output array. Not supported in conjunction with python functions.

    • data_out_shape: Required for warp functions if the shape of the output array does not match that of the input array. An axis value of -1 indicate that the axis matches the input’s axis dimension.

    • seed: Optional argument that can be used with both python and warp functions. If set to None or < 0, will use Replicator’s global seed together with the node identifier to produce a repeatable unique seed.

  • data_out_shape – Specifies the shape of the output array if the augmentation is specified as a warp kernel and the output array is a different shape than that of the input array. An axis value of -1 indicates that the axis is the same size of the corresponding axis in the input array.

  • kwargs – Optional parameters specifying the parameters to initialize the augmentation with

Example

>>> import omni.replicator.core as rep
>>> import warp as wp
>>> @wp.kernel
... def rgba_to_rgb(data_in: wp.array3d(dtype=wp.uint8), data_out: wp.array3d(dtype=wp.uint8)):
...    i, j = wp.tid()
...    data_out[i, j, 0] = data_in[i, j, 0]
...    data_out[i, j, 1] = data_in[i, j, 1]
...    data_out[i, j, 2] = data_in[i, j, 2]
>>> augmentation = rep.annotators.Augmentation(rgba_to_rgb, data_out_shape=(-1, -1, 3))
apply(annotator: Union[str, Annotator], **kwargs) Annotator

Apply augmentation to annotator

Parameters
  • annotator – Annotator to apply the augmentation to

  • kwargs – Optional parameters specifying the parameters to initialize the augmentation with

class omni.replicator.core.scripts.annotators.Annotator(name: str, init_params: Optional[dict] = None, render_product_idxs: Optional[List[int]] = None, device: Optional[str] = None, render_products: Optional[list] = None, template_name: Optional[str] = None)

Annotator class Annotator instances identify the annotator name, it’s initialization parameters, the render products it is tied to, as well as the name of the OmniGraph template.

Initialization parameters can be overridden with initialize(), and render products can be set with attach(). Once attached, the data from an annotator can be retrieved with get_data().

Parameters
  • name – Annotator name

  • init_params – Optional parameters specifying the parameters to initialize the annotator with

  • render_product_idxs – Optionally specify the index of render products to utilize

  • device – If set, make annotator data available to specified device if possible. Select from [cpu, cuda]. Defaults to cpu.

  • render_products – If set, attach annotator to render_products

  • template_name – Optional name of the template describing the annotator graph

__init__(name: str, init_params: Optional[dict] = None, render_product_idxs: Optional[List[int]] = None, device: Optional[str] = None, render_products: Optional[list] = None, template_name: Optional[str] = None) None
initialize(**kwargs) None

Initialize annotator parameters The initialization parameters of the annotator. Initialize can only be called before the annotator has been attached.

Parameters

kwargs – Optional parameters specifying the parameters to initialize the annotator with

property documentation: str
property docs: str
property template_name: str
attach(render_products: Optional[List] = None) None

Attach annotator to specified render products. Creates the OmniGraph nodes and connections.

Parameters

render_products – List of render products to attach the annotator to.

detach(render_products: List) None

Detach an attached annotator

Parameters

render_products – List of render products to detach the annotator from.

get_data(device: Optional[str] = None) Any

Return annotator data.

Note that if calling get_data() immediately after initialization, the annotator output will not yet be available. Please allow for at least one update.

Parameters

device – Device to hold data in. Select from cpu and cuda. If cpu is specified, the output data is returned in the form of a number array. If cuda is selected, a Warp array is returned. Note that only valid datatypes will be moved to the GPU. Defaults to the device specified on annotator initialization.

property is_attached: bool

Returns True if annotator is attached to render product(s)

get_name() str

Get annotator name

get_node() Node

Get annotator node

augment(augmentation: Union[Augmentation, str, Callable, warp.context.Kernel], data_out_shape: Optional[Tuple[int]] = None, **kwargs) Annotator

Augment annotator

Add an augmentation operation to the annotator

Parameters
  • augmentation – Augmentation operation to apply to the annotator output

  • data_out_shape – Specifies the shape of the output array if the augmentation is specified as a warp kernel and the output array is a different shape than that of the input array. An axis value of -1 indicates that the axis is the same size of the corresponding axis in the input array.

  • kwargs – Parameters specifying the parameters to initialize the augmentation with

augment_compose(augmentations: List[Union[Augmentation, str]]) Annotator

Augment annotator with multiple augmentation operations

Augment annotator with a chain one or more augmentation operations

Parameters

augmentations – List of augmentations to be applied in sequence to the annotator

Example

>>> import omni.replicator.core as rep
>>> import warp as wp
>>> @wp.kernel
... def rgba_to_rgb(data_in: wp.array3d(dtype=wp.uint8), data_out: wp.array3d(dtype=wp.uint8)):
...    i, j = wp.tid()
...    data_out[i, j, 0] = data_in[i, j, 0]
...    data_out[i, j, 1] = data_in[i, j, 1]
...    data_out[i, j, 2] = data_in[i, j, 2]
>>> def rgb_to_greyscale(data_in):
...     r, g, b = data_in[..., 0], data_in[..., 1], data_in[..., 2]
...     return 0.299 * r + 0.587 * g + 0.114 * b
>>> greyscale_anno = rep.annotators.get("rgb").augment_compose([
...     rep.annotators.Augmentation.from_function(rgba_to_rgb, data_out_shape=(-1, -1, 3)),
...     rep.annotators.Augmentation.from_function(rgb_to_greyscale),
... ])
class omni.replicator.core.scripts.annotators.AnnotatorRegistry

Registry of annotators providing groundtruth data to writers.

classmethod register_augmentation(name: str, augmentation: Union[Augmentation, str]) None

Register an augmentation operation.

Parameters
  • name – Name under which to register augmentation

  • augmentation – Augmentation to register

Example

>>> import omni.replicator.core as rep
>>> def make_opaque(data_in):
...    data_in[..., 3] = 255
>>> rep.AnnotatorRegistry.register_augmentation("makeOpaque", rep.annotators.Augmentation.from_function(make_opaque))
classmethod unregister_augmentation(name: str) None

Register an augmentation operation.

Parameters

name – Name of augmentation to unregister

Example

>>> import omni.replicator.core as rep
>>> def make_opaque(data_in):
...    data_in[..., 3] = 255
>>> rep.AnnotatorRegistry.register_augmentation("makeOpaque", make_opaque)
classmethod register_annotator_from_node(name: str, input_rendervars: List[Union[str, list, omni.syntheticdata.SyntheticData.NodeConnectionTemplate]], node_type_id: str, init_params: Optional[dict] = None, render_product_idxs: tuple = (0,), output_rendervars: Optional[List[Union[str, list]]] = None, output_data_type: Optional[Any] = None, output_is_2d: bool = False, output_channels: int = 1, is_gpu_enabled: bool = True, hidden: bool = False, documentation: Optional[str] = None) Annotator

Register annotator from an omnigraph node definition.

Parameters
  • name – Annotator name. This name will be used to retrieve the annotator from the registry and will be used as the key in the data dictionary provided to the writer.

  • input_rendervars – List of rendervars or other nodes that supply inputs to the node.

  • node_type_id – Node type ID

  • init_params – Annotator initialization parameters

  • render_product_idxs – Index of render products to utilize

  • output_rendervars – Specifies the render vars output by the node

  • output_data_type – Specifies the output data type

  • output_is_2d – Set to True if output is a 2D array

  • output_channels – Specifies the number of output channels of the array. Ignored if output_is_2d is set to False

  • is_gpu_enabled – If False, annotator device cannot be set to “cuda” and data will only be provided through system memory.

  • hidden – If True, annotator is not exposed by calls to get and get_registered_annotators. Intermediate annotator representations should be hidden. Defaults to False

  • documentation – Optionally document annotator functionality, input parameters and output format.

classmethod register_annotator_from_aov(aov: str, output_data_type: Optional[Any] = None, output_channels: int = 1) None

Register annotator from an Arbitrary Output Variable (AOV).

Parameters

aov – AOV name

classmethod detach(annotator: Union[str, Annotator], render_products: List) None

Detach annotator from render products

Parameters
  • annotator – Annotator name or Annotator object to be detached

  • render_product – List of render products from which the annotator is to be detached

classmethod get_registered_annotators() List[str]

Returns a list names of registered annotators.

Note: Hidden annotators are not returned

Returns

List of registered annotators.

classmethod get_annotator(name: str, init_params: Optional[dict] = None, render_product_idxs: Optional[List[int]] = None, device: Optional[str] = None) Annotator

Get annotator from registry

Parameters
  • name – Name of annotator to be retrieved from registry

  • init_params – Annotator initialization parameters

  • render_product_idxs – Index of render products to utilize

  • device – If set, make annotator data available to specified device if possible. Select from [cpu, cuda]. Defaults to cpu.

classmethod get_augmentation(name: str) Augmentation

Get Augmentation from registry

Parameters

name – Augmentation name

classmethod unregister_annotator(name: str) None

Unregister annotator

Parameters

name – Annotator name

omni.replicator.core.scripts.annotators.get(name: str, init_params: Optional[dict] = None, render_product_idxs: Optional[List[int]] = None, device: Optional[str] = None) Annotator

Get annotator from registry

Parameters
  • name – Name of annotator to be retrieved from registry

  • init_params – Annotator initialization parameters

  • render_product_idxs – Index of render products to utilize

  • device – If set, make annotator data available to specified device if possible. Select from [cpu, cuda]. Defaults to cpu.

omni.replicator.core.scripts.annotators.get_augmentation(name: str) Augmentation

Get Augmentation from registry

Parameters

name – Name of augmentation to retrieve from registry

omni.replicator.core.scripts.annotators.augment(source_annotator: Union[Annotator, str], augmentation: Union[str, Augmentation], data_out_shape: Optional[Tuple] = None, **kwargs) Annotator

Create an augmented annotator

Parameters
  • source_annotator – Annotator to be augmented

  • augmentation – Augmentation to be applied to source annotator. Can be specified as an Augmentation, the name of a registered augmentation or the node type id of an omnigraph node to be used as an augmentation.

  • data_out_shape – Specifies the shape of the output array if the augmentation is specified as a warp kernel and the output array is a different shape than that of the input array. An axis value of -1 indicates that the axis is the same size of the corresponding axis in the input array.

  • kwargs – Optional parameters specifying the parameters to initialize the augmentation with

Example

>>> import omni.replicator.core as rep
>>> @wp.kernel
... def rgba_to_rgb(data_in: wp.array3d(dtype=wp.uint8), data_out: wp.array3d(dtype=wp.uint8)):
...    i, j = wp.tid()
...    data_out[i, j, 0] = data_in[i, j, 0]
...    data_out[i, j, 1] = data_in[i, j, 1]
...    data_out[i, j, 2] = data_in[i, j, 2]
>>> rgb_anno = rep.annotators.augment(
...     source_annotator="rgb",
...     augmentation=rep.annotators.Augmentation.from_function(rgba_to_rgb)
... )
omni.replicator.core.scripts.annotators.augment_compose(source_annotator: Union[Annotator, str], augmentations: List[Union[Augmentation, str]]) Annotator

Compose an augmentated Annotator from multiple augmentation operations

Chain one or more augmentation operations together to be applied to a source annotator.

Parameters
  • source_annotator – Annotator to be augmented

  • augmentations – List of augmentations to be applied in sequence to the source annotator

Example

>>> import omni.replicator.core as rep
>>> @wp.kernel
... def rgba_to_rgb(data_in: wp.array3d(dtype=wp.uint8), data_out: wp.array3d(dtype=wp.uint8)):
...    i, j = wp.tid()
...    data_out[i, j, 0] = data_in[i, j, 0]
...    data_out[i, j, 1] = data_in[i, j, 1]
...    data_out[i, j, 2] = data_in[i, j, 2]
>>> def rgb_to_greyscale(data_in):
...     r, g, b = data_in[..., 0], data_in[..., 1], data_in[..., 2]
...     return 0.299 * r + 0.587 * g + 0.114 * b
>>> greyscale_anno = rep.annotators.augment_compose(
...     source_annotator="rgb",
...     augmentations=[
...         rep.annotators.Augmentation.from_function(rgba_to_rgb),
...         rep.annotators.Augmentation.from_function(rgb_to_greyscale),
...     ]
... )
omni.replicator.core.scripts.annotators.get_registered_annotators() List[str]

Returns a list names of registered annotators.

Returns

List of registered annotators.

omni.replicator.core.scripts.annotators.register(name: str, annotator: Union[Annotator, str]) None

Register annotator

Parameters
  • name – Name under which to register annotator

  • annotator – Annotator to be registered

omni.replicator.core.scripts.annotators.register_augmentation(name: str, augmentation: Union[Augmentation, str]) None

Register an augmentation operation.

Parameters
  • name – Name under which to register augmentation

  • augmentation – Augmentation to be registered. Can be specified as an Augmentation, the name of a registered augmentation or the node type id of an omnigraph node to be used as an augmentation.

Example

>>> import omni.replicator.core as rep
>>> def make_opaque(data_in):
...    data_in[..., 3] = 255
>>> rep.annotators.register_augmentation("makeOpaque", rep.annotators.Augmentation(make_opaque))
omni.replicator.core.scripts.annotators.unregister_augmentation(name: str) None

Unregister a registered augmentation

Parameters

name – Name of augmentation to unregister

Default Annotators

Annotator Utils

omni.replicator.core.scripts.utils.annotator_utils.get_extra_data(params)
omni.replicator.core.scripts.utils.annotator_utils.get_annotator_data(node: Node, annotator_params: tuple, from_inputs: bool = False, device: str = 'cpu')
omni.replicator.core.scripts.utils.annotator_utils.script_node_check(nodes: list = [])

Prompt user before enabling a script node

Call this script in any node capable of executing arbitrary scripts within the node’s initialize call.

Note: Only one prompt attempt is made per session

omni.replicator.core.scripts.utils.annotator_utils.check_should_run_script()

Writers

exception omni.replicator.core.scripts.writers.WriterRegistryError(msg=None)

Basic exception for errors raised by the writer registry

__init__(msg=None)
exception omni.replicator.core.scripts.writers.InvalidWriterError(writer_name, writer, msg=None)

Exception for writer registration errors

__init__(writer_name, writer, msg=None)
class omni.replicator.core.scripts.writers.NodeWriter(node_type_id: str, annotators: List[Union[str, Annotator]], **kwargs)

Node Writer class.

Node writers are writers implemented as OmniGraph nodes. These depend on annotators like python writers, but are implemented as nodes and can be written in C++.

Parameters
  • node_type_id – The node’s type identifier (eg. ‘my.extension.OgnCustomNode’)

  • annotators – List of dependent annotators

node_type_id

The node’s type identifier (eg. ‘my.extension.OgnCustomNode’)

annotators

List of dependent annotators

kwargs

Node Writer input attribute initialization

__init__(node_type_id: str, annotators: List[Union[str, Annotator]], **kwargs)
initialize(**kwargs) None
property annotators: List[Union[str, omni.replicator.core.scripts.annotators.Annotator]]
get_node()

Get writer node

attach(render_products: List[str], **kwargs)

Attach node writer to render products

Attaches the node writer to the render products specified and creates and attaches annotator graphs. If a single annotator is attached, input connections will match the annotator’s output attribute names, in the form of inputs:<attribute_name>. For cases involving more than one annotators, the node writer input attributes will be in the form inputs:<annotator_name>_<attribute_name>.

Parameters
  • render_products – Render Product prim path(s) to which to attach the writer.

  • kwargs – Node Writer input attribute initialization

on_final_frame()

Run after final frame is written.

detach()

Detach writer

class omni.replicator.core.scripts.writers.Writer

Base Writer class.

Writers must specify a list of required annotators which will be called during data collection. Annotator data is packaged in a data dictionary of the form <annotator_name>: <annotator_data> and passed to the writer’s write function.

An optional on_final_frame function can be defined to run once data generation is stopped.

backend = None
version = '0.0.0'
annotators = []
metadata = None
get_metadata()
write_metadata()
abstract write(data: dict)

Write ground truth.

on_final_frame()

Run after final frame is written.

initialize(**kwargs)

Initialize writer If the writer takes initialization arguments, they can be set here.

Parameters

**kwargs – Writer initialization arguments.

attach(render_products: List[str])

Attach writer to specified render products.

Parameters

render_products – Render Product prim path(s) to which to attach the writer.

async attach_async(render_products: List[str])

Attach writer to specified render products and await attachment completed

Parameters

render_products – Render Product prim path(s) to which to attach the writer.

detach()

Detach writer

get_node() Node

Get writer node

class omni.replicator.core.scripts.writers.WriterRegistry

This class stores a list of available registered writers and which writers are attached to render products.

One or more writers can be attached simultaneously to the same render product to simultaneously write ground truth in multiple formats.

Register a writer with WriterRegistry.register(ExampleWriter) Attach a writer to a render_product with WriterRegistry.attach(“Example”, “/World/Render Product”) Detach a writer with WriterRegistry.detach(“Example”)

classmethod register(writer: Writer, category: Optional[str] = None) None

Register a writer.

Registered writers can be retrieved with WriterRegistry.get(<writer_name>)

Parameters
  • writer – Instance of class Writer.

  • category – Optionally specify a category of writer to group writers together.

classmethod register_node_writer(name: str, node_type_id: str, annotators: List[Union[str, Annotator]], category: Optional[str] = None, **kwargs) None

Register a Node Writer

Register a writer implemented as an omnigraph node.

Parameters
  • node_type_id – The node’s type identifier (eg. ‘my.extension.OgnCustomNode’)

  • annotators – List of dependent annotators

  • category – Optionally specify a category of writer to group writers together.

  • kwargs – Node Writer input attribute initialization

classmethod unregister(writer_name) None

Unregister a writer with specified name if it exists.

Parameters

writer_name – Name of registered writer.

classmethod attach(writer: Union[Writer, NodeWriter], render_products: Union[str, List[str]], init_params: Optional[Dict] = None, **kwargs) None

Attach writer with specified name to render_products.

Parameters
  • writer – Writer instance

  • render_products – Render Product prim path(s).

  • init_params – (Deprecated) Dictionary of initialization parameters.

  • kwargs – Additional initialization parameters.

classmethod detach(writer_name: str, render_products: Optional[List[str]] = None) None

Detach active writer with specified id from render_products.

Parameters
  • writer_name – Name of writer(s) to be detached.

  • render_products – List of render product prim paths from which to disable the specified writer. If not provided, writers of matching writer_name will be disabled from all render products.

classmethod get_writers(category: Optional[str] = None) dict

Return dictionary of registered writers with mapping {writer_name: writer}.

Parameters

category – Optionally specify the category of the writers to retrieve.

classmethod get(writer_name: str, init_params: Optional[Dict] = None) Writer

Get a registered writer

Parameters
  • writer_name – Writer name

  • init_params – Dictionary of initialization parameters with which to initialize writer

classmethod get_attached_writers(render_products: Optional[Union[str, list]] = None) dict

Return dictionary of enabled writers with mapping {writer_name: writer}.

Parameters

render_products ([string, list[string]], optional) – Render Product prim path(s).

classmethod get_attached_writer(writer_name: str, render_products: Union[str, tuple]) Writer

Return the Writer object of writer_name on render_products.

Parameters
  • writer_name – Writer name

  • render_products – Render Product prim path(s)

classmethod get_writer_render_products() set

Return set of all render_products that are associated with one or more enabled writers.

classmethod get_annotators(render_products: Optional[Union[str, list]] = None) set

Return a set of annotators required by all enabled writers associated with render_products.

Parameters

render_products – Render Product prim path(s).

async classmethod initialize_annotators(render_products: Optional[Union[str, list]] = None) None

Call the initialize_fn of the annotators associated with render_products, if available.

Parameters

render_products – Render Product prim path(s).

classmethod detach_all() None

Detach all active writers

omni.replicator.core.scripts.writers.unregister_writer(writer_name) None

Unregister a writer with specified name if it exists.

Parameters

writer_name – Name of registered writer.

omni.replicator.core.scripts.writers.register_writer(writer: Writer, category: Optional[str] = None) None

Register a writer.

Registered writers can be retrieved with WriterRegistry.get(<writer_name>)

Parameters
  • writer – Instance of class Writer.

  • category – Optionally specify a category of writer to group writers together.

omni.replicator.core.scripts.writers.register_node_writer(name: str, node_type_id: str, annotators: List, category: Optional[str] = None, **kwargs) None

Register a Node Writer

Register a writer implemented as an omnigraph node.

Parameters
  • node_type_id – The node’s type identifier (eg. ‘my.extension.OgnCustomNode’)

  • annotators – List of dependent annotators

  • category – Optionally specify a category of writer to group writers together.

  • kwargs – Node Writer input attribute initialization

omni.replicator.core.scripts.writers.get(name, init_params: Optional[Dict] = None) Writer

Get a registered writer

Parameters
  • name – Writer name

  • init_params – Dictionary of initialization parameters with which to initialize writer

Default Writers

BasicWriter

class omni.replicator.core.scripts.writers_default.BasicWriter(output_dir: str, s3_bucket: Optional[str] = None, s3_region: Optional[str] = None, s3_endpoint: Optional[str] = None, semantic_types: Optional[List[str]] = None, rgb: bool = False, bounding_box_2d_tight: bool = False, bounding_box_2d_loose: bool = False, semantic_segmentation: bool = False, instance_id_segmentation: bool = False, instance_segmentation: bool = False, distance_to_camera: bool = False, distance_to_image_plane: bool = False, bounding_box_3d: bool = False, occlusion: bool = False, normals: bool = False, motion_vectors: bool = False, camera_params: bool = False, pointcloud: bool = False, pointcloud_include_unlabelled: bool = False, image_output_format: str = 'png', colorize_semantic_segmentation: bool = True, colorize_instance_id_segmentation: bool = True, colorize_instance_segmentation: bool = True, skeleton_data: bool = False, frame_padding: int = 4, semantic_filter_predicate: Optional[str] = None)

Basic writer capable of writing built-in annotator groundtruth.

output_dir

Output directory string that indicates the directory to save the results.

s3_bucket

The S3 Bucket name to write to. If not provided, disk backend will be used instead. Default: None. This backend requires that AWS credentials are set up in ~/.aws/credentials. See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html#configuration

s3_region

If provided, this is the region the S3 bucket will be set to. Default: us-east-1

s3_endpoint

If provided, this endpoint URL will be used instead of the default.

semantic_types

List of semantic types to consider when filtering annotator data. Default: [“class”]

rgb

Boolean value that indicates whether the rgb annotator will be activated and the data will be written or not. Default: False.

bounding_box_2d_tight

Boolean value that indicates whether the bounding_box_2d_tight annotator will be activated and the data will be written or not. Default: False.

bounding_box_2d_loose

Boolean value that indicates whether the bounding_box_2d_loose annotator will be activated and the data will be written or not. Default: False.

semantic_segmentation

Boolean value that indicates whether the semantic_segmentation annotator will be activated and the data will be written or not. Default: False.

instance_id_segmentation

Boolean value that indicates whether the instance_id_segmentation annotator will be activated and the data will be written or not. Default: False.

instance_segmentation

Boolean value that indicates whether the instance_segmentation annotator will be activated and the data will be written or not. Default: False.

distance_to_camera

Boolean value that indicates whether the distance_to_camera annotator will be activated and the data will be written or not. Default: False.

distance_to_image_plane

Boolean value that indicates whether the distance_to_image_plane annotator will be activated and the data will be written or not. Default: False.

bounding_box_3d

Boolean value that indicates whether the bounding_box_3d annotator will be activated and the data will be written or not. Default: False.

occlusion

Boolean value that indicates whether the occlusion annotator will be activated and the data will be written or not. Default: False.

normals

Boolean value that indicates whether the normals annotator will be activated and the data will be written or not. Default: False.

motion_vectors

Boolean value that indicates whether the motion_vectors annotator will be activated and the data will be written or not. Default: False.

camera_params

Boolean value that indicates whether the camera_params annotator will be activated and the data will be written or not. Default: False.

pointcloud

Boolean value that indicates whether the pointcloud annotator will be activated and the data will be written or not. Default: False.

pointcloud_include_unlabelled

If True, pointcloud annotator will capture any prim in the camera’s perspective, not matter if it has semantics or not. If False, only prims with semantics will be captured. Defaults to False.

image_output_format

String that indicates the format of saved RGB images. Default: “png”

colorize_semantic_segmentation

If True, semantic segmentation is converted to an image where semantic IDs are mapped to colors and saved as a uint8 4 channel PNG image. If False, the output is saved as a uint32 PNG image. Defaults to True.

colorize_instance_id_segmentation

If True, instance id segmentation is converted to an image where instance IDs are mapped to colors. and saved as a uint8 4 channel PNG image. If False, the output is saved as a uint32 PNG image. Defaults to True.

colorize_instance_segmentation

If True, instance segmentation is converted to an image where instance are mapped to colors. and saved as a uint8 4 channel PNG image. If False, the output is saved as a uint32 PNG image. Defaults to True.

frame_padding

Pad the frame number with leading zeroes. Default: 4

semantic_filter_predicate

A string specifying a semantic filter predicate as a disjunctive normal form of semantic type, labels.

Examples :

“typeA : labelA & !labelB | labelC , typeB: labelA ; typeC: labelD” “typeA : * ; * : labelA”

Example

>>> import omni.replicator.core as rep
>>> camera = rep.create.camera()
>>> render_product = rep.create.render_product(camera, (1024, 1024))
>>> writer = rep.WriterRegistry.get("BasicWriter")
>>> import carb
>>> tmp_dir = carb.tokens.get_tokens_interface().resolve("${temp}/rgb")
>>> writer.initialize(output_dir=tmp_dir, rgb=True)
>>> writer.attach([render_product])
>>> rep.orchestrator.run()
__init__(output_dir: str, s3_bucket: Optional[str] = None, s3_region: Optional[str] = None, s3_endpoint: Optional[str] = None, semantic_types: Optional[List[str]] = None, rgb: bool = False, bounding_box_2d_tight: bool = False, bounding_box_2d_loose: bool = False, semantic_segmentation: bool = False, instance_id_segmentation: bool = False, instance_segmentation: bool = False, distance_to_camera: bool = False, distance_to_image_plane: bool = False, bounding_box_3d: bool = False, occlusion: bool = False, normals: bool = False, motion_vectors: bool = False, camera_params: bool = False, pointcloud: bool = False, pointcloud_include_unlabelled: bool = False, image_output_format: str = 'png', colorize_semantic_segmentation: bool = True, colorize_instance_id_segmentation: bool = True, colorize_instance_segmentation: bool = True, skeleton_data: bool = False, frame_padding: int = 4, semantic_filter_predicate: Optional[str] = None)
write(data: dict)

Write function called from the OgnWriter node on every frame to process annotator output.

Parameters

data – A dictionary containing the annotator data for the current frame.

FPSWriter

class omni.replicator.core.scripts.writers_default.FPSWriter
__init__()
write(data)

Write ground truth.

on_final_frame()

Run after final frame is written.

KittiWriter

class omni.replicator.core.scripts.writers_default.KittiWriter(output_dir: str, s3_bucket: Optional[str] = None, s3_region: Optional[str] = None, s3_endpoint: Optional[str] = None, semantic_types: Optional[List[str]] = None, omit_semantic_type: bool = False, bbox_height_threshold: int = 25, partly_occluded_threshold: float = 0.5, fully_visible_threshold: float = 0.95, renderproduct_idxs: Optional[List[tuple]] = None, mapping_path: Optional[str] = None, colorize_instance_segmentation: bool = False, semantic_filter_predicate: Optional[str] = None, use_kitti_dir_names: bool = False)
Writer outputting data in the KITTI annotation format http://www.cvlibs.net/datasets/kitti/

Development work to provide full support is ongoing.

Supported Annotations:

RGB Object Detection (partial 2D support, see notes) Depth Semantic Segmentation Instance Segmentation

Notes

Object Detection Bounding boxes with a height smaller than 25 pixels are discarded

Supported: bounding box extents, semantic labels Partial Support: occluded (occlusion is estimated from the area ratio of tight / loose bounding boxes) Unsupported: alpha, dimensions, location, rotation_y, truncated (all set to default values of 0.0)

__init__(output_dir: str, s3_bucket: Optional[str] = None, s3_region: Optional[str] = None, s3_endpoint: Optional[str] = None, semantic_types: Optional[List[str]] = None, omit_semantic_type: bool = False, bbox_height_threshold: int = 25, partly_occluded_threshold: float = 0.5, fully_visible_threshold: float = 0.95, renderproduct_idxs: Optional[List[tuple]] = None, mapping_path: Optional[str] = None, colorize_instance_segmentation: bool = False, semantic_filter_predicate: Optional[str] = None, use_kitti_dir_names: bool = False)

Create a KITTI Writer

Parameters
  • output_dir – Output directory to which KITTI annotations will be saved.

  • semantic_types – List of semantic types to consider. If None, only consider semantic types "class".

  • omit_semantic_type – If True, only record the semantic data (ie. class: car becomes car).

  • bbox_height_threshold – The minimum valid bounding box height, in pixels. Value must be positive integers.

  • partly_occluded_threshold – Minimum occlusion factor for bounding boxes to be considered partly occluded.

  • fully_visible_threshold – Minimum occlusion factor for bounding boxes to be considered fully visible.

  • mapping_path – json path to the label to color mapping for KITTI

  • colorize_instance_segmentation – bool value representing whether image is to be colorized or not.

  • use_kitti_dir_names – If True, use standard KITTI directory names: rgb->`image_02`, semantic_segmentation->`semantic`, instance_segmentation->`instance`, object_detection->`label_02`

on_final_frame()

Run after final frame is written.

write(data)

Write ground truth.

Writer Utils

omni.replicator.core.scripts.writers_default.tools.data_to_colour(data)
omni.replicator.core.scripts.writers_default.tools.colorize_distance(distance_data, near=1e-05, far=100)

Convert distance in meters to grayscale image.

Parameters
  • distance_data (numpy.array) – data returned by the annotator.

  • near (int) – near value to clip the distance_data.

  • far (int) – far value to clip the distance_data.

Returns

Data converted to uint8 from (0, 255)

Return type

(np.array)

omni.replicator.core.scripts.writers_default.tools.binary_mask_to_rle(binary_mask)

Convert a Binary Mask to RLE format neeeded by Pycocotools: Args: binary_mask - numpy.array of 0’s and 1’s representing current segmentation returns - data in RLE format to be used by pycocotools.

omni.replicator.core.scripts.writers_default.tools.colorize_segmentation(data, labels, mapping=None)

Convert segmentation data into colored image.

Parameters
  • data (numpy.array) – data returned by the annotator.

  • dict (labels) – label data mapping semantic IDs to semantic labels - {“0”: {“class”:”cube”}, “1”: {“class”, “sphere”}}

  • mapping (dict) – mapping from ids to labels used for retrieving color {(255, 0, 0): {“class”:”cube”}, (0, 255, 0)}: {“class”:”sphere”}}

Returns

Data coverted to uint8 RGBA image and remapped labels

Return type

Tuple[np.array, dict]

omni.replicator.core.scripts.writers_default.tools.colorize_motion_vector(data)

Convert motion vector into colored image. The conversion is done by mapping 3D direction vector to HLS space, then converted to RGB.

Parameters

data (numpy.array) – data returned by the annotator of shape (H, W, 4).

Returns

Data converted to uint8 RGBA image.

Return type

(np.array)

omni.replicator.core.scripts.writers_default.tools.colorize_bbox_2d(image, data)

Colorizes 2D bounding box data for visualization.

Parameters

data (ndarray) – 2D bounding box data from the annotator.

Returns

Data converted to uint8 RGB image, which the outline of the bounding box is colored.

Return type

(np.array)

omni.replicator.core.scripts.writers_default.tools.colorize_normals(data)

Convert normals data into colored image.

Parameters

data (ndarray) – data returned by the annotator.

Returns

Data converted to uint8 RGB image.

Return type

(np.array)

omni.replicator.core.scripts.writers_default.tools.random_colours(N, enable_random=True, num_channels=4)

Generate random colors. Generate visually distinct colours by linearly spacing the hue channel in HSV space and then convert to RGB space.

Triggers

omni.replicator.core.trigger.on_frame(interval: int = 1, num_frames: int = 0, name: str = 'on_frame', rt_subframes: int = 1) ReplicatorItem

Execute on a specific generation frame.

Parameters
  • interval – The generation frame interval to execute on.

  • num_frames – The total number of frames to execute on.

  • rt_subframes – If rendering in RTX Realtime mode, specifies the number of subframes to render in order to reduce artifacts caused by large changes in the scene.

omni.replicator.core.trigger.on_key_press(key) ReplicatorItem

Execute when a keyboard key is input.

Parameters

key – The key to listen for.

omni.replicator.core.trigger.on_time(interval: float = 1, num: int = 0, name: str = 'on_time', rt_subframes: int = 32, enable_capture_on_play: bool = True) ReplicatorItem

Execute on a specific time interval. This is based on clock time.

Parameters
  • interval – The interval of elapsed time to execute on.

  • num – The number of times to execute.

  • name – The name of the trigger.

  • rt_subframes – If rendering in RTX Realtime mode, specifies the number of subframes to render in order to reduce artifacts caused by large changes in the scene.

  • enable_capture_on_play – Enable CaptureOnPlay which ties replicator capture with the timeline state. Defaults to True.

omni.replicator.core.trigger.register(fn, override=True) None

Orchestrator

omni.replicator.core.orchestrator.get_is_started()
omni.replicator.core.orchestrator.get_is_stopped()
omni.replicator.core.orchestrator.get_start_frame()
omni.replicator.core.orchestrator.get_stop_frame()
omni.replicator.core.orchestrator.preview()

Run the replicator scenario for a single iteration. Writers are disabled during preview.

omni.replicator.core.orchestrator.run(num_frames: Optional[int] = None, start_timeline: bool = False)

Run the replicator scenario

Parameters
  • num_frames – Optionally specify the maximum number of frames to capture. Note that num_frames does not override the number of frames specified in triggers defined in the scene.

  • start_timeline – Optionally start the timeline when Replicator starts.

omni.replicator.core.orchestrator.run_until_complete(num_frames: Optional[int] = None, start_timeline: bool = False)

Run the replicator scenario until stopped Generation ends when all triggers have reached their end condition or when a stop event is published.

Parameters

num_frames – Optionally specify the maximum number of frames to capture. Note that num_frames does not override the number of frames specified in triggers defined in the scene.

async omni.replicator.core.orchestrator.run_until_complete_async(num_frames: Optional[int] = None, start_timeline: bool = False)

Run the replicator scenario until stopped Generation ends when all triggers have reached their end condition or when a stop event is published.

Parameters
  • num_frames – Optionally specify the maximum number of frames to capture. Note that num_frames does not override the number of frames specified in triggers defined in the scene.

  • start_timeline – Optionally start the timeline when Replicator starts.

omni.replicator.core.orchestrator.step(rt_subframes: int = - 1, pause_timeline: bool = True)

Step one frame

If Replicator is not yet started, an initialization step is first taken to ensure the necessary settings are set for data capture. The renderer will then render as many subframes as required by current settings and schedule a frame to be captured by any active annotators and writers.

Parameters

rt_subframes – If rendering in RTX Real-Time render mode, specify the minimum number of subframes to render. This is often required when large scene changes occur to reduce rendering artifacts. If the render mode is set to Path Tracing, this argument is ignored. Values < 0 are ignored.

async omni.replicator.core.orchestrator.step_async(rt_subframes: int = - 1)

Step one frame

If Replicator is not yet started, an initialization step is first taken to ensure the necessary settings are set for data capture. The renderer will then render as many subframes as required by current settings and schedule a frame to be captured by any active annotators and writers.

Parameters

rt_subframes – If rendering in RTX Real-Time render mode, specify the minimum number of subframes to render. This is often required when large scene changes occur to reduce rendering artifacts. If the render mode is set to Path Tracing, this argument is ignored. Values < 0 are ignored.

omni.replicator.core.orchestrator.stop()

Stop the replicator scenario

Settings

omni.replicator.core.settings.carb_settings(setting: str, value: Union[List, float, ReplicatorItem]) ReplicatorItem

Set a specific carb setting

Parameters
  • setting – Carb setting to modify.

  • value – Modified carb value.

omni.replicator.core.settings.set_render_pathtraced(samples_per_pixel: Union[int, ReplicatorItem] = 64) None

Setup PathTraced render mode

Parameters

samples_per_pixel – Select the total number of samples to sample for each pixel per frame. Valid range [1, inf]

omni.replicator.core.settings.set_render_rtx_realtime(antialiasing: Union[str, ReplicatorItem] = 'FXAA') None

Setup RTX Realtime render mode

Parameters

antialiasing – Antialiasing algorithm. Select from [Off, FXAA, DLSS, TAA, DLAA]. FXAA is recommended for non-sequential data generation as it does not accumulate samples across frames.

omni.replicator.core.settings.set_stage_meters_per_unit(meters_per_unit) None

Set up the meters per unit for the stage.

omni.replicator.core.settings.set_stage_up_axis(up_axis) None

Set the up axis of the stage: X, Y, Z