I noticed that it doesn't matter how many image I save to the tensorboard log file, tensorboard will only ever show 10 of them (per tag).
How can we increase the number of images or at least select which ones are displayed?
To reproduce what I mean run following MCVE:
import torch
from torch.utils.tensorboard import SummaryWriter
tb = SummaryWriter(comment="test")
for k in range(100):
# create an image with some funny pattern
b = [n for (n, c) in enumerate(bin(k)) if c == '1']
img = torch.zeros((1,10,10))
img[0, b, :] = 0.5
img =img + img.permute([0, 2, 1])
# add the image to the tensorboard file
tb.add_image(tag="test", img_tensor=img, global_step=k)
This creates a folder runs
in which the data is saved. From the same folder execute tensorboard --logdir runs
, open the browser and go to localhost:6006
(or replace 6006
with whatever port tensorboard happens to display after starting it). Then go to the tab called "images" and move the slider above the grayscale image.
In my case it only displayed the images from steps
k = 3, 20, 24, 32, 37, 49, 52, 53, 67, 78
which isn't even an nice even spacing, but looks pretty random. I'd prefer to have
- see more than just 10 of the images I saved, and
- have a more even spacing of number of steps between each image displayed.
How can I achieve this?
EDIT: I just found the option --samples_per_plugin
and tried tensorboard --logdir runs --samples_per_plugin "images=100"
. This indeed increased the number of images, but it only showed the images from steps k = 0,1,2,3....,78
, but none from above 78
.
You probably have to wait a little bit longer to wait for all the data to be loaded, but this is indeed the correct solution, see
--help
:Regarding the random samples: This is also true, there is some sort of randomness to it, from the the FAQ: