Skip to main content

Tensorboard plugin to visualize 3D data with 3D features.

Project description

Geometry Plugin

version

Since geometric deep learning is rising, there is the need of a tensorboard plugin to visualize geometric data. In comparison to the Mesh plugin from tensorboard, this plugin is more stable and offers the opportunity to add feature vectors for each vertex.

Main features:

  • method to extend the SummaryWriter
  • visualize point clouds, meshes, and 3D feature vectors for each vertex
  • apply colormaps from colormap to point clouds and 3D feature vectors
  • perspective and orthografic visualization
  • save the visualization as .png
  • normalize scale of geometries and features

Known issues:

  • large geometries (above 40K vertices) with feature vectors need some time to be loaded and visualized
  • faces cannot be colored separately. Either use point clouds or color the whole mesh (see Usage).

Future features:

  • Use official tensorboard api, when finally provided.
  • If you have requests, please create an issue.

Installation

$ pip install tensorboard-plugin-geometry

Usage

Currently, only pytorch is supported. Since it offeres a great library geometric pytorch to apply machine learning to graphs.

write summaries

To write summaries, load the summary writing method and add this to the SummaryWriter.

from torch.utils.tensorboard import SummaryWriter

from tensorboard_plugin_geometry import add_geometry

# add writer function from this package
SummaryWriter.add_geometry = add_geometry

writer = SummaryWriter(log_dir='/a/path/to/logs')

# write data
writer.add_geometry('a beautiful tag', pos.reshape(1, 100, 3), features=wss.reshape(1, 100, 3), global_step=1)

Tip for tensorboard

If this dashboard should be use for visualizing final results, the option samples_per_plugin might be of interest:

--samples_per_plugin SAMPLES_PER_PLUGIN
                      An optional comma separated list of
                      plugin_name=num_samples pairs to explicitly specify
                      how many samples to keep per tag for that plugin. For
                      unspecified plugins, TensorBoard randomly downsamples
                      logged summaries to reasonable values to prevent out-
                      of-memory errors for long running jobs. This flag
                      allows fine control over that downsampling. Note that
                      0 means keep all samples of that type. For instance
                      "scalars=500,images=0" keeps 500 scalars and all
                      images. Most users should not need to set this flag.

For this plugin, tensors are of interest:

tensorboard --logdir=./logs --samples_per_plugin tensors=0 --tag=groundtruth

Docs

add_geometry()

Add meshes or 3D point clouds to TensorBoard. The visualization is based on Three.js, so it allows users to interact with the rendered object. Besides the basic definitions such as vertices, faces, users can further provide camera parameter, scene background.

Arguments:

Name Shape Type Description
tag string Data identifier
vertices (B, #vertices, 3) torch.float List of the 3D coordinates of vertices.
vert_colors (B, #vertices, 3) torch.uint8 List of colors from 0 to 255 for each vertex.
faces (B, #faces, 3) torch.int Indices of vertices within each triangle. (Optional)
face_color (B, 3) torch.uint8 List of colors for each sample in range [0,255]. (Optional)
features (B, #vertices, 3) torch.float feature vectors for each vertex (Optional)
feat_colors (B, #vertices, 3) torch.uint8 List of colors from 0 to 255 for each feature. (Optional)
config_dict dict Dictionary with ThreeJS configuration. (Optional)
global_step int Global step value to record (Optional)
walltime float Optional override default walltime (time.time()) seconds after epoch of event (Optional)
description string A longform readable description of the summary data. Markdown is supported. (Optional)

ThreeJS Config

The following configs are supported. For all colormaps look here. For more information on the camera attributes look here.

All colors must be given in the range [0, 255].

{
  vertices_cmap: 'jet',
  features_cmap: 'jet',
  mesh_color: [245, 124, 0],
  camera: {
    type: 'perspective', # either 'perspective' or 'orthografic'
    position: [x, y, z], # default is calculated to fit to objects in scene
    far: 1000, # far plane of camera
    near: 0.1, # near plane of camera

    # if type is perspective
    fov: 50,

    # if type is orthografic
    left: float, # default is calculated to fit to objects in scene
    right: float,
    top: float,
    bottom: float,
  },
  scene: {
    background_color: [240, 240, 240];
  };
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tensorboard_plugin_geometry-0.6.0.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

File details

Details for the file tensorboard_plugin_geometry-0.6.0.tar.gz.

File metadata

  • Download URL: tensorboard_plugin_geometry-0.6.0.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for tensorboard_plugin_geometry-0.6.0.tar.gz
Algorithm Hash digest
SHA256 5d740ce5857e8c86cd40673b0cbdfd65b8fff6389b45ef3bea46f85936e3f4a1
MD5 188ab0751cf9796a94d289e2e2d190d3
BLAKE2b-256 e4637d40acb64ed211649550a553bc636c1e7a46e27ee9a36a61215a454e1815

See more details on using hashes here.

File details

Details for the file tensorboard_plugin_geometry-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: tensorboard_plugin_geometry-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for tensorboard_plugin_geometry-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78b40b8a54a0a15243c5feb5a42d999436c1883e8ce5de6453fa6e11412b18cc
MD5 8c59863ebee43b80d71bd5f743e0687a
BLAKE2b-256 3efd209c2d344477daa48a9f2efa9eeda166f9b292ec00aa7a4235b6ee7d947e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page