Tools for Generating Synthetic Data [omni.isaac.synthetic_utils]

class SyntheticDataHelper
get_camera_params(viewport)

Get active camera intrinsic and extrinsic parameters.

Returns

A dict of the active camera’s parameters.

pose (numpy.ndarray): camera position in world coordinates, fov (float): horizontal field of view in radians focal_length (float) horizontal_aperture (float) view_projection_matrix (numpy.ndarray(dtype=float64, shape=(4, 4))) resolution (dict): resolution as a dict with ‘width’ and ‘height’. clipping_range (tuple(float, float)): Near and Far clipping values.

get_groundtruth(sensor_names, viewport, verify_sensor_init=True, wait_for_sensor_data=0.1)

Get groundtruth from specified gt_sensors.

Parameters
  • sensor_names (list) – List of strings of sensor names. Valid sensors names: rgb, depth, instanceSegmentation, semanticSegmentation, boundingBox2DTight, boundingBox2DLoose, boundingBox3D, camera

  • viewport (omni.kit.viewport_legacy._viewport.IViewportWindow) – Viewport from which to retrieve/create sensor.

  • verify_sensor_init (bool) – Additional check to verify creation and initialization of sensors.

  • wait_for_sensor_data (float) – Additional time to sleep before returning ground truth so are correctly filled. Default is 0.1 seconds

Returns

Dict of sensor outputs

get_mapped_semantic_data(semantic_data: list = [[]], user_semantic_label_map: dict = {}, remap_using_base_class=False)dict

Map semantic segmentation data to IDs specified by user

Usage:

gt = get_groundtruth() user_semantic_label_map ={“cone”:4, “cylinder”:5, “cube”:6} mapped_data = get_mapped_semantic_data(gt[“semanticSegmentation”], user_semantic_label_map)

Parameters
  • semantic_data (list, optional) – Raw semantic image. Defaults to [[]].

  • user_semantic_label_map (dict, optional) – Dictionary of label to id pairs. Defaults to {}.

  • remap_using_base_class (bool, optional) – If multiple class labels are found, use the topmost one. Defaults to False.

Returns

[description]

Return type

dict

get_pose()

Get pose of all objects with a semantic label.

get_semantic_id_map(semantic_labels: list = [])dict

Get map of semantic ID from label

get_semantic_ids(semantic_data: list = [[]])List[int]

Returns unique id’s for a semantic image

Parameters

semantic_data (list, optional) – Semantic Image. Defaults to [[]].

Returns

List of unique semantic IDs in image

Return type

typing.List[int]

get_semantic_label_map(semantic_ids: list = [])dict

Get map of semantic label from ID

initialize(sensor_names, viewport)

Initialize sensors in the list provided.

Parameters
  • viewport (omni.kit.viewport_legacy._viewport.IViewportWindow) – Viewport from which to retrieve/create sensor.

  • sensor_types (list of omni.syntheticdata._syntheticdata.SensorType) – List of sensor types to initialize.

async initialize_async(sensor_names, viewport)

Initialize sensors in the list provided. Async version

Parameters
  • viewport (omni.kit.viewport_legacy._viewport.IViewportWindow) – Viewport from which to retrieve/create sensor.

  • sensor_types (list of omni.syntheticdata._syntheticdata.SensorType) – List of sensor types to initialize.

class NumpyWriter(data_dir, num_worker_threads, max_queue_size=500, sensor_settings=None)
create_output_folders(sensor_settings=None)

Checks if the sensor output folder corresponding to each viewport is created. If not, it creates them.

worker()

Processes task from queue. Each tasks contains groundtruth data and metadata which is used to transform the output and write it to disk.

class KittiWriter(data_dir='kitti_data', num_worker_threads=4, max_queue_size=500, train_size=10, classes=[], bbox_type='BBOX2DLOOSE')
create_output_folders()

Checks if the output folders are created. If not, it creates them.

worker()

Processes task from queue. Each tasks contains groundtruth data and metadata which is used to transform the output and write it to disk.

colorize_bboxes(bboxes_2d_data, bboxes_2d_rgb, num_channels=3)

Colorizes 2D bounding box data for visualization.

Parameters
  • bboxes_2d_data (numpy.ndarray) – 2D bounding box data from the sensor.

  • bboxes_2d_rgb (numpy.ndarray) – RGB data from the sensor to embed bounding box.

  • num_channels (int) – Specify number of channels i.e. 3 or 4.

colorize_depth(depth_image, width, height, num_channels=3)

Colorizes depth data for visualization.

Parameters
  • depth_image (numpy.ndarray) – Depth data from the sensor.

  • width (int) – Width of the viewport.

  • height (int) – Height of the viewport.

  • num_channels (int) – Specify number of channels i.e. 3 or 4.

colorize_segmentation(segmentation_image, width, height, num_channels=3, num_colors=None)

Colorizes segmentation data for visualization.

Parameters
  • segmentation_image (numpy.ndarray) – Segmentation data from the sensor.

  • width (int) – Width of the viewport.

  • height (int) – Height of the viewport.

  • num_channels (int) – Specify number of channels i.e. 3 or 4.

  • num_colors (int) – Specify number of colors for consistency across frames.

random_colours(N, enable_random=True, num_channels=3)

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