0

I'm using Wandb logger to log some images inside the validation step of my model. Here is the code that I have used that,

if batch_idx % 100 == 0:
    grid = torchvision.utils.make_grid(front_img)
    imgs = [i for i in front_img[:8]]
    wandb_logger.log_image(key='front_image', image=imgs)

When I remove this line Wandb logs all the other parameters.

But when I tried to log the images i get this error saying, enter image description here

But the documentation sayes there is a log_image attribute in WandbLogger. Anyone knows the reason for this error?

2 Answers2

0

Can you try wandb.Image() and wandb.log() to log images? For example:

if batch_idx % 100 == 0:
    grid = torchvision.utils.make_grid(front_img)
    imgs = [wandb.Image(i) for i in front_img[:8]]
    wandb.log({"front_image": imgs})
0

can you give more context here? What framework are you using? What format the images are?

# cast imgs to wandb format
# I am assuming tensors of shape (3, h, w) here
imgs = [wandb.Image(tensor_img) for tensor_img in front_img[:8]]

# log imgs to the workspace
wandb.log({"samples": imgs})
tcapelle
  • 442
  • 3
  • 12