Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Tensorboard logging fails with tensorboardX 1.4 #142

Closed
constantinpape opened this issue Aug 16, 2018 · 6 comments
Closed

Tensorboard logging fails with tensorboardX 1.4 #142

constantinpape opened this issue Aug 16, 2018 · 6 comments
Assignees
Milestone

Comments

@constantinpape
Copy link
Member

The TensorboardLogger fails when logging images and using tensorboardX 1.4 with the
stack trace below.
Note that this error does not occur in tensorboardX 1.2.

  File "/home/pape/Work/software/conda/miniconda3/envs/torch41/lib/python3.6/site-packages/inferno/trainers/callbacks/logging/tensorboard.py", line 354, in log_image_or_volume_batch
    self.log_images(tag, image_list, step)
  File "/home/pape/Work/software/conda/miniconda3/envs/torch41/lib/python3.6/site-packages/inferno/trainers/callbacks/logging/tensorboard.py", line 395, in log_images
    self.writer.add_image(tag, img_tensor=image, global_step=step)
  File "/home/pape/Work/software/conda/miniconda3/envs/torch41/lib/python3.6/site-packages/tensorboardX/writer.py", line 412, in add_image
    self.file_writer.add_summary(image(tag, img_tensor), global_step, walltime)
  File "/home/pape/Work/software/conda/miniconda3/envs/torch41/lib/python3.6/site-packages/tensorboardX/summary.py", line 205, in image
    image = make_image(tensor, rescale=rescale)
  File "/home/pape/Work/software/conda/miniconda3/envs/torch41/lib/python3.6/site-packages/tensorboardX/summary.py", line 243, in make_image
    image = Image.fromarray(tensor)
  File "/home/pape/Work/software/conda/miniconda3/envs/torch41/lib/python3.6/site-packages/PIL/Image.py", line 2463, in fromarray
    raise TypeError("Cannot handle this data type")
@constantinpape
Copy link
Member Author

Fixed in 1f9831f

@constantinpape
Copy link
Member Author

Actually, this is only fixed for grayscale images.
I am not sure if it will work for RGB, because tbX might have changed its axis convention.
@nasimrahaman could you have a look?

@constantinpape constantinpape added this to the Release v0.3 milestone Nov 28, 2018
Steffen-Wolf added a commit that referenced this issue Dec 19, 2018
remove dependency on cifar dataset
expects tensorboardX 1.4 image convention
@nasimrahaman
Copy link
Collaborator

Fixed.

@Martin-Laclaustra
Copy link

TensorboardX v1.6 solved the problem.
Maybe you should deactivate your patch, try the new version and inform tensorboardX developer.

@constantinpape
Copy link
Member Author

No need to revert any changes as long as the current version is working.
As far as I remember, this error occurred because tensorboardX changed from
channel last to channel first order and we have adapted to it - this is more natural in pytorch anyways.

@constantinpape
Copy link
Member Author

@Martin-Laclaustra
If you want to check yourself if the old version of the inferno logger is working with the new tensorboardX release you can check with release 0.2, which does not have the fix for the changed axis order.
https://github.com/inferno-pytorch/inferno/releases/tag/v0.2.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants