Skip to main content

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];
  };
}

Metadata

Release files for tensorboard-plugin-geometry 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tensorboard-plugin-geometry 0.6.0
File Size Uploaded Provenance Actions
tensorboard_plugin_geometry-0.6.0.tar.gz 1.9 MB Without provenance Details for tensorboard_plugin_geometry-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tensorboard-plugin-geometry 0.6.0
File Interpreter ABI Platform Actions
tensorboard_plugin_geometry-0.6.0-py3-none-any.whl Python 3 none any Details for tensorboard_plugin_geometry-0.6.0-py3-none-any.whl

Total release size: 3.9 MB

Release files / tensorboard_plugin_geometry-0.6.0.tar.gz

Download URL tensorboard_plugin_geometry-0.6.0.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
5d740ce5857e8c86cd40673b0cbdfd65b8fff6389b45ef3bea46f85936e3f4a1
BLAKE2b-256 checksum
How to use checksums
e4637d40acb64ed211649550a553bc636c1e7a46e27ee9a36a61215a454e1815
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / tensorboard_plugin_geometry-0.6.0-py3-none-any.whl

Download URL tensorboard_plugin_geometry-0.6.0-py3-none-any.whl
Size 1.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
78b40b8a54a0a15243c5feb5a42d999436c1883e8ce5de6453fa6e11412b18cc
BLAKE2b-256 checksum
How to use checksums
3efd209c2d344477daa48a9f2efa9eeda166f9b292ec00aa7a4235b6ee7d947e
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for tensorboard-plugin-geometry 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page