Skip to content

Commit

Permalink
add input image in tensorboard
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-yf committed May 21, 2023
1 parent 387794b commit f9ab5b4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions VAE/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ def validation(model, loader_val, writer, step, batch_size=8, device='cuda'):
ori_img, R, T, K = next(iter(loader_val))

batch = {'x':ori_img[:,0].to(device), 'z':ori_img[:,1].to(device), 'R': R.to(device), 't': T.to(device), 'K': K.to(device),}
input_img = ori_img[:, 0].detach().cpu().numpy()
gt_img = ori_img[:, 1].detach().cpu().numpy()
gt_img = ((gt_img.clip(-1, 1)+1)*127.5).astype(np.uint8)
pred_img = model.module.eval_img(batch, None).detach().cpu().numpy()
pred_img = ((pred_img.clip(-1, 1)+1)*127.5).astype(np.uint8)

writer.add_images(f"train/input", input_img, step)
writer.add_images(f"train/gt", gt_img, step)
writer.add_images(f"train/pred",pred_img, step)

Expand Down

0 comments on commit f9ab5b4

Please sign in to comment.