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
Simple script with AminoLab to send ghost messages

Simple script with AminoLab to send ghost messages

Moleey 1 Nov 22, 2021
Learning with Peter Norvig's lis.py interpreter

Learning with lis.py This repository contains variations of Peter Norvig's lis.py interpreter for a subset of Scheme, described in (How to Write a (Li

Fluent Python 170 Dec 15, 2022
Rofi script to minimize / unminimize multiple windows in qtile

Qminimize Rofi script to minimize / unminimize multiple windows in qtile Additional requirements : EWMH module fuzzywuzzy module How to use it : - Clo

9 Sep 18, 2022
1. 네이버 카페 댓글을 빨리 다는 기능

naver_autoprogram 기능 설명 네이버 카페 댓글을 빨리 다는 기능 네이버 카페 자동 출석 체크 기능 동작 방식 카페 댓글 기능 기본 동작은 주기적인 스케쥴 동작으로 해당 카페 ID 와 특정 API 주소로 대상이 새글을 작성했는지 체크. 해당 대상이 새글 등

1 Dec 22, 2021
DG - A(n) (unusual) programming language

DG - A(n) (unusual) programming language General structure There are no infix-operators (i.e. 1 + 1) Each operator takes 2 parameters When there are m

1 Mar 05, 2022
Esercizi di Python svolti per il biennio di Tecnologie Informatiche.

Esercizi di Python Un piccolo aiuto per Sofia che nel 2° quadrimestre inizierà Python :) Questo repository (termine tecnico di Git) puoi trovare tutti

Leonardo Essam Dei Rossi 2 Nov 07, 2022
Repo to store back end infrastructure for Message in a Bottle

Message in a Bottle Backend API RESTful API for Message in a Bottle frontend application consumption. About The Project • Tools Used • Local Set Up •

4 Dec 05, 2021
Hashcrack - A non-object oriented open source, Software for Windows/Linux made in Python 3

Multi Force This project is a non-object oriented open source, Software for Wind

Radiationbolt 3 Jan 02, 2023
Return-Parity-MDP - Towards Return Parity in Markov Decision Processes

Towards Return Parity in Markov Decision Processes Code for the AISTATS 2022 pap

Jianfeng Chi 3 Nov 27, 2022
Automatically give thanks to Pypi packages you use in your project!

Automatically give thanks to Pypi packages you use in your project!

Ward 25 Dec 20, 2021
Very efficient backup system based on the git packfile format, providing fast incremental saves and global deduplication

Very efficient backup system based on the git packfile format, providing fast incremental saves and global deduplication (among and within files, including virtual machine images). Current release is

bup 6.9k Dec 27, 2022
PyPIContents is an application that generates a Module Index from the Python Package Index (PyPI) and also from various versions of the Python Standard Library.

PyPIContents is an application that generates a Module Index from the Python Package Index (PyPI) and also from various versions of the Python Standar

Collage Labs 10 Nov 19, 2022
Anki for desktop computers

Anki This repo contains the source code for the computer version of Anki. If you'd like to try development builds of Anki but don't feel comfortable b

Ankitects 12.9k Jan 09, 2023
Python solutions to Codeforces problems

CodeForces This repository is dedicated to my Python solutions for CodeForces problems. Feel free to copy, contribute and/or comment. If you find any

Shukur Sabzaliev 15 Dec 20, 2022
Parser for the GeoSuite[tm] PRV export format

Parser for the GeoSuite[tm] PRV export format This library provides functionality to parse geotechnical investigation data in .prv files generated by

EMerald Geomodelling 1 Dec 17, 2021
This repo presents you the official code of "VISTA: Boosting 3D Object Detection via Dual Cross-VIew SpaTial Attention"

VISTA VISTA: Boosting 3D Object Detection via Dual Cross-VIew SpaTial Attention Shengheng Deng, Zhihao Liang, Lin Sun and Kui Jia* (*) Corresponding a

104 Dec 29, 2022
This repo is related to Google Coding Challenge, given to Bright Network Internship Experience 2021.

BrightNetworkUK-GCC-2021 This repo is related to Google Coding Challenge, given to Bright Network Internship Experience 2021. Language used here is py

Dareer Ahmad Mufti 28 May 23, 2022
A calculator developed in Python.

Calculadora Uma simples calculadora... ( + − × ÷ ) 💻 Situação do projeto: Projeto finalizado ✔️ 🛠 Tecnologias: Python Tkinter (GUI) ⚙️ Pré-requisito

Arthur V.B.S. 1 Jan 27, 2022
Chemical equation balancer

Chemical equation balancer Balance your chemical equations with ease! Installation $ git clone

Marijan Smetko 4 Nov 26, 2022
A toy repo illustrating a minimal installable Python package

MyToy: a minimal Python package This repository contains a minimal, toy Python package with a few files as illustration for students of how to lay out

Fernando Perez 19 Apr 24, 2022