kaolin.visualize

API

class kaolin.visualize.Timelapse(log_dir, up_axis='Y')

Bases: object

add_mesh_batch(iteration=0, category='', vertices_list=None, faces_list=None, uvs_list=None, face_uvs_idx_list=None, face_normals_list=None, materials_list=None)

Add meshes to visualizer output.

Parameters
  • iteration (int) – Positive integer identifying the iteration the supplied meshes belong to.

  • category (str, optional) – Batch name.

  • vertices_list (list of tensors, optional) – Vertices for N meshes of shape (num_vertices, 3).

  • faces_list (list of tensors, optional) – Faces for N meshes of shape (num_faces, face_size).

  • uvs_list (list of tensors, optional) – UV coordinates for N meshes of shape (num_uvs, 2).

  • face_uvs_idx_list (list of tensors, optional) – Index of UV coordinates for N meshes of shape (num_faces, face_size).

  • face_normals_list (list of tensors, optional) – Face normals for N meshes of shape (num_faces, face_size, 3).

  • materials_list (list, optional) – List of materials for N meshes. For each mesh, if a list of io.Materials is supplied, each material is applied to the mesh as a ShadingVariant. A name for each material can be defined by supplying a dictionary in the form of {‘material_name’: material}.

add_pointcloud_batch(iteration=0, category='', pointcloud_list=None, colors=None, points_type='point_instancer')

Add pointclouds to visualizer output.

Parameters
  • iteration (int) – Positive integer identifying the iteration the supplied pointclouds belong to.

  • category (str, optional) – Batch name.

  • pointcloud_list (list of tensors, optional) – Batch of point clouds as (B x N x 3) tensor or list of variable length point cloud tensors, each (N_i x 3).

  • colors (list of tensors, optional) – Batch of RGB colors of length N.

  • points_type (str) – String that indicates whether to save pointcloud as UsdGeomPoints or PointInstancer. “usd_geom_points” indicates UsdGeomPoints and “point_instancer” indicates PointInstancer. Please refer here for UsdGeomPoints: https://graphics.pixar.com/usd/docs/api/class_usd_geom_points.html and here for PointInstancer https://graphics.pixar.com/usd/docs/api/class_usd_geom_point_instancer.html. Default: “point_instancer”.

add_voxelgrid_batch(iteration=0, category='', voxelgrid_list=None, colors=None, semantic_ids=None)

Add voxelgrids to visualizer output.

Parameters
  • iteration (int) – Positive integer identifying the iteration the supplied voxelgrids belong to.

  • category (str, optional) – Batch name.

  • voxelgrid_list (list of tensors, optional) – Batch of points of length N defining N pointclouds.

  • colors (list of tensors, optional) – Batch of RGB colors of length N.

  • semantic_ids (list of int, optional) – Batch of semantic IDs.

class kaolin.visualize.TimelapseParser(log_dir)

Bases: object

Utility class for working with log directories created using the Timelapse interface. For example, this class can be used to extract raw data from the written checkpoints as follows:

Example

# During training timelapse = Timelapse(log_dir) timelapse.add_pointcloud_batch(iteration=idx, category=”prediction”, pointcloud_list=[predictions])

# Examining training run parser = TimelapseParser(log_dir) path = parser.get_file_path(“pointcloud”, “prediction”, 0) cloud = kaolin.io.usd.import_pointclouds(path, time=iteration_number) # time should be iteration number # Visualize, save or analyze as desired

class CategoryInfo(category, ids=None, end_time=0)

Bases: object

Corresponds to a “category” specified in Timelapse for a specific type like “mesh”. The ids corresponds to the number of objects saved in calls like add_mesh_batch, and end_time is the largest end time in the group.

add_instance(new_id, end_timecode)
serializable()
check_for_updates()

Updates parse information if it has changed in the logdir.

Returns

(bool) - True if updates exist, False if not

get_category_info(type, category)
get_category_names_by_type(type)
get_file_path(type, category, id)

Gets file path by keys. :param type: one of “mesh”, “pointcloud”, “voxelgrid” :type type: str :param category: category passed to Timelapse when writing checkpoints :type category: str :param id: id of the item within its batch :type id: int

Returns

(str) or None

static get_filepaths(logdir)

Get all USD file paths within a directory that match naming conventions imposed by Timelapse.

Parameters

logdir (str) – root directory where USD timelapse files are written

Returns

keyed by tuples (typestr, category, id_within_batch) with values

containing full USD file paths

Return type

dict

num_mesh_categories()
num_mesh_items()
num_pointcloud_categories()
num_pointcloud_items()
num_voxelgrid_categories()
num_voxelgrid_items()
static parse_filepath_info(filepaths)

Parses a directory of checkpoints written by Timelapse module into a summary format.

Parameters

filepaths – dictionary output by get_filepaths

Returns

dictionary keyed by checkpoint type (“mesh”, “pointcloud”, “voxelgrid”)

with each value a list of (serializable) CategoryInfo