Skip to content

Commit

Permalink
add TensorBoard 3D
Browse files Browse the repository at this point in the history
casperdcl committed Sep 18, 2024

Verified

This commit was signed with the committer’s verified signature.
casperdcl Casper da Costa-Luis
1 parent 4a8a865 commit 4f2e40e
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -71,6 +71,7 @@ docker run --rm -it --gpus all -p 6006:6006 \
# 3. optionally, conda/pip/apt install environment.yml/requirements.txt/apt.txt
# 4. install metrics & run your submission
pip install git+https://github.com/TomographicImaging/Hackathon-000-Stochastic-QualityMetrics
pip install tensorboard-plugin-3d monai
python petric.py &
# 5. optionally, serve logs at <http://localhost:6006>
tensorboard --bind_all --port 6006 --logdir ./output
6 changes: 6 additions & 0 deletions petric.py
Original file line number Diff line number Diff line change
@@ -105,6 +105,12 @@ def __call__(self, algo: Algorithm):
self.tb.add_image("coronal", np.clip(x_arr[None, :, self.coronal_slice] / self.vmax, 0, 1), algo.iteration, t)
self.tb.add_image("sagittal", np.clip(x_arr[None, :, :, self.sagittal_slice] / self.vmax, 0, 1), algo.iteration,
t)
try:
from monai.visualize import img2tensorboard as tb3d
except ImportError:
pass
else:
tb3d.plot_2d_or_3d_image(x_arr[None, None], algo.iteration, self.tb, tag="volume")
log.debug("...logged")


0 comments on commit 4f2e40e

Please sign in to comment.