Tensorboard plugin 3d with python

Overview

tensorboard-plugin-3d

Overview

In this example, we render a run selector dropdown component. When the user selects a run, it shows a preview of all scalar data for tags within it. For a complete guide to plugin development, see ADDING_A_PLUGIN.

Screenshot

All files under static/* are served as static assets, with the frontend entry point being static/index.js. The plugin backend serves scalar summaries (e.g. values written by tf.summary.scalar) from runs within the --logdir passed to TensorBoard.

Getting started

To generate some scalar summaries, you can run the demo.py. Alternatively, you can write scalars from your own Python program to a log directory, using Keras callbacks or tf.summary.scalar with a summary file writer.

Copy the directory tensorboard/examples/plugins/example_raw_scalars into a desired folder. In a virtualenv with TensorBoard installed, run:

python setup.py develop

This will link the plugin into your virtualenv. Then, just run

tensorboard --logdir /tmp/runs_containing_scalars

and open TensorBoard to see the raw scalars example tab.

After making changes to static/index.js or adding assets to static/, you can refresh the page in your browser to see your changes. Modifying the backend requires restarting the TensorBoard process.

To uninstall, you can run

python setup.py develop --uninstall

to unlink the plugin from your virtualenv, after which you can also delete the tensorboard_plugin_example_raw_scalars.egg-info/ directory that the original setup.py invocation created.

Comments
  • ZeroDivisionError for a Simple Example

    ZeroDivisionError for a Simple Example

    This plugin produces a ZeroDivisonError for a simple example. I installed the most recent version (1.0.3) from pypi. I have attached the full stack trace and the relevant portion of the error is the following:

    ...
     File "/home/ubuntu/anaconda3/envs/pytensorboard3d/lib/python3.8/site-packages/tensorboard_plugin_3d/plugin.py", line 80, in _serve_image
        data = self._find_next_images(1)
    File "/home/ubuntu/anaconda3/envs/pytensorboard3d/lib/python3.8/site-packages/tensorboard_plugin_3d/plugin.py", line 173, in _find_next_images
        self.current_run = (int(idx) - 1) % len(self._all_runs)
    ZeroDivisionError: integer division or modulo by zero
    

    Steps to reproduce:

    1. Environment setup. The pip installation step is taken from here:
    conda create -n pytensorboard3d python=3.8 -y
    conda activate pytensorboard3d
    
    pip install -q "monai-weekly[gdown, nibabel, tqdm, ignite]"
    pip install -q matplotlib
    pip install -q tensorboard-plugin-3d
    
    1. Write a simple cube to the summary:
    from monai.visualize.img2tensorboard import plot_2d_or_3d_image
    import torch
    from torch.utils.tensorboard import SummaryWriter
    
    def make_white_cube_batch():
        x = torch.zeros((8, 1, 100, 100, 100))
        x[:, :, 25:75, 25:75, 25:75] = 1
        return x
    
    log_dir = '/home/ubuntu/foo'
    sw = SummaryWriter(log_dir=log_dir)
    
    batch = make_white_cube_batch()
    plot_2d_or_3d_image(data=batch, step=1, writer=sw, tag='White Cube')
    
    1. Run tensorboard from the terminal:
    tensorboard --logdir /home/ubuntu/foo --port 8080
    

    Expected behaviour:

    1. Tensorboad 3D tab appears in tensorboard.
    2. If you navigate manually to Tensorboard 3D in the plugin tab, a volume would be rendered.

    Actual Behaviour:

    1. Tensorboad 3D tab does not appear in tensorboard.
    2. If you navigate manually to Tensorboard 3D in the plugin tab, you get spinning wheel with the following message: Tensorboard 3D is loading, please wait....
    3. There is an error in the stack trace as mentioned earlier.
    image
    opened by siavashk 5
  • Bundle viewer

    Bundle viewer

    Bundle the itk-vtk-viewer with the python package

    WIP: Relies on Kitware/itk-vtk-viewer#475. Will need to update viewer version once that PR is in.

    Fixes #53

    opened by bnmajor 5
  • feat(toggle data): Add ability to toggle current data

    feat(toggle data): Add ability to toggle current data

    Support the ability to toggle between all of the images available in the logdir.

    This branch provides some changes that work around existing bugs that prevent simply updating the image/label in the viewer. Instead the viewer object is re-instantiated each time that the data is toggled and the state from the previous data is saved and re-applied to the next image and/or label.

    Relies on changes in InsightSoftwareConsortium/itk-viewer-material-ui#17

    https://user-images.githubusercontent.com/51238406/153461775-2ea2df00-f237-46f0-9ab3-d4a55f3064fa.mp4

    opened by bnmajor 3
  • Doc fixes

    Doc fixes

    1. Fix the image links in the README so that they will also work for PyPi documentation
    2. Update the Spleen Segmentation screenshots. Instead of showing the output model alone, add the input label so that you can see the difference between the input and output model.
    3. Re-organize the images into appropriate sub-directories for the docs and notebooks.
    4. Add some example images to the docs as well
    opened by bnmajor 2
  • Bump deps

    Bump deps

    This bumps the itk-vtk-viewer CDN to 11.12.4 and the itk-viewer-material-ui to 0.2.0 which resolves the array buffer error that I was seeing on data toggle. Tested against the cached spleen notebook, the unet notebook, and the example notebook that I had previously created with the reproducible errors.

    This also fixes a bug with the color range that always set the range from the previous dataset without accounting for the new data range. The range is now computed from the max of both range min values and the min of both range max values.

    The plugin will be ready to be bumped to v1.0.0 after these changes are merged in.

    opened by bnmajor 1
  • Make work offline

    Make work offline

    • Bundle itk-vtk-viewer
      • Integrate the itk-vtk-viewer WebPack configuration equivalent:

    https://github.com/Kitware/itk-vtk-viewer/blob/8925e32bfe8b34e72138b8ceb6840a087a739d68/webpack.config.js#L73-L116

    • We can possibly exclude the io WebAssembly modules if they are unnecessary.
    opened by thewtex 0
  • feat(image order): Serve the first image first

    feat(image order): Serve the first image first

    Previously the most recent image was served first to match the pattern used by the TensorBoard Images plugin. Now that we have the ability to toggle through all output I think it makes more sense to start at the beginning.

    @thewtex Let me know what you think about this change. If we should keep what we have that is fine. I am just finding it odd (even though I know the logic behind it) to always start with the last image now that we can toggle. Since most of the time people will likely be writing out all the images at once they would likely always start at the last image. Plus if there has been an update it's simple enough to jump to that now with the arrows (which do support fast clicking) or typing in the exact image number.

    opened by bnmajor 0
  • Image load order

    Image load order

    • Load the most recent image(s) first
    • Require the tag flag for plot_2d_or_3d_image in order to associate the correct data as the label
      • Update the notebooks to use this approach
    • Update the docs with more explicit instructions for how to create images in the notebook that can be used with the plugin
    opened by bnmajor 0
Releases(v1.0.3)
  • v1.0.3(May 5, 2022)

    What's Changed

    • build(package_data): Make sure that the itk directory is included by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/59

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v1.0.2...v1.0.3

    Source code(tar.gz)
    Source code(zip)
  • v1.0.2(May 4, 2022)

    What's Changed

    • Bundle viewer by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/57
    • Update Docs by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/58

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v1.0.1...v1.0.2

    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Apr 12, 2022)

    What's Changed

    • style(debug): Remove debug statement by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/55
    • feat(progress): Add progress circle and text while plugin is loading by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/56

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v1.0.0...v1.0.1

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Apr 7, 2022)

    What's Changed

    • Bump deps by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/54

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v0.1.6...v1.0.0

    Source code(tar.gz)
    Source code(zip)
  • v0.1.6(Mar 30, 2022)

    What's Changed

    • docs(notebooks): Add example notebooks with cached data by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/45
    • style(css): Position toggle in right corner by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/46
    • feat(image order): Serve the first image first by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/47
    • Add jump to first/last buttons by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/49
    • style(spelling): Tensorboard -> TensorBoard by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/50
    • fix(walrus operator): Remove walrus operator by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/51

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v0.1.5...v0.1.6

    Source code(tar.gz)
    Source code(zip)
  • v0.1.5(Feb 23, 2022)

    What's Changed

    • Itk viewer dep by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/40
    • Image load order by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/39
    • feat(toggle data): Add ability to toggle current data by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/42
    • feat(brats): Add the brats_segmentation_3d notebook by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/41

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v0.1.4...v0.1.5

    Source code(tar.gz)
    Source code(zip)
  • v0.1.4(Feb 3, 2022)

    What's Changed

    • doc(README): Add installation instructions by @thewtex in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/36
    • Doc fixes by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/37
    • doc(README): Add CI badge by @thewtex in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/38

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v0.1.3...v0.1.4

    Source code(tar.gz)
    Source code(zip)
  • v0.1.3(Jan 27, 2022)

    What's Changed

    • doc(Sphinx): Use pydata-sphinx-theme by @thewtex in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/33
    • doc(README): Add Zenodo DOI badge by @thewtex in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/31
    • fix(setup_requires): Require setuptools-scm by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/35
    • Readme updates by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/34

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v0.1.2...v0.1.3

    Source code(tar.gz)
    Source code(zip)
  • v0.1.2(Jan 27, 2022)

    What's Changed

    • docs(long_description): Set long description content type by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/29
    • docs(versioning): Sync package version with git tag using setuptools_scm by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/30

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v0.1.1...v0.1.2

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Jan 25, 2022)

    What's Changed

    • fix(publish): Add missing checkout to publish package by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/25
    • docs(version): Bump to 0.1.1 by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/26

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/compare/v0.1.0...v0.1.1

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Jan 25, 2022)

    What's Changed

    • First UI pass by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/1
    • Read tensorboard logs by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/2
    • Colab changes by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/3
    • DOC: Add PyPI badge by @thewtex in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/7
    • Add python-publish yaml file by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/11
    • Testing by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/10
    • docs(demo): Add demo notebook and colab badge by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/13
    • docs(setup.py): Add short and long description as well as url by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/14
    • docs: Add documentation by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/12
    • Notebook updates by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/18
    • style(spacing): Remove excess padding at top of UI by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/17
    • fix(docs link): Fix the README documentation link by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/23
    • fix(image processing): Remove expand_animations flag by @bnmajor in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/24

    New Contributors

    • @bnmajor made their first contribution in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/1
    • @thewtex made their first contribution in https://github.com/KitwareMedical/tensorboard-plugin-3d/pull/7

    Full Changelog: https://github.com/KitwareMedical/tensorboard-plugin-3d/commits/v0.1.0

    Source code(tar.gz)
    Source code(zip)
Owner
KitwareMedical
Kitware is the lead developer of CMake, ParaView, ITK, and VTK. We also develop special-purpose algorithms and applications, featured here.
KitwareMedical
A simple but flexible plugin system for Python.

PluginBase PluginBase is a module for Python that enables the development of flexible plugin systems in Python. Step 1: from pluginbase import PluginB

Armin Ronacher 935 Feb 20, 2021
Poetry workspace plugin for Python monorepos.

poetry-workspace-plugin Poetry workspace plugin for Python monorepos. Inspired by Yarn Workspaces. Adds a new subcommand group, poetry workspace, whic

Jack Smith 74 Jan 1, 2023
tox-gh is a tox plugin which helps running tox on GitHub Actions with multiple different Python versions on multiple workers in parallel

tox-gh is a tox plugin which helps running tox on GitHub Actions with multiple different Python versions on multiple workers in parallel. This project is inspired by tox-travis.

tox development team 19 Dec 26, 2022
Python plugin/extra to load data files from an external source (such as AWS S3) to a local directory

Data Loader Plugin - Python Table of Content (ToC) Data Loader Plugin - Python Table of Content (ToC) Overview References Python module Python virtual

Cloud Helpers 2 Jan 10, 2022
A Linux webcam plugin for BGMv2 as used in our demos.

The goal of this repository is to supplement the main Real-Time High Resolution Background Matting repo with a working demo of a videoconferencing plu

Andrey Ryabtsev 144 Dec 27, 2022
flake8 plugin which forbids match statements (PEP 634)

flake8-match flake8 plugin which forbids match statements (PEP 634)

Anthony Sottile 25 Nov 1, 2022
A minimalist production ready plugin system

pluggy - A minimalist production ready plugin system This is the core framework used by the pytest, tox, and devpi projects. Please read the docs to l

pytest-dev 876 Jan 5, 2023
A PDM plugin to publish to PyPI

PDM Publish A PDM plugin to publish to PyPI NOTE: Consider if you need this over using twine directly Installation If you installed pdm via pipx: pipx

Branch Vincent 20 Aug 6, 2022
Poetry plugin to bundle projects into various formats

Poetry bundle plugin This package is a plugin that allows the bundling of Poetry projects into various formats. Installation The easiest way to instal

Poetry 54 Jan 2, 2023
Simple card retirement plugin for Anki

Anki Retirement Addon Allow users to suspend, tag, delete, or move cards that reach a specific retirement interval Supports Anki version 2.1.45 Licens

null 3 Dec 23, 2022
A maubot plugin to invite users to Matrix rooms according to LDAP groups

LDAP Inviter Bot This is a maubot plugin that invites users to Matrix rooms according to their membership in LDAP groups.

David Mehren 14 Dec 9, 2022
Plugin to generate BOM + CPL files for JLCPCB

KiCAD JLCPCB tools Plugin to generate all files necessary for JLCPCB board fabrication and assembly Gerber files Excellon files BOM file CPL file Furt

bouni 566 Dec 29, 2022
IDA Pro plugin that shows the comments in a database

ShowComments A Simple IDA Pro plugin that shows the comments in a database Installation Copy the file showcomments.py to the plugins folder under IDA

Fernando Mercês 32 Dec 10, 2022
A plugin for poetry that allows you to execute scripts defined in your pyproject.toml, just like you can in npm or pipenv

poetry-exec-plugin A plugin for poetry that allows you to execute scripts defined in your pyproject.toml, just like you can in npm or pipenv Installat

null 38 Jan 6, 2023
A simple IDA Pro plugin to show all HexRays decompiler comments written by user

XRaysComments A simple IDA Pro plugin to show all HexRays decompiler comments written by user Installation Copy the file xray_comments.py to the plugi

Nox 20 Dec 27, 2022
A Klipper plugin for accurate Z homing

Stable Z Homing for Klipper A Klipper plugin for accurate Z homing This plugin provides a new G-code command, STABLE_Z_HOME, which homes Z repeatedly

Matthew Lloyd 24 Dec 28, 2022
A QGIS integration plugin for Kart repositories

QGIS Kart Plugin A plugin to work with Kart repositories Installation The Kart plugin is available in the QGIS Plugins server. To install the latest v

Koordinates 27 Jan 4, 2023
Tutor plugin for integration of Open edX with a Richie course catalog

Richie plugin for Tutor This is a plugin to integrate Richie, the learning portal CMS, with Open edX. The integration takes the form of a Tutor plugin

Overhang.IO 2 Sep 8, 2022
HashDB Binary Ninja Plugin

HashDB Plugin (v0.1) Author: Vector 35 Inc Plugin for interacting with the OALABS HashDB service. Description: Plugin that can be used to lookup hashe

Jordan 3 Jul 30, 2022