Images are not saved/logged

Hi all,

I am using pytorch_lightning.loggers.WandbLogger to log some intermediate results of my preprocessing but nothing (i.e. plots and images) are logged, except the key name.

Below is what I did:

wandb_logger = WandbLogger(..)
runner = Trainer(logger=wandb_logger,..)
data = VAEDataset(.., logger=runner.logger,..) # LightningDataModule

# in Dataset (in some preprocessing steps)
plt.figure(figsize=(10, 30))
plt.subplot(131), plt.imshow(orig_spec.detach(), cmap='gray')
plt.title('Input'), plt.xticks([]), plt.yticks([])
plt.subplot(132), plt.imshow(filtered_spec.squeeze().detach(), cmap='gray')
plt.title('FilteredSpec'), plt.xticks([]), plt.yticks([])
plt.subplot(133), plt.imshow(magnitude_spec.detach(), cmap='gray')
plt.title('MagnitudeSpec'), plt.xticks([]), plt.yticks([])
        {"HPFilter/Input_Filtered-_Magnitude-Spec": plt}

# alternatively, I used wandb directly
            {"HPFilter/FilteredSpec": wandb.Image(torch.flipud(filtered_spec).detach(), caption="FilteredSpec.png")}

Both gave such empty panels:.

There is no subdir called “HPFilter” under “media” but when I checked wandb-summary.json:

..., "HPFilter/FilteredSpec": {"_type": "image-file", "sha256": "92bd05772ad44d6be9ef9fed80df00ff649e378abbcbb34f73d4082aceacedb0", "size": 86404, "path": "media/images/HPFilter/FilteredSpec_2_92bd05772ad44d6be9ef.png", "format": "png", "width": 128, "height": 256, "caption": "FilteredSpec_33150.png"}, ...

To eliminate that the problem lies in my actual data, I tried the below to replace my intended logging:

    arr = torch.rand(256, 128)
            {"HPFilter/FilteredSpec": wandb.Image(torch.flipud(arr).detach().cpu().numpy(), caption=f"FilteredSpec.png")}

It still behaved the same.

Many thanks in advance for any hints!


I solved this problem over the weekend.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.