TensorBoard on_train_end() speed improvements (#4605)

This commit is contained in:
Glenn Jocher 2021-08-30 13:01:41 +02:00 committed by GitHub
parent b894e69dfc
commit dc13820c9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,10 +131,9 @@ class Loggers():
files = [(self.save_dir / f) for f in files if (self.save_dir / f).exists()] # filter
if self.tb:
from PIL import Image
import numpy as np
import cv2
for f in files:
self.tb.add_image(f.stem, np.asarray(Image.open(f)), epoch, dataformats='HWC')
self.tb.add_image(f.stem, cv2.imread(str(f))[..., ::-1], epoch, dataformats='HWC')
if self.wandb:
self.wandb.log({"Results": [wandb.Image(str(f), caption=f.name) for f in files]})