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
TinyBar - Tiny MacOS menu bar utility to track price dynamics for assets on TinyMan.org

📃 About A simple MacOS menu bar app to display current coins from most popular Liquidity Pools on TinyMan.org

Al 8 Dec 23, 2022
Simple project to assist in tracking/logging my working hours

Fill working hours Basic script to assist in the logging/tracking of my working hours How it works Create a file called projects.json in this director

Robin Kennedy-Reid 2 Oct 31, 2022
Here, I have discuss the three methods of list reversion. The three methods are built-in method, slicing method and position changing method.

Three-different-method-for-list-reversion Here, I have discuss the three methods of list reversion. The three methods are built-in method, slicing met

Sachin Vinayak Dabhade 4 Sep 24, 2021
Python Cheat Sheet

Introduction Pysheeet was created with intention of collecting python code snippets for reducing coding hours and making life easier and faster. Any c

CHANG-NING TSAI 7.5k Dec 30, 2022
This module extends twarc to allow you to print out tweets as text for easy testing on the command line

twarc-text This module extends twarc to allow you to print out tweets as text for easy testing on the command line. Maybe it's useful for spot checkin

Documenting the Now 2 Oct 12, 2021
PBN Obfuscator: A overpowered obfuscator for python, which will help you protect your source code

PBN Obfuscator PBN Obfuscator is a overpowered obfuscator for python, which will

Karim 6 Dec 22, 2022
Final project in KAIST AI class

mmodal_mixer MLP-Mixer based Multi-modal image-text retrieval Image: Original image is cropped with 16 x 16 patch size without overlap. Then, it is re

SuperSuperMoon 5 May 30, 2022
Script to change official Kali repository to mirrors

Script to change official Kali repository to mirrors. This helps increase packages update and downloading for some user.

Vineet Bhavsar 2 Nov 29, 2021
Turn crypto miner on/off depending on powerwall charge level

Mining Crypto with Tesla Solar and Powerwalls This script turns a crypto miner on and off when the Tesla Powerwall level drops/rises above a certain t

Matt 1 Nov 09, 2021
→ Plantilla de registro para Python

🔧 Pasos Necesarios CMD 🖥️ SOCKETS pip install sockets 🎨 COLORAMA pip install colorama 💻 Código register-by-inputs from turtle import color # Impor

Panda.xyz 4 Mar 12, 2022
SysCFG R/W Utility written in Swift

MagicCFG SysCFG R/W Utility written in Swift MagicCFG is one of our first, successful applications that we launched last year. The app makes it possib

Jan Fabel 82 Aug 08, 2022
This is an API to get user details for competitive coding platforms - Codeforces, Codechef, SPOJ, Interviewbit. More Platform will be Added Soon.

Competitive-Programming-Score-API An API to get user details for competitive coding platforms - Codeforces, Codechef, SPOJ, Interviewbit Platforms Ava

Aaditya Prakash 3 Jan 17, 2022
Auto Join Zoom Meeting

Auto-Join-Zoom-Meeting Join a zoom meeting with out filling in meeting id's or passcodes, one button for it all! Setup See attached excel document. MA

JareBear 1 Jan 25, 2022
For radiometrically calibrating and PSF deconvolving IRIS data

irispreppy For radiometrically calibrating and PSF deconvolving IRIS data. I dislike how I need to own proprietary software (IDL) just to simply prepa

Aaron W. Peat 4 Nov 01, 2022
Insert a Spotify Playlist, Get a list of YouTube URLs from it.

spotbee This is a module that spits out YouTube URLs from Spotify Playlist URLs Why use this? It is asynchronous which makes it compatible to use with

Nishant Sapkota 10 Apr 06, 2022
A(Sync) Interface for internal Audible API written in pure Python.

Audible Audible is a Python low-level interface to communicate with the non-publicly Audible API. It enables Python developers to create there own Aud

mkb79 192 Jan 03, 2023
Automated Content Feed Curator

Gathers posts from content feeds, filters, formats, delivers to you.

Alper S. Soylu 2 Jan 22, 2022
Subcert is an subdomain enumeration tool, that finds all the subdomains from certificate transparency logs.

Subcert Subcert is a subdomain enumeration tool, that finds all the valid subdomains from certificate transparency logs. Table of contents Setup Demo

A3h1nt 59 Dec 16, 2022
Decipher using Markov Chain Monte Carlo

Decipher using Markov Chain Monte Carlo

Science étonnante 43 Dec 24, 2022
Pokemon sword replay capture

pokemon-sword-replay-capture This is an old version (March 2020) pokemon-sword-replay-capture-mar-2020-version of my Pokemon Replay Capture software.

11 May 15, 2022